Sha256: bc82b4ec06cd9607ac7a2261cac2289a6b0ec7cd4cbca7411d0f0b987a14003f
Contents?: true
Size: 2 KB
Versions: 40
Compression:
Stored size: 2 KB
Contents
require "spec_helper" describe "brightbox servers" do let(:output) { FauxIO.new { Brightbox.run(argv) } } let(:stdout) { output.stdout } let(:stderr) { output.stderr } let(:resource_class) { Brightbox::Server } let(:resource_id) { "srv-12345" } let(:resource) { double(resource_class, :to_s => resource_id) } let(:resource_ids) { [resource_id] } let(:results) { [resource] } before do config = config_from_contents(USER_APP_CONFIG_CONTENTS) cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727") end describe "lock" do context "when resource is known" do let(:argv) { %w(servers lock srv-12345) } before do expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results) expect(resource).to receive(:lock!) end it "outputs notice to STDERR" do expect(stderr).to match("Locking #{resource_id}") end end context "when resource is unknown" do let(:argv) { %w(servers lock srv-12345) } before do expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound) end it "outputs error to STDERR" do expect(stderr).to match("Couldn't find #{resource_id}") end end end describe "unlock" do context "when resource is known" do let(:argv) { %w(servers unlock srv-12345) } before do expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results) expect(resource).to receive(:unlock!) end it "outputs notice to STDERR" do expect(stderr).to match("Unlocking #{resource_id}") end end context "when resource is unknown" do let(:argv) { %w(servers unlock srv-12345) } before do expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound) end it "outputs error to STDERR" do expect(stderr).to match("Couldn't find #{resource_id}") end end end end
Version data entries
40 entries across 40 versions & 1 rubygems