spec/vmc/cli/start/info_spec.rb in vmc-0.5.0.beta.12 vs spec/vmc/cli/start/info_spec.rb in vmc-0.5.0.rc1
- old
+ new
@@ -12,22 +12,34 @@
:services => fake_list(:service, 3),
:token => CFoundry::AuthToken.new("bearer some-access-token")
end
let(:target_info) do
- {:description => "Some description",
+ { :description => "Some description",
:version => 2,
:support => "http://example.com"
}
end
before do
any_instance_of described_class do |cli|
stub(cli).client { client }
end
+
+ described_class.class_eval do
+ def wrap_errors
+ yield
+ end
+ end
end
+ after do
+ described_class.class_eval do
+ remove_method :wrap_errors
+ end
+ end
+
describe 'metadata' do
let(:command) { Mothership.commands[:info] }
describe 'command' do
subject { command }
@@ -146,8 +158,16 @@
stdout.rewind
expect(stdout.readline).to match /Getting runtimes.*OK/
expect(stdout.readline).to match /Getting frameworks.*OK/
expect(stdout.readline).to match /Getting services.*OK/
+ end
+ end
+
+ context 'when there is no target' do
+ let(:client) { nil }
+
+ it "tells the user to run 'vmc target'" do
+ expect { subject }.to raise_error(VMC::UserError)
end
end
end