Sha256: f54b510e08384c123e8f587dca3636742a74ba189acf78c0afafb34035fd5d22
Contents?: true
Size: 1.59 KB
Versions: 11
Compression:
Stored size: 1.59 KB
Contents
require 'chake/node' describe Chake::Node do before do ent = double allow(ent).to receive(:name).and_return('jonhdoe') allow(Etc).to receive(:getpwuid).and_return(ent) end let(:simple) { Chake::Node.new('hostname') } it('has a name') { expect(simple.hostname).to eq('hostname') } it('uses ssh by default') { expect(simple.backend).to be_an_instance_of(Chake::Backend::Ssh) } it('user current username by default') { expect(simple.username).to eq('jonhdoe') } it('writes to /var/tmp/chef.$username') { expect(simple.path).to eq('/var/tmp/chef.jonhdoe') } let(:with_username) { Chake::Node.new('username@hostname') } it('accepts username') { expect(with_username.username).to eq('username') } it('uses ssh') { expect(with_username.backend).to be_an_instance_of(Chake::Backend::Ssh) } let(:with_backend) { Chake::Node.new('local://hostname')} it('accepts backend as URI scheme') { expect(with_backend.backend).to be_an_instance_of(Chake::Backend::Local) } it('wont accept any backend') do expect { Chake::Node.new('foobar://bazqux').backend }.to raise_error(ArgumentError) end let(:with_data) { Chake::Node.new('local://localhost', 'run_list' => ['recipe[common]']) } it('takes data') do expect(with_data.data).to be_a(Hash) end [:run, :run_as_root, :rsync_dest].each do |method| it("delegates #{method} to backend") do node = simple backend = double args = Object.new allow(node).to receive(:backend).and_return(backend) expect(backend).to receive(method).with(args) node.send(method, args) end end end
Version data entries
11 entries across 11 versions & 1 rubygems