spec/unit/action/deploy/module_spec.rb in r10k-3.7.0 vs spec/unit/action/deploy/module_spec.rb in r10k-3.8.0

- old
+ new

@@ -31,10 +31,18 @@ end it 'can accept a cachedir option' do described_class.new({ cachedir: '/nonexistent' }, []) end + + it 'can accept a private-key option' do + described_class.new({ 'private-key': '/nonexistent' }, []) + end + + it 'can accept a token option' do + described_class.new({ 'oauth-token': '/nonexistent' }, []) + end end describe "with no-force" do subject { described_class.new({ config: "/some/nonexistent/path", :'no-force' => true}, [] )} @@ -72,12 +80,12 @@ ) end before do allow(subject).to receive(:visit_environment).and_wrap_original do |original, environment, &block| - expect(environment.puppetfile).to receive(:modules_by_vcs_cachedir).and_return( - {none: [R10K::Module::Local.new(environment.name, '/fakedir', [], environment)]} + expect(environment.puppetfile).to receive(:modules).and_return( + [R10K::Module::Local.new(environment.name, '/fakedir', [], environment)] ) original.call(environment, &block) end end @@ -143,10 +151,28 @@ describe 'with cachedir' do subject { described_class.new({ config: '/some/nonexistent/path', cachedir: '/nonexistent' }, []) } - it 'sets puppet_path' do + it 'sets cachedir' do expect(subject.instance_variable_get(:@cachedir)).to eq('/nonexistent') + end + end + + describe 'with private-key' do + + subject { described_class.new({ config: '/some/nonexistent/path', 'private-key': '/nonexistent' }, []) } + + it 'sets private_key' do + expect(subject.instance_variable_get(:@private_key)).to eq('/nonexistent') + end + end + + describe 'with oauth-token' do + + subject { described_class.new({ config: '/some/nonexistent/path', 'oauth-token': '/nonexistent' }, []) } + + it 'sets token_path' do + expect(subject.instance_variable_get(:@oauth_token)).to eq('/nonexistent') end end end