spec/unit/module/svn_spec.rb in r10k-3.11.0 vs spec/unit/module/svn_spec.rb in r10k-3.12.0

- old
+ new

@@ -4,10 +4,17 @@ describe R10K::Module::SVN do include_context 'fail on execution' + describe "statically determined version support" do + it 'is unsupported by svn backed modules' do + static_version = described_class.statically_defined_version('branan/eight_hundred', { svn: 'my/remote', revision: '123adf' }) + expect(static_version).to eq(nil) + end + end + describe "determining it implements a Puppetfile mod" do it "implements mods with the :svn hash key" do implements = described_class.implement?('r10k-fixture-repo', :svn => 'https://github.com/adrienthebo/r10k-fixture-repo') expect(implements).to eq true end @@ -126,11 +133,10 @@ let(:dirname) { Pathname.new(Dir.mktmpdir) } let(:spec_path) { dirname + module_name + 'spec' } subject { described_class.new(title, dirname, {}) } it 'is kept by default' do - FileUtils.mkdir_p(spec_path) expect(subject).to receive(:status).and_return(:absent) expect(subject).to receive(:install).and_return(nil) subject.sync expect(Dir.exist?(spec_path)).to eq true @@ -148,38 +154,38 @@ describe "and the state is :absent" do before { allow(subject).to receive(:status).and_return :absent } it "installs the SVN module" do expect(subject).to receive(:install) - subject.sync + expect(subject.sync).to be true end end describe "and the state is :mismatched" do before { allow(subject).to receive(:status).and_return :mismatched } it "reinstalls the module" do expect(subject).to receive(:reinstall) - subject.sync + expect(subject.sync).to be true end it "removes the existing directory" do expect(subject.path).to receive(:rmtree) allow(subject).to receive(:install) - subject.sync + expect(subject.sync).to be true end end describe "and the state is :outdated" do before { allow(subject).to receive(:status).and_return :outdated } it "upgrades the repository" do expect(subject).to receive(:update) - subject.sync + expect(subject.sync).to be true end end describe "and the state is :insync" do before { allow(subject).to receive(:status).and_return :insync } @@ -187,10 +193,16 @@ it "doesn't change anything" do expect(subject).to receive(:install).never expect(subject).to receive(:reinstall).never expect(subject).to receive(:update).never - subject.sync + expect(subject.sync).to be false end + end + + it 'and `should_sync?` is false' do + # modules do not sync if they are not requested + mod = described_class.new('my_mod', '/path/to/mod', { overrides: { modules: { requested_modules: ['other_mod'] } } }) + expect(mod.sync).to be false end end end