vmc 0.5.0.rc4 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,31 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe VMC::Domain::Unmap do
4
- let(:global) { { :color => false } }
5
- let(:given) { {} }
6
- let(:client) { fake_client :current_organization => organization, :current_space => space }
7
- let!(:cli) { described_class.new }
8
-
9
- before do
10
- stub(cli).client { client }
11
- stub_output(cli)
3
+ command VMC::Domain::Unmap do
4
+ let(:client) do
5
+ fake_client(
6
+ :current_organization => organization,
7
+ :current_space => space,
8
+ :spaces => [space],
9
+ :organizations => [organization],
10
+ :domains => [domain])
12
11
  end
13
12
 
14
- let(:organization) { fake(:organization) }
13
+ let(:organization) { fake(:organization, :spaces => [space]) }
15
14
  let(:space) { fake(:space) }
16
- let(:domain) { fake(:domain, :name => domain_name) }
17
- let(:domain_name) { "some.domain.com" }
18
-
19
- subject { invoke_cli(cli, :unmap_domain, inputs, given, global) }
15
+ let(:domain) { fake(:domain, :name => "some.domain.com") }
20
16
 
21
17
  context "when the --delete flag is given" do
22
- let(:inputs) { { :domain => domain, :delete => true } }
18
+ subject { vmc %W[unmap-domain #{domain.name} --delete] }
23
19
 
24
20
  it "asks for a confirmation" do
25
- mock_ask("Really delete #{domain_name}?", :default => false) { false }
21
+ mock_ask("Really delete #{domain.name}?", :default => false) { false }
26
22
  stub(domain).delete!
27
23
  subject
28
24
  end
29
25
 
30
26
  context "and the user answers 'no' to the confirmation" do
31
27
  it "does NOT delete the domain" do
32
- stub_ask("Really delete #{domain_name}?", anything) { false }
28
+ stub_ask("Really delete #{domain.name}?", anything) { false }
33
29
  dont_allow(domain).delete!
34
30
  subject
35
31
  end
@@ -37,7 +33,7 @@ describe VMC::Domain::Unmap do
37
33
 
38
34
  context "and the user answers 'yes' to the confirmation" do
39
35
  it "deletes the domain" do
40
- stub_ask("Really delete #{domain_name}?", anything) { true }
36
+ stub_ask("Really delete #{domain.name}?", anything) { true }
41
37
  mock(domain).delete!
42
38
  subject
43
39
  end
@@ -45,7 +41,7 @@ describe VMC::Domain::Unmap do
45
41
  end
46
42
 
47
43
  context "when a space is given" do
48
- let(:inputs) { { :domain => domain, :space => space } }
44
+ subject { vmc %W[unmap-domain #{domain.name} --space #{space.name}] }
49
45
 
50
46
  it "unmaps the domain from the space" do
51
47
  mock(space).remove_domain(domain)
@@ -54,7 +50,7 @@ describe VMC::Domain::Unmap do
54
50
  end
55
51
 
56
52
  context "when an organization is given" do
57
- let(:inputs) { { :domain => domain, :organization => organization } }
53
+ subject { vmc %W[unmap-domain #{domain.name} --organization #{organization.name}] }
58
54
 
59
55
  it "unmaps the domain from the organization" do
60
56
  mock(organization).remove_domain(domain)
@@ -63,11 +59,11 @@ describe VMC::Domain::Unmap do
63
59
  end
64
60
 
65
61
  context "when only the domain is given" do
66
- let(:inputs) { { :domain => domain } }
62
+ subject { vmc %W[unmap-domain #{domain.name}] }
67
63
 
68
64
  it "unmaps the domain from the current space" do
69
65
  mock(client.current_space).remove_domain(domain)
70
66
  subject
71
67
  end
72
68
  end
73
- end
69
+ end
@@ -1,25 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe VMC::Route::Map do
4
- let(:inputs) { {} }
5
- let(:global) { { :color => false } }
6
- let(:given) { {} }
7
- let(:client) { fake_client }
8
- let!(:cli) { described_class.new }
9
-
10
- before do
11
- stub(cli).client { client }
12
- stub_output(cli)
13
- end
3
+ command VMC::Route::Map do
4
+ let(:client) { fake_client(:apps => apps, :routes => routes) }
14
5
 
15
- let(:app){ fake(:app, :space => space, :name => "app-name") }
16
- let(:space) { fake(:space, :name => "space-name", :domains => space_domains) }
17
- let(:domain) { fake(:domain, :name => domain_name ) }
18
- let(:domain_name) { "some-domain.com" }
19
- let(:host_name) { "some-host" }
20
- let(:space_domains) { [] }
6
+ let(:app) { fake(:app, :space => space, :name => "app-name") }
7
+ let(:space) { fake(:space, :domains => space_domains) }
8
+ let(:domain) { fake(:domain) }
21
9
 
22
- subject { invoke_cli(cli, :map, inputs, given, global) }
10
+ let(:apps) { [app] }
11
+ let(:routes) { [] }
12
+ let(:domains) { [domain] }
13
+
14
+ let(:space_domains) { domains }
15
+
16
+ let(:host_name) { "some-host" }
23
17
 
24
18
  context 'when targeting v2' do
25
19
  shared_examples "mapping the route to the app" do
@@ -27,8 +21,11 @@ describe VMC::Route::Map do
27
21
  let(:space_domains) { [domain] }
28
22
 
29
23
  context 'and the route is mapped to the space' do
30
- let(:client) { fake_client :routes => [route] }
31
- let(:route) { fake(:route, :space => space, :host => host_name, :domain => domain) }
24
+ let(:routes) { [route] }
25
+ let(:route) do
26
+ fake(:route, :space => space, :host => host_name,
27
+ :domain => domain)
28
+ end
32
29
 
33
30
  it 'binds the route to the app' do
34
31
  mock(app).add_route(route)
@@ -46,8 +43,8 @@ describe VMC::Route::Map do
46
43
  end
47
44
 
48
45
  it 'indicates that it is creating a route' do
49
- mock(cli).print("Creating route #{host_name}.#{domain_name}")
50
46
  subject
47
+ expect(output).to say("Creating route #{host_name}.#{domain.name}")
51
48
  end
52
49
 
53
50
  it "creates the route in the app's space" do
@@ -59,8 +56,8 @@ describe VMC::Route::Map do
59
56
  end
60
57
 
61
58
  it 'indicates that it is binding the route' do
62
- mock(cli).print("Binding #{host_name}.#{domain_name} to app-name")
63
59
  subject
60
+ expect(output).to say("Binding #{host_name}.#{domain.name} to #{app.name}")
64
61
  end
65
62
 
66
63
  it 'binds the route to the app' do
@@ -72,15 +69,14 @@ describe VMC::Route::Map do
72
69
  end
73
70
 
74
71
  context 'when an app is specified' do
75
- let(:inputs) { { :domain => domain, :host => host_name, :app => app } }
72
+ subject { vmc %W[map #{app.name} #{host_name} #{domain.name}] }
76
73
 
77
74
  context 'and the domain is not already mapped to the space' do
78
75
  let(:space_domains) { [] }
79
- let(:inputs) { { :app => app } }
80
- let(:given) { { :domain => "some-bad-domain" }}
81
76
 
82
77
  it 'indicates that the domain is invalid' do
83
- expect { subject }.to raise_error(VMC::UserError, /Unknown domain/)
78
+ subject
79
+ expect(error_output).to say("Unknown domain")
84
80
  end
85
81
  end
86
82
 
@@ -88,10 +84,11 @@ describe VMC::Route::Map do
88
84
  end
89
85
 
90
86
  context 'when an app is not specified' do
91
- let(:inputs) { { :domain => domain, :host => host_name } }
92
87
  let(:space_domains) { [domain] }
93
88
  let(:new_route) { fake(:route) }
94
89
 
90
+ subject { vmc %W[map --host #{host_name} #{domain.name}] }
91
+
95
92
  before { stub_ask("Which application?", anything) { app } }
96
93
 
97
94
  it 'asks for an app' do
@@ -106,9 +103,10 @@ describe VMC::Route::Map do
106
103
  end
107
104
 
108
105
  context "when a host is not specified" do
109
- let(:inputs) { { :domain => domain, :app => app } }
110
106
  let(:new_route) { fake(:route) }
111
107
 
108
+ subject { vmc %W[map #{app.name} #{domain.name}] }
109
+
112
110
  before do
113
111
  stub(client).route { new_route }
114
112
  stub(app).add_route
@@ -124,10 +122,14 @@ describe VMC::Route::Map do
124
122
  end
125
123
 
126
124
  context 'when targeting v1' do
127
- let(:given) { { :domain => "foo.bar.com" } }
128
- let(:app) { v1_fake :app, :name => "foo" }
129
125
  let(:client) { v1_fake_client }
130
- let(:inputs) { { :app => app } }
126
+ let(:app) { v1_fake :app, :name => "foo" }
127
+
128
+ subject { vmc %W[map #{app.name} foo.bar.com] }
129
+
130
+ before do
131
+ stub(client).app_by_name("foo") { app }
132
+ end
131
133
 
132
134
  it "adds the domain to the app's urls" do
133
135
  stub(app).update!
@@ -1,11 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe VMC::Route::Unmap do
4
- let(:global) { { :color => false } }
5
- let(:given) { {} }
6
- let(:inputs) { {} }
7
- let(:client) { fake_client }
8
- let!(:cli) { described_class.new }
3
+ command VMC::Route::Unmap do
4
+ let(:client) { fake_client :apps => [app] }
5
+
9
6
  let(:app){ fake(:app, :space => space, :name => "app-name") }
10
7
  let(:space) { fake(:space, :name => "space-name", :domains => space_domains) }
11
8
  let(:domain) { fake(:domain, :name => domain_name ) }
@@ -14,13 +11,6 @@ describe VMC::Route::Unmap do
14
11
  let(:url) { "#{host_name}.#{domain_name}" }
15
12
  let(:space_domains) { [domain] }
16
13
 
17
- before do
18
- stub(cli).client { client }
19
- stub_output(cli)
20
- end
21
-
22
- subject { invoke_cli(cli, :unmap, inputs, given, global) }
23
-
24
14
  describe 'metadata' do
25
15
  let(:command) { Mothership.commands[:delete_service] }
26
16
 
@@ -42,11 +32,9 @@ describe VMC::Route::Unmap do
42
32
 
43
33
  context 'when targeting v2' do
44
34
  context "when an app and a url are specified" do
45
- let(:given) { { :url => url } }
46
- let(:inputs) { { :app => app } }
35
+ subject { vmc %W[unmap #{url} #{app.name}] }
47
36
 
48
37
  context "when the given route is mapped to the given app" do
49
- let(:client) { fake_client :routes => [route] }
50
38
  let(:app) { fake(:app, :space => space, :name => "app-name", :routes => [route]) }
51
39
  let(:route) { fake(:route, :space => space, :host => host_name, :domain => domain) }
52
40
 
@@ -58,7 +46,8 @@ describe VMC::Route::Unmap do
58
46
 
59
47
  context "when the given route is NOT mapped to the given app" do
60
48
  it "displays an error" do
61
- expect { subject }.to raise_error(VMC::UserError, /Unknown route/)
49
+ subject
50
+ expect(error_output).to say("Unknown route")
62
51
  end
63
52
  end
64
53
  end
@@ -67,9 +56,8 @@ describe VMC::Route::Unmap do
67
56
  let(:other_route) { fake(:route, :host => "abcd", :domain => domain) }
68
57
  let(:route) { fake(:route, :host => "efgh", :domain => domain) }
69
58
  let(:app) { fake(:app, :space => space, :routes => [route, other_route] )}
70
- let(:inputs) { { :app => app } }
71
59
 
72
- before { stub(app).remove_route(route) }
60
+ subject { vmc %W[unmap --app #{app.name}] }
73
61
 
74
62
  it "asks the user to select from the app's urls" do
75
63
  mock_ask("Which URL?", anything) do |_, opts|
@@ -77,6 +65,8 @@ describe VMC::Route::Unmap do
77
65
  route
78
66
  end
79
67
 
68
+ stub(app).remove_route(anything)
69
+
80
70
  subject
81
71
  end
82
72
 
@@ -91,7 +81,8 @@ describe VMC::Route::Unmap do
91
81
  let(:other_route) { fake(:route, :host => "abcd", :domain => domain) }
92
82
  let(:route) { fake(:route, :host => "efgh", :domain => domain) }
93
83
  let(:app) { fake(:app, :routes => [route, other_route]) }
94
- let(:inputs) { { :app => app, :all => true } }
84
+
85
+ subject { vmc %W[unmap --all --app #{app.name}] }
95
86
 
96
87
  it "unmaps all routes from the given app" do
97
88
  mock(app).remove_route(route)
@@ -103,8 +94,8 @@ describe VMC::Route::Unmap do
103
94
  context "when a url is specified and the --delete option is given" do
104
95
  let(:route) { fake(:route, :host => host_name, :domain => domain) }
105
96
  let(:client) { fake_client :routes => [route] }
106
- let(:given) { { :url => url } }
107
- let(:inputs) { { :delete => true } }
97
+
98
+ subject { vmc %W[unmap #{url} --delete] }
108
99
 
109
100
  it "deletes the route" do
110
101
  mock(route).delete!
@@ -113,11 +104,18 @@ describe VMC::Route::Unmap do
113
104
  end
114
105
 
115
106
  context "when the --delete and --all options are both passed" do
116
- let(:inputs) { { :delete => true, :all => true } }
117
107
  let(:other_route) { fake(:route, :host => "abcd", :domain => domain) }
118
108
  let(:route) { fake(:route, :host => "efgh", :domain => domain) }
119
109
  let(:client) { fake_client :routes => [route, other_route] }
120
110
 
111
+ subject { vmc %W[unmap --delete --all] }
112
+
113
+ before do
114
+ any_instance_of(route.class) do |route|
115
+ stub(route).delete!
116
+ end
117
+ end
118
+
121
119
  it "asks if the user really wants to unmap all urls" do
122
120
  mock_ask("Really delete ALL URLS?", :default => false) { false }
123
121
  subject
@@ -147,10 +145,12 @@ describe VMC::Route::Unmap do
147
145
  context "when only a url is passed" do
148
146
  let(:route) { fake(:route, :host => host_name, :domain => domain) }
149
147
  let(:client) { fake_client :routes => [route] }
150
- let(:given) { { :url => url } }
148
+
149
+ subject { vmc %W[unmap #{url}] }
151
150
 
152
151
  it "displays an error message" do
153
- expect { subject }.to raise_error(VMC::UserError, /Missing either --delete or --app/)
152
+ subject
153
+ expect(error_output).to say("Missing either --delete or --app.")
154
154
  end
155
155
  end
156
156
  end
@@ -160,15 +160,20 @@ describe VMC::Route::Unmap do
160
160
  let(:app) { CFoundry::V1::App.new("some-app", client) }
161
161
  let(:other_url) { "some.other.url.com" }
162
162
 
163
+ before do
164
+ stub(client).apps { app }
165
+ stub(client).app_by_name(app.name) { app }
166
+ end
167
+
163
168
  context "when an app and a url are specified" do
164
- let(:given) { { :url => url } }
165
- let(:inputs) { { :app => app } }
169
+ subject { vmc %W[unmap #{url} #{app.name}] }
166
170
 
167
171
  context "when the given url is not mapped to the app" do
168
172
  before { app.urls = [other_url] }
169
173
 
170
174
  it "displays an error message" do
171
- expect { subject }.to raise_error(VMC::UserError, /URL.*not mapped/)
175
+ subject
176
+ expect(error_output).to say(/URL .* not mapped/)
172
177
  end
173
178
  end
174
179
 
@@ -184,7 +189,8 @@ describe VMC::Route::Unmap do
184
189
  end
185
190
 
186
191
  context "when only an app is specified" do
187
- let(:inputs) { { :app => app } }
192
+ subject { vmc %W[unmap --app #{app.name}] }
193
+
188
194
  before { app.urls = [url, other_url] }
189
195
 
190
196
  it "asks for the url" do
@@ -202,7 +208,7 @@ describe VMC::Route::Unmap do
202
208
  end
203
209
 
204
210
  context "when an app is specified and the --all option is given" do
205
- let(:inputs) { { :app => app, :all => true } }
211
+ subject { vmc %W[unmap --all --app #{app.name}] }
206
212
 
207
213
  it "unmaps all routes from the given app" do
208
214
  app.urls = ["foo", "bar"]
@@ -212,4 +218,4 @@ describe VMC::Route::Unmap do
212
218
  end
213
219
  end
214
220
  end
215
- end
221
+ end
@@ -1,14 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe VMC::Start::Login do
3
+ command VMC::Start::Login do
4
4
  let(:client) { fake_client :organizations => [] }
5
5
 
6
- before do
7
- any_instance_of described_class do |cli|
8
- stub(cli).client { client }
9
- end
10
- end
11
-
12
6
  describe 'metadata' do
13
7
  let(:command) { Mothership.commands[:login] }
14
8
 
@@ -38,7 +32,7 @@ describe VMC::Start::Login do
38
32
  end
39
33
 
40
34
  describe "running the command" do
41
- stub_home_dir_with("new")
35
+ stub_home_dir_with { "#{SPEC_ROOT}/fixtures/fake_home_dirs/new" }
42
36
 
43
37
  let(:auth_token) { CFoundry::AuthToken.new("bearer some-new-access-token", "some-new-refresh-token") }
44
38
  let(:tokens_yaml) { YAML.load_file(File.expand_path(tokens_file_path)) }
@@ -46,19 +40,16 @@ describe VMC::Start::Login do
46
40
  let(:organizations) { [] }
47
41
 
48
42
  before do
49
- any_instance_of(CFoundry::V2::Client) do |client|
50
- stub(client).login("my-username", "my-password") { auth_token }
51
- stub(client).login_prompts do
52
- {
53
- :username => ["text", "Username"],
54
- :password => ["password", "8-digit PIN"]
55
- }
56
- end
57
- stub(client).organizations { [] }
43
+ stub(client).login("my-username", "my-password") { auth_token }
44
+ stub(client).login_prompts do
45
+ {
46
+ :username => ["text", "Username"],
47
+ :password => ["password", "8-digit PIN"]
48
+ }
58
49
  end
59
50
  end
60
51
 
61
- subject { vmc ["login", "--no-force"] }
52
+ subject { vmc ["login"] }
62
53
 
63
54
  it "logs in with the provided credentials and saves the token data to the YAML file" do
64
55
  stub_ask("Username", {}) { "my-username" }
@@ -72,7 +63,7 @@ describe VMC::Start::Login do
72
63
 
73
64
  context "with space and org in the token file" do
74
65
  before do
75
- write_token_file({:space => "space-id-1", :organization => "organization-id-1"})
66
+ write_token_file(:space => "space-id-1", :organization => "organization-id-1")
76
67
  stub_ask("Username", {}) { "my-username" }
77
68
  stub_ask("8-digit PIN", {:echo => "*", :forget => true}) { "my-password" }
78
69
  end
@@ -87,21 +78,12 @@ describe VMC::Start::Login do
87
78
  end
88
79
 
89
80
  context "when the user has an organization, but no spaces" do
90
- before do
91
- stub.proxy(client).organization { organization }
92
- any_instance_of(described_class) do |instance|
93
- stub(instance).client { client }
94
- end
95
- end
96
-
97
- let(:client) { fake_client :organizations => organizations,
98
- :token => CFoundry::AuthToken.new("bearer some-access-token") }
99
- let(:organization) { OpenStruct.new(:name => 'My Org', :guid => 'organization-id-1', :users => [user]) }
100
- let(:user) { stub }
101
-
102
- before do
103
- stub(organization).spaces { [] }
104
- end
81
+ let(:client) {
82
+ fake_client :organizations => organizations,
83
+ :token => CFoundry::AuthToken.new("bearer some-access-token")
84
+ }
85
+ let(:organization) { fake :organization, :users => [user] }
86
+ let(:user) { fake :user }
105
87
 
106
88
  shared_examples_for :method_clearing_the_token_file do
107
89
  it "sets the new organization in the token file" do
@@ -149,9 +131,12 @@ describe VMC::Start::Login do
149
131
 
150
132
  context 'when there is no target' do
151
133
  let(:client) { nil }
152
- it_behaves_like "an error that gets passed through",
153
- :with_exception => VMC::UserError,
154
- :with_message => "Please select a target with 'vmc target'."
134
+ let(:stub_precondition?) { false }
135
+
136
+ it "tells the user to select a target" do
137
+ subject
138
+ expect(error_output).to say("Please select a target with 'vmc target'.")
139
+ end
155
140
  end
156
141
  end
157
142
  end
@@ -1,6 +1,10 @@
1
1
  require 'spec_helper'
2
+ require "webmock/rspec"
3
+
4
+ command VMC::Start::Target do
5
+ let(:client) { fake_client :apps => [app] }
6
+ let(:app) { fake :app }
2
7
 
3
- describe VMC::Start::Target do
4
8
  describe 'metadata' do
5
9
  let(:command) { Mothership.commands[:target] }
6
10
 
@@ -29,7 +33,7 @@ describe VMC::Start::Target do
29
33
  end
30
34
 
31
35
  describe 'running the command' do
32
- stub_home_dir_with("new")
36
+ stub_home_dir_with { "#{SPEC_ROOT}/fixtures/fake_home_dirs/new" }
33
37
 
34
38
  context "when the user is authenticated and has an organization" do
35
39
  let(:tokens_file_path) { '~/.vmc/tokens.yml' }
@@ -71,15 +75,37 @@ describe VMC::Start::Target do
71
75
  subject
72
76
  end
73
77
  end
78
+
79
+ context "when the target is valid but the connection is refused" do
80
+ it "shows a pretty error message" do
81
+ any_instance_of(CFoundry::Client) do |cli|
82
+ stub(cli).info { raise CFoundry::TargetRefused, "foo" }
83
+ end
84
+
85
+ subject
86
+ expect(error_output).to say("Target refused connection.")
87
+ end
88
+ end
89
+
90
+ context "when the uri is malformed" do
91
+ it "shows a pretty error message" do
92
+ any_instance_of(CFoundry::Client) do |cli|
93
+ stub(cli).info { raise CFoundry::InvalidTarget.new(target) }
94
+ end
95
+
96
+ subject
97
+ expect(error_output).to say("Invalid target URI.")
98
+ end
99
+ end
74
100
  end
75
101
 
76
102
  describe "switching the space" do
77
- let(:space_name) { spaces.last.name }
103
+ let(:space) { spaces.last }
78
104
  let(:tokens_yaml) { YAML.load_file(File.expand_path(tokens_file_path)) }
79
105
  let(:tokens_file_path) { '~/.vmc/tokens.yml' }
80
106
 
81
107
  def run_command
82
- vmc ["target", "-s", space_name]
108
+ vmc %W[target -s #{space.name}]
83
109
  end
84
110
 
85
111
  it "should not reprompt for organization" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe VMC::User::Register do
3
+ command VMC::User::Register do
4
4
  describe 'metadata' do
5
5
  let(:command) { Mothership.commands[:register] }
6
6
 
@@ -32,10 +32,6 @@ describe VMC::User::Register do
32
32
  let(:score) { :strong }
33
33
 
34
34
  before do
35
- any_instance_of described_class do |cli|
36
- stub(cli).client { client }
37
- stub(cli).precondition { nil }
38
- end
39
35
  stub(client).register
40
36
  stub(client).base.stub!.password_score(password) { score }
41
37
  end
@@ -49,19 +45,17 @@ describe VMC::User::Register do
49
45
 
50
46
  it 'fails' do
51
47
  subject
52
- expect(stderr.string).to include "Passwords do not match."
48
+ expect(error_output).to say("Passwords do not match.")
53
49
  end
54
50
 
55
51
  it "doesn't print out the score" do
56
52
  subject
57
- expect(stdout.string).not_to include "strength"
53
+ expect(output).to_not say("strength")
58
54
  end
59
55
 
60
56
  it "doesn't log in or register" do
61
57
  dont_allow(client).register
62
- any_instance_of(described_class) do |register|
63
- dont_allow(register).invoke
64
- end
58
+ dont_allow_invoke
65
59
  subject
66
60
  end
67
61
 
@@ -71,7 +65,7 @@ describe VMC::User::Register do
71
65
  it "doesn't verify the password" do
72
66
  mock(client).register(email, password)
73
67
  subject
74
- expect(stderr.string).not_to include "Passwords do not match."
68
+ expect(error_output).to_not say("Passwords do not match.")
75
69
  end
76
70
  end
77
71
  end
@@ -118,7 +112,7 @@ describe VMC::User::Register do
118
112
 
119
113
  it 'prints out the password score' do
120
114
  subject
121
- expect(stderr.string).to include "Your password strength is: weak"
115
+ expect(error_output).to say("Your password strength is: weak")
122
116
  end
123
117
 
124
118
  it "doesn't register" do
@@ -127,9 +121,7 @@ describe VMC::User::Register do
127
121
  end
128
122
 
129
123
  it "doesn't log in" do
130
- any_instance_of(described_class) do |register|
131
- dont_allow(register).invoke(:login, :username => email, :password => password)
132
- end
124
+ dont_allow_invoke :login
133
125
  subject
134
126
  end
135
127
  end