end
describe file("#{tmpdir}/testrepo/.git") do
- it { should be_directory }
+ it { is_expected.to be_directory }
end
describe file("#{tmpdir}/testrepo/.git/HEAD") do
- it { should contain 'ref: refs/heads/master' }
+ it { is_expected.to contain 'ref: refs/heads/master' }
end
end
end
describe file("#{tmpdir}/testrepo_sha/.git") do
- it { should be_directory }
+ it { is_expected.to be_directory }
end
describe file("#{tmpdir}/testrepo_sha/.git/HEAD") do
- it { should contain sha }
+ it { is_expected.to contain sha }
end
end
end
describe file("#{tmpdir}/testrepo_tag/.git") do
- it { should be_directory }
+ it { is_expected.to be_directory }
end
it 'should have the tag as the HEAD' do
end
describe file("#{tmpdir}/testrepo_branch/.git") do
- it { should be_directory }
+ it { is_expected.to be_directory }
end
describe file("#{tmpdir}/testrepo_branch/.git/HEAD") do
- it { should contain 'ref: refs/heads/a_branch' }
+ it { is_expected.to contain 'ref: refs/heads/a_branch' }
end
end
end
describe file("#{tmpdir}/testrepo_shallow/.git/shallow") do
- it { should be_file }
+ it { is_expected.to be_file }
end
end
end
describe file("#{tmpdir}/testrepo_owner") do
- it { should be_directory }
- it { should be_owned_by 'vagrant' }
+ it { is_expected.to be_directory }
+ it { is_expected.to be_owned_by 'vagrant' }
end
end
end
describe file("#{tmpdir}/testrepo_group") do
- it { should be_directory }
- it { should be_grouped_into 'vagrant' }
+ it { is_expected.to be_directory }
+ it { is_expected.to be_grouped_into 'vagrant' }
end
end
end
describe file("#{tmpdir}/testrepo_excludes/.git/info/exclude") do
- its(:content) { should match /exclude1.txt/ }
- its(:content) { should match /exclude2.txt/ }
+ describe '#content' do
+ subject { super().content }
+ it { is_expected.to match /exclude1.txt/ }
+ end
+
+ describe '#content' do
+ subject { super().content }
+ it { is_expected.to match /exclude2.txt/ }
+ end
end
end
end
describe file("#{tmpdir}/testrepo_force/folder") do
- it { should_not be_directory }
+ it { is_expected.not_to be_directory }
end
describe file("#{tmpdir}/testrepo_force/temp.txt") do
- it { should_not be_file }
+ it { is_expected.not_to be_file }
end
describe file("#{tmpdir}/testrepo_force/.git") do
- it { should be_directory }
+ it { is_expected.to be_directory }
end
context 'and noop' do
end
describe file("#{tmpdir}/testrepo_user") do
- it { should be_directory }
- it { should be_owned_by 'testuser' }
+ it { is_expected.to be_directory }
+ it { is_expected.to be_owned_by 'testuser' }
end
describe file("#{tmpdir}/testrepo_user") do
- it { should be_directory }
- it { should be_grouped_into 'testuser' }
+ it { is_expected.to be_directory }
+ it { is_expected.to be_grouped_into 'testuser' }
end
end
end
describe file("#{tmpdir}/testrepo_blank_repo/.git") do
- it { should be_directory }
+ it { is_expected.to be_directory }
end
end
end
describe file("#{tmpdir}/testrepo_bare_repo/config") do
- it { should contain 'bare = true' }
+ it { is_expected.to contain 'bare = true' }
end
describe file("#{tmpdir}/testrepo_bare_repo/.git") do
- it { should_not be_directory }
+ it { is_expected.not_to be_directory }
end
end
end
describe file("#{tmpdir}/testrepo_bare_repo_rev") do
- it { should_not be_directory }
+ it { is_expected.not_to be_directory }
end
end
end
end
describe file("#{tmpdir}/testrepo_deleted") do
- it { should_not be_directory }
+ it { is_expected.not_to be_directory }
end
end
end
describe file("#{tmpdir}/testrepo_noop_deleted") do
- it { should be_directory }
+ it { is_expected.to be_directory }
end
end
it "should return the ref" do
resource[:revision] = '2634'
provider.expects(:bzr).with('revision-info', '2634').returns("2634 menesis@pov.lt-20100309191856-4wmfqzc803fj300x\n")
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
context "when its revid is different than the current revid" do
it "should return the current revid" do
resource[:revision] = '2636'
provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("2635 foo\n")
- provider.revision.should == @current_revid
+ expect(provider.revision).to eq(@current_revid)
end
end
end
it "should return it" do
resource[:revision] = 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x'
provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("1234 #{resource.value(:revision)}\n")
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
context "when it is not the same as the current revid" do
it "should return the current revid" do
resource[:revision] = 'menesis@pov.lt-20100309191856-4wmfqzc803fj300y'
provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("2636 foo\n")
- provider.revision.should == @current_revid
+ expect(provider.revision).to eq(@current_revid)
end
end
end
it "should read CVS/Tag" do
File.expects(:read).with(@tag_file).returns("T#{@tag}")
- provider.revision.should == @tag
+ expect(provider.revision).to eq(@tag)
end
end
File.expects(:exist?).with(@tag_file).returns(false)
end
it "assumes HEAD" do
- provider.revision.should == 'HEAD'
+ expect(provider.revision).to eq('HEAD')
end
end
end
it "should raise an exception" do
provider.expects(:path_exists?).returns(true)
provider.expects(:path_empty?).returns(false)
- proc { provider.create }.should raise_error(Puppet::Error)
+ expect { provider.create }.to raise_error(Puppet::Error)
end
end
end
provider.expects(:path_exists?).returns(true)
provider.expects(:path_empty?).returns(false)
provider.expects(:working_copy_exists?).returns(false)
- proc { provider.create }.should raise_error(Puppet::Error)
+ expect { provider.create }.to raise_error(Puppet::Error)
end
end
end
context "when its SHA is not different than the current SHA" do
it "should return the ref" do
provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('currentsha')
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
context "when its SHA is different than the current SHA" do
it "should return the current SHA" do
provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('othersha')
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
it "should return the revision" do
provider.stubs(:git).with('branch', '-a').returns(" remotes/origin/#{resource.value(:revision)}")
provider.expects(:git).with('rev-parse', "origin/#{resource.value(:revision)}").returns("newsha")
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
provider.expects(:git).with('config', 'remote.origin.url').returns('old')
provider.expects(:git).with('config', 'remote.origin.url', 'git://git@foo.com/bar.git')
provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('currentsha')
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
end
context "when it's listed in 'git branch -a'" do
it "should return true" do
resource[:revision] = 'feature/foo'
- provider.should be_local_branch_revision
+ expect(provider).to be_local_branch_revision
end
end
context "when it's not listed in 'git branch -a'" do
it "should return false" do
resource[:revision] = 'feature/notexist'
- provider.should_not be_local_branch_revision
+ expect(provider).not_to be_local_branch_revision
end
end
end
context "when it's listed in 'git branch -a' with an 'origin/' prefix" do
it "should return true" do
resource[:revision] = 'only/remote'
- provider.should be_remote_branch_revision
+ expect(provider).to be_remote_branch_revision
end
end
context "when it's not listed in 'git branch -a' with an 'origin/' prefix" do
it "should return false" do
resource[:revision] = 'only/local'
- provider.should_not be_remote_branch_revision
+ expect(provider).not_to be_remote_branch_revision
end
end
end
it do
provider.expects(:revision).returns('testrev')
provider.expects(:latest_revision).returns('testrev')
- provider.latest?.should be_true
+ expect(provider.latest?).to be_truthy
end
end
context 'when false' do
it do
provider.expects(:revision).returns('master')
provider.expects(:latest_revision).returns('testrev')
- provider.latest?.should be_false
+ expect(provider.latest?).to be_falsey
end
end
end
context "when its SHA is not different than the current SHA" do
it "should return the ref" do
resource[:revision] = '0.6'
- provider.revision.should == '0.6'
+ expect(provider.revision).to eq('0.6')
end
end
context "when its SHA is different than the current SHA" do
it "should return the current SHA" do
resource[:revision] = '0.5.3'
- provider.revision.should == '34e6012c783a'
+ expect(provider.revision).to eq('34e6012c783a')
end
end
end
it "should return it" do
resource[:revision] = '34e6012c783a'
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
it "should return the current SHA" do
resource[:revision] = 'not-the-same'
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
- provider.revision.should == '34e6012c783a'
+ expect(provider.revision).to eq('34e6012c783a')
end
end
end
end
it "should use 'svn info'" do
expects_chdir
- provider.revision.should == '4' # From 'Revision', not 'Last Changed Rev'
+ expect(provider.revision).to eq('4') # From 'Revision', not 'Last Changed Rev'
end
end