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
+ let(:repo_name) do
+ 'testrepo_already_exists'
+ end
+ before(:all) do
+ shell("mkdir #{tmpdir}/#{repo_name}")
+ shell("cd #{tmpdir}/#{repo_name} && git init")
+ shell("cd #{tmpdir}/#{repo_name} && touch a && git add a && git commit -m 'a'")
+ end
+ after(:all) do
+ shell("rm -rf #{tmpdir}/#{repo_name}")
+ end
+
+ it 'applies the manifest' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/#{repo_name}":
+ ensure => present,
+ source => "file://#{tmpdir}/testrepo.git",
+ provider => git,
+ force => true,
+ noop => true,
+ }
+ EOS
+
+ apply_manifest(pp, :catch_changes => true) do |r|
+ expect(r.stdout).to match(/Noop Mode/)
+ end
+ end
end
end
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
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
-
- after(:all) do
- pp = <<-EOS
- user { 'testuser-ssh':
- ensure => absent,
- managehome => true,
- }
- EOS
- apply_manifest(pp, :catch_failures => true)
- end
end
end