Sha256: 79993ba73495f3e1f3c66fdd5c66f7b7387b99c60b34c82d4dc3403857049fba
Contents?: true
Size: 983 Bytes
Versions: 70
Compression:
Stored size: 983 Bytes
Contents
require 'spec_helper' describe Ridley::ClientResource do subject { described_class.new(double('registry')) } describe "#regenerate_key" do let(:client_id) { "rspec-client" } before { subject.stub(find: nil) } context "when a client with the given ID exists" do let(:client) { double('chef-client') } before { subject.should_receive(:find).with(client_id).and_return(client) } it "sets the private key to true and updates the client" do client.should_receive(:private_key=).with(true) subject.should_receive(:update).with(client) subject.regenerate_key(client_id) end end context "when a client with the given ID does not exist" do before { subject.should_receive(:find).with(client_id).and_return(nil) } it "raises a ResourceNotFound error" do expect { subject.regenerate_key(client_id) }.to raise_error(Ridley::Errors::ResourceNotFound) end end end end
Version data entries
70 entries across 70 versions & 1 rubygems