http_stub 0.13.5 → 0.14.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http_stub.rb +13 -4
- data/lib/http_stub/configurer.rb +9 -63
- data/lib/http_stub/configurer/deprecated_dsl.rb +57 -0
- data/lib/http_stub/configurer/request/stub.rb +7 -13
- data/lib/http_stub/configurer/request/stub_activator.rb +8 -4
- data/lib/http_stub/configurer/request/stub_activator_payload_builder.rb +25 -0
- data/lib/http_stub/configurer/request/stub_payload_builder.rb +44 -0
- data/lib/http_stub/configurer/server/buffered_command_processor.rb +24 -0
- data/lib/http_stub/configurer/server/command.rb +18 -0
- data/lib/http_stub/configurer/server/command_processor.rb +38 -0
- data/lib/http_stub/configurer/server/dsl.rb +56 -0
- data/lib/http_stub/configurer/server/facade.rb +57 -0
- data/lib/http_stub/configurer/server/request_processor.rb +30 -0
- data/lib/http_stub/models/registry.rb +4 -0
- data/lib/http_stub/models/stub.rb +2 -1
- data/lib/http_stub/models/stub_registry.rb +29 -0
- data/lib/http_stub/models/stub_triggers.rb +23 -0
- data/lib/http_stub/rake/server_tasks.rb +2 -5
- data/lib/http_stub/server.rb +14 -4
- data/lib/http_stub/version.rb +1 -1
- data/lib/http_stub/views/_stub.haml +7 -0
- data/spec/lib/http_stub/configurer/deprecated_dsl_spec.rb +232 -0
- data/spec/lib/http_stub/configurer/request/controllable_value_spec.rb +8 -8
- data/spec/lib/http_stub/configurer/request/omittable_spec.rb +8 -8
- data/spec/lib/http_stub/configurer/request/regexpable_spec.rb +14 -14
- data/spec/lib/http_stub/configurer/request/stub_activator_payload_builder_spec.rb +74 -0
- data/spec/lib/http_stub/configurer/request/stub_activator_spec.rb +19 -26
- data/spec/lib/http_stub/configurer/request/stub_payload_builder_spec.rb +203 -0
- data/spec/lib/http_stub/configurer/request/stub_spec.rb +18 -157
- data/spec/lib/http_stub/configurer/server/buffered_command_processor_spec.rb +35 -0
- data/spec/lib/http_stub/configurer/server/command_processor_integration_spec.rb +62 -0
- data/spec/lib/http_stub/configurer/server/command_spec.rb +25 -0
- data/spec/lib/http_stub/configurer/server/dsl_spec.rb +241 -0
- data/spec/lib/http_stub/configurer/server/facade_spec.rb +253 -0
- data/spec/lib/http_stub/configurer/server/request_processor_spec.rb +99 -0
- data/spec/lib/http_stub/configurer_integration_spec.rb +172 -122
- data/spec/lib/http_stub/configurer_spec.rb +4 -4
- data/spec/lib/http_stub/controllers/stub_activator_controller_spec.rb +25 -25
- data/spec/lib/http_stub/controllers/stub_controller_spec.rb +22 -22
- data/spec/lib/http_stub/hash_extensions_spec.rb +24 -24
- data/spec/lib/http_stub/models/exact_value_matcher_spec.rb +4 -4
- data/spec/lib/http_stub/models/hash_with_string_value_matchers_spec.rb +29 -29
- data/spec/lib/http_stub/models/headers_spec.rb +10 -10
- data/spec/lib/http_stub/models/omitted_value_matcher_spec.rb +8 -8
- data/spec/lib/http_stub/models/regexp_value_matcher_spec.rb +6 -6
- data/spec/lib/http_stub/models/registry_spec.rb +71 -28
- data/spec/lib/http_stub/models/request_header_parser_spec.rb +4 -4
- data/spec/lib/http_stub/models/request_pipeline_spec.rb +2 -2
- data/spec/lib/http_stub/models/response_spec.rb +38 -38
- data/spec/lib/http_stub/models/string_value_matcher_spec.rb +25 -25
- data/spec/lib/http_stub/models/stub_activator_spec.rb +15 -15
- data/spec/lib/http_stub/models/stub_headers_spec.rb +18 -18
- data/spec/lib/http_stub/models/stub_parameters_spec.rb +16 -16
- data/spec/lib/http_stub/models/stub_registry_integration_spec.rb +62 -0
- data/spec/lib/http_stub/models/stub_registry_spec.rb +152 -0
- data/spec/lib/http_stub/models/stub_spec.rb +67 -43
- data/spec/lib/http_stub/models/stub_triggers_spec.rb +64 -0
- data/spec/lib/http_stub/models/stub_uri_spec.rb +9 -9
- data/spec/lib/http_stub/rake/server_daemon_tasks_smoke_spec.rb +7 -7
- data/spec/lib/http_stub/rake/server_tasks_smoke_spec.rb +5 -5
- data/spec/lib/http_stub/rake/server_tasks_spec.rb +17 -15
- data/spec/lib/http_stub/server_daemon_spec.rb +16 -16
- data/spec/lib/http_stub/server_integration_spec.rb +112 -65
- data/spec/lib/http_stub/server_spec.rb +134 -96
- data/spec/spec_helper.rb +1 -1
- data/spec/support/http_stub/configurer/request/stub_payload_builder_shared_context.rb +27 -0
- data/spec/support/server_integration.rb +2 -2
- metadata +69 -30
- data/lib/http_stub/configurer/command.rb +0 -26
- data/lib/http_stub/configurer/command_processor.rb +0 -36
- data/lib/http_stub/configurer/impatient_command_chain.rb +0 -13
- data/lib/http_stub/configurer/patient_command_chain.rb +0 -25
- data/spec/lib/http_stub/configurer/command_processor_integration_spec.rb +0 -63
- data/spec/lib/http_stub/configurer/command_spec.rb +0 -40
- data/spec/lib/http_stub/configurer/impatient_command_chain_spec.rb +0 -17
- data/spec/lib/http_stub/configurer/patient_command_chain_spec.rb +0 -73
@@ -15,28 +15,43 @@ describe HttpStub::Models::Stub do
|
|
15
15
|
}
|
16
16
|
end
|
17
17
|
let(:stub_method) { "get" }
|
18
|
+
let(:stub_trigger) do
|
19
|
+
{
|
20
|
+
"uri" => "/a_triggered_path",
|
21
|
+
"method" => "post",
|
22
|
+
"headers" => { "triggered_header" => "triggered_header_value" },
|
23
|
+
"parameters" => { "triggered_parameter" => "triggered_parameter_value" },
|
24
|
+
"response" => {
|
25
|
+
"status" => 203,
|
26
|
+
"body" => "Triggered body"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
18
30
|
let(:stub_args) do
|
19
31
|
{
|
20
|
-
"uri" =>
|
21
|
-
"method" =>
|
22
|
-
"headers" =>
|
32
|
+
"uri" => "/a_path",
|
33
|
+
"method" => stub_method,
|
34
|
+
"headers" => raw_stub_headers,
|
23
35
|
"parameters" => raw_stub_parameters,
|
24
36
|
"response" => {
|
25
37
|
"status" => 201,
|
26
|
-
"body" => "
|
27
|
-
}
|
38
|
+
"body" => "Some body"
|
39
|
+
},
|
40
|
+
"triggers" => [ stub_trigger ]
|
28
41
|
}
|
29
42
|
end
|
30
|
-
let(:stub_uri)
|
31
|
-
let(:
|
32
|
-
let(:
|
43
|
+
let(:stub_uri) { instance_double(HttpStub::Models::StubUri, match?: true) }
|
44
|
+
let(:stub_headers) { instance_double(HttpStub::Models::StubHeaders, match?: true) }
|
45
|
+
let(:stub_parameters) { instance_double(HttpStub::Models::StubParameters, match?: true) }
|
46
|
+
let(:stub_triggers) { instance_double(HttpStub::Models::StubTriggers) }
|
33
47
|
|
34
48
|
let(:the_stub) { HttpStub::Models::Stub.new(stub_args) }
|
35
49
|
|
36
|
-
before(:
|
37
|
-
HttpStub::Models::StubUri.
|
38
|
-
HttpStub::Models::
|
39
|
-
HttpStub::Models::
|
50
|
+
before(:example) do
|
51
|
+
allow(HttpStub::Models::StubUri).to receive(:new).and_return(stub_uri)
|
52
|
+
allow(HttpStub::Models::StubHeaders).to receive(:new).and_return(stub_headers)
|
53
|
+
allow(HttpStub::Models::StubParameters).to receive(:new).and_return(stub_parameters)
|
54
|
+
allow(HttpStub::Models::StubTriggers).to receive(:new).and_return(stub_triggers)
|
40
55
|
end
|
41
56
|
|
42
57
|
describe "#satisfies?" do
|
@@ -47,7 +62,7 @@ describe HttpStub::Models::Stub do
|
|
47
62
|
|
48
63
|
describe "when the request uri matches" do
|
49
64
|
|
50
|
-
before(:
|
65
|
+
before(:example) { allow(stub_uri).to receive(:match?).with(request).and_return(true) }
|
51
66
|
|
52
67
|
describe "and the request method matches" do
|
53
68
|
|
@@ -55,16 +70,16 @@ describe HttpStub::Models::Stub do
|
|
55
70
|
|
56
71
|
describe "that matches" do
|
57
72
|
|
58
|
-
before(:
|
73
|
+
before(:example) { allow(stub_headers).to receive(:match?).with(request).and_return(true) }
|
59
74
|
|
60
75
|
describe "and a parameter match is configured" do
|
61
76
|
|
62
77
|
describe "that matches" do
|
63
78
|
|
64
|
-
before(:
|
79
|
+
before(:example) { allow(stub_parameters).to receive(:match?).with(request).and_return(true) }
|
65
80
|
|
66
|
-
it "
|
67
|
-
the_stub.satisfies?(request).
|
81
|
+
it "returns true" do
|
82
|
+
expect(the_stub.satisfies?(request)).to be_truthy
|
68
83
|
end
|
69
84
|
|
70
85
|
end
|
@@ -81,10 +96,10 @@ describe HttpStub::Models::Stub do
|
|
81
96
|
|
82
97
|
describe "when the request uri does not match" do
|
83
98
|
|
84
|
-
before(:
|
99
|
+
before(:example) { allow(stub_uri).to receive(:match?).with(request).and_return(false) }
|
85
100
|
|
86
|
-
it "
|
87
|
-
the_stub.satisfies?(request).
|
101
|
+
it "returns false" do
|
102
|
+
expect(the_stub.satisfies?(request)).to be_falsey
|
88
103
|
end
|
89
104
|
|
90
105
|
end
|
@@ -93,28 +108,28 @@ describe HttpStub::Models::Stub do
|
|
93
108
|
|
94
109
|
let(:request_method) { "post" }
|
95
110
|
|
96
|
-
it "
|
97
|
-
the_stub.satisfies?(request).
|
111
|
+
it "returns false" do
|
112
|
+
expect(the_stub.satisfies?(request)).to be_falsey
|
98
113
|
end
|
99
114
|
|
100
115
|
end
|
101
116
|
|
102
117
|
describe "when the headers do not match" do
|
103
118
|
|
104
|
-
before(:
|
119
|
+
before(:example) { allow(stub_headers).to receive(:match?).with(request).and_return(false) }
|
105
120
|
|
106
|
-
it "
|
107
|
-
the_stub.satisfies?(request).
|
121
|
+
it "returns false" do
|
122
|
+
expect(the_stub.satisfies?(request)).to be_falsey
|
108
123
|
end
|
109
124
|
|
110
125
|
end
|
111
126
|
|
112
127
|
describe "when the parameters do not match" do
|
113
128
|
|
114
|
-
before(:
|
129
|
+
before(:example) { allow(stub_parameters).to receive(:match?).with(request).and_return(false) }
|
115
130
|
|
116
|
-
it "
|
117
|
-
the_stub.satisfies?(request).
|
131
|
+
it "returns false" do
|
132
|
+
expect(the_stub.satisfies?(request)).to be_falsey
|
118
133
|
end
|
119
134
|
|
120
135
|
end
|
@@ -123,55 +138,64 @@ describe HttpStub::Models::Stub do
|
|
123
138
|
|
124
139
|
describe "#uri" do
|
125
140
|
|
126
|
-
it "
|
127
|
-
the_stub.uri.
|
141
|
+
it "returns the parameters model encapsulating the uri provided in the request body" do
|
142
|
+
expect(the_stub.uri).to eql(stub_uri)
|
128
143
|
end
|
129
144
|
|
130
145
|
end
|
131
146
|
|
132
147
|
describe "#method" do
|
133
148
|
|
134
|
-
it "
|
135
|
-
the_stub.method.
|
149
|
+
it "returns the value provided in the request body" do
|
150
|
+
expect(the_stub.method).to eql(stub_method)
|
136
151
|
end
|
137
152
|
|
138
153
|
end
|
139
154
|
|
140
155
|
describe "#headers" do
|
141
156
|
|
142
|
-
it "
|
143
|
-
the_stub.headers.
|
157
|
+
it "returns the headers model encapsulating the headers provided in the request body" do
|
158
|
+
expect(the_stub.headers).to eql(stub_headers)
|
144
159
|
end
|
145
160
|
|
146
161
|
end
|
147
162
|
|
148
163
|
describe "#parameters" do
|
149
164
|
|
150
|
-
it "
|
151
|
-
the_stub.parameters.
|
165
|
+
it "returns the parameters model encapsulating the parameters provided in the request body" do
|
166
|
+
expect(the_stub.parameters).to eql(stub_parameters)
|
152
167
|
end
|
153
168
|
|
154
169
|
end
|
155
170
|
|
156
171
|
describe "#response" do
|
157
172
|
|
158
|
-
it "
|
159
|
-
the_stub.response.status.
|
173
|
+
it "exposes the provided response status" do
|
174
|
+
expect(the_stub.response.status).to eql(201)
|
160
175
|
end
|
161
176
|
|
162
|
-
it "
|
163
|
-
the_stub.response.body.
|
177
|
+
it "exposes the provided response body" do
|
178
|
+
expect(the_stub.response.body).to eql("Some body")
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
describe "#triggers" do
|
184
|
+
|
185
|
+
it "returns the triggers model encapsulating the triggers provided in the request body" do
|
186
|
+
expect(the_stub.triggers).to eql(stub_triggers)
|
164
187
|
end
|
165
188
|
|
166
189
|
end
|
167
190
|
|
168
191
|
describe "#to_s" do
|
169
192
|
|
170
|
-
it "
|
171
|
-
stub_args.
|
193
|
+
it "returns a string representation of the stub arguments" do
|
194
|
+
expect(stub_args).to receive(:to_s).and_return("stub arguments string")
|
172
195
|
|
173
|
-
the_stub.to_s.
|
196
|
+
expect(the_stub.to_s).to eql("stub arguments string")
|
174
197
|
end
|
198
|
+
|
175
199
|
end
|
176
200
|
|
177
201
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
describe HttpStub::Models::StubTriggers do
|
2
|
+
|
3
|
+
let(:trigger_bodies) { (1..3).map { |i| "trigger body #{i}" } }
|
4
|
+
let(:stubs_for_triggers) { (1..trigger_bodies.length).map { instance_double(HttpStub::Models::Stub) } }
|
5
|
+
let(:stub_triggers) { HttpStub::Models::StubTriggers.new(trigger_bodies) }
|
6
|
+
|
7
|
+
before(:example) do
|
8
|
+
allow(HttpStub::Models::Stub).to receive(:new).and_return(*stubs_for_triggers)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "constructor" do
|
12
|
+
|
13
|
+
it "creates a stub for each provided trigger" do
|
14
|
+
trigger_bodies.zip(stubs_for_triggers).each do |body, stub|
|
15
|
+
expect(HttpStub::Models::Stub).to receive(:new).with(body).and_return(stub)
|
16
|
+
end
|
17
|
+
|
18
|
+
stub_triggers
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#add_to" do
|
24
|
+
|
25
|
+
let(:registry) { instance_double(HttpStub::Models::StubRegistry) }
|
26
|
+
let(:request) { instance_double("HttpRequest") }
|
27
|
+
|
28
|
+
it "adds each stub to the provided registry" do
|
29
|
+
stubs_for_triggers.each { |stub_for_trigger| expect(registry).to receive(:add).with(stub_for_trigger, request) }
|
30
|
+
|
31
|
+
stub_triggers.add_to(registry, request)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#to_s" do
|
37
|
+
|
38
|
+
let(:trigger_strings) { (1..stubs_for_triggers.length).map { |i| "trigger string ##{i}" } }
|
39
|
+
|
40
|
+
before(:example) do
|
41
|
+
stubs_for_triggers.zip(trigger_strings).each do |stub_for_trigger, string|
|
42
|
+
allow(stub_for_trigger).to receive(:to_s).and_return(string)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should contain a string representation of each trigger" do
|
47
|
+
result = stub_triggers.to_s
|
48
|
+
|
49
|
+
trigger_strings.each { |trigger_string| expect(result).to include(trigger_string) }
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#each" do
|
55
|
+
|
56
|
+
it "yields to the stubs for each trigger" do
|
57
|
+
yielded_stubs = stub_triggers.each.map.to_a
|
58
|
+
|
59
|
+
expect(yielded_stubs).to eql(stubs_for_triggers)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -5,12 +5,12 @@ describe HttpStub::Models::StubUri do
|
|
5
5
|
let(:value_matcher) { double(HttpStub::Models::StringValueMatcher).as_null_object }
|
6
6
|
let(:stub_uri) { HttpStub::Models::StubUri.new(stubbed_uri) }
|
7
7
|
|
8
|
-
before(:
|
8
|
+
before(:example) { allow(HttpStub::Models::StringValueMatcher).to receive(:new).and_return(value_matcher) }
|
9
9
|
|
10
10
|
describe "constructor" do
|
11
11
|
|
12
|
-
it "
|
13
|
-
HttpStub::Models::StringValueMatcher.
|
12
|
+
it "creates a value matcher for the provided uri" do
|
13
|
+
expect(HttpStub::Models::StringValueMatcher).to receive(:new).with(stubbed_uri)
|
14
14
|
|
15
15
|
stub_uri
|
16
16
|
end
|
@@ -21,20 +21,20 @@ describe HttpStub::Models::StubUri do
|
|
21
21
|
|
22
22
|
let(:request_uri) { "/some/uri" }
|
23
23
|
|
24
|
-
it "
|
25
|
-
value_matcher.
|
24
|
+
it "delegates to the value matcher representation of the provided uri" do
|
25
|
+
expect(value_matcher).to receive(:match?).with(request_uri).and_return(true)
|
26
26
|
|
27
|
-
stub_uri.match?(request).
|
27
|
+
expect(stub_uri.match?(request)).to be_truthy
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#to_s" do
|
33
33
|
|
34
|
-
it "
|
35
|
-
value_matcher.
|
34
|
+
it "delegates to the value matcher representation of the provided uri" do
|
35
|
+
expect(value_matcher).to receive(:to_s).and_return("some value matcher string")
|
36
36
|
|
37
|
-
stub_uri.to_s.
|
37
|
+
expect(stub_uri.to_s).to eql("some value matcher string")
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
@@ -1,27 +1,27 @@
|
|
1
1
|
describe HttpStub::Rake::ServerDaemonTasks do
|
2
2
|
include Rake::DSL
|
3
3
|
|
4
|
-
before(:
|
4
|
+
before(:context) { HttpStub::Rake::ServerDaemonTasks.new(name: :example_server_daemon, port: 8002) }
|
5
5
|
|
6
6
|
describe "start task" do
|
7
7
|
|
8
8
|
context "when invoked" do
|
9
9
|
|
10
|
-
before(:
|
10
|
+
before(:context) { @exit_flag = Rake::Task["example_server_daemon:start"].invoke("--trace") }
|
11
11
|
|
12
|
-
after(:
|
12
|
+
after(:context) { Rake::Task["example_server_daemon:stop"].invoke("--trace") }
|
13
13
|
|
14
|
-
it "
|
15
|
-
@exit_flag.
|
14
|
+
it "exits with a status code of 0" do
|
15
|
+
expect(@exit_flag).to be_truthy
|
16
16
|
end
|
17
17
|
|
18
|
-
it "
|
18
|
+
it "starts a stub server that responds to stub requests" do
|
19
19
|
request = Net::HTTP::Post.new("/stubs")
|
20
20
|
request.body = { "response" => { "status" => 302, "body" => "Some Body" } }.to_json
|
21
21
|
|
22
22
|
response = Net::HTTP.new("localhost", 8002).start { |http| http.request(request) }
|
23
23
|
|
24
|
-
response.code.
|
24
|
+
expect(response.code).to eql("200")
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
describe HttpStub::Rake::ServerTasks do
|
2
2
|
include Rake::DSL
|
3
3
|
|
4
|
-
before(:
|
4
|
+
before(:context) { HttpStub::Rake::ServerTasks.new(name: :test_server, port: 8003) }
|
5
5
|
|
6
6
|
describe "start task" do
|
7
7
|
|
8
8
|
context "when invoked" do
|
9
9
|
|
10
|
-
before(:
|
10
|
+
before(:context) do
|
11
11
|
@server_thread = Thread.new { Rake::Task["test_server:start:foreground"].invoke("--trace") }
|
12
12
|
::Wait.until!("http stub server started") { Net::HTTP.get_response("localhost", "/", 8003) }
|
13
13
|
end
|
14
14
|
|
15
|
-
after(:
|
15
|
+
after(:context) { @server_thread.kill }
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "starts a stub server that responds to stub requests" do
|
18
18
|
request = Net::HTTP::Post.new("/stubs")
|
19
19
|
request.body = { "response" => { "status" => 302, "body" => "Some Body" } }.to_json
|
20
20
|
|
21
21
|
response = Net::HTTP.new("localhost", 8003).start { |http| http.request(request) }
|
22
22
|
|
23
|
-
response.code.
|
23
|
+
expect(response.code).to eql("200")
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
@@ -1,28 +1,33 @@
|
|
1
1
|
describe HttpStub::Rake::ServerTasks do
|
2
2
|
|
3
|
-
|
3
|
+
class HttpStub::Rake::ServerTasksTestCounter
|
4
|
+
|
5
|
+
def self.next
|
6
|
+
@counter ||= 0
|
7
|
+
@counter += 1
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:server_name) { "server_tasks_test_#{HttpStub::Rake::ServerTasksTestCounter.next}".to_sym }
|
13
|
+
let(:default_args) { { port: 8001, name: server_name } }
|
14
|
+
let(:args) { {} }
|
4
15
|
let(:configurer) { double(HttpStub::Configurer).as_null_object }
|
5
16
|
|
6
|
-
before(:
|
17
|
+
before(:example) { HttpStub::Rake::ServerTasks.new(default_args.merge(args)) }
|
7
18
|
|
8
19
|
describe "the configure task" do
|
9
20
|
|
10
21
|
context "when a configurer is provided" do
|
11
22
|
|
12
|
-
let(:args) { {
|
23
|
+
let(:args) { { configurer: configurer } }
|
13
24
|
|
14
25
|
context "and the task is executed" do
|
15
26
|
|
16
27
|
it "initializes the provided configurer" do
|
17
|
-
configurer.
|
28
|
+
expect(configurer).to receive(:initialize!)
|
18
29
|
|
19
|
-
Rake::Task["
|
20
|
-
end
|
21
|
-
|
22
|
-
it "resets the provided configurer to ensure stubs are in their initial state" do
|
23
|
-
configurer.should_receive(:reset!)
|
24
|
-
|
25
|
-
Rake::Task["configure_task_configurer_provided_test:configure"].execute
|
30
|
+
Rake::Task["#{server_name}:configure"].execute
|
26
31
|
end
|
27
32
|
|
28
33
|
end
|
@@ -31,11 +36,8 @@ describe HttpStub::Rake::ServerTasks do
|
|
31
36
|
|
32
37
|
context "when a configurer is not provided" do
|
33
38
|
|
34
|
-
let(:args) { { name: :configure_task_configurer_not_provided_test } }
|
35
|
-
|
36
39
|
it "does not generate a task" do
|
37
|
-
|
38
|
-
raise_error(/Don't know how to build task/)
|
40
|
+
expect { Rake::Task["#{server_name}:configure"] }.to raise_error(/Don't know how to build task/)
|
39
41
|
end
|
40
42
|
|
41
43
|
end
|