webspicy 0.16.1 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -5
- data/bin/webspicy +6 -1
- data/doc/1-black-box-scene.md +109 -0
- data/doc/2-black-box-testing.md +27 -0
- data/doc/3-specification-importance.md +41 -0
- data/doc/4-sequence-diagram.md +82 -0
- data/lib/webspicy.rb +15 -4
- data/lib/webspicy/configuration.rb +57 -8
- data/lib/webspicy/configuration/scope.rb +22 -16
- data/lib/webspicy/formaldoc.fio +3 -1
- data/lib/webspicy/specification.rb +12 -10
- data/lib/webspicy/specification/condition.rb +23 -0
- data/lib/webspicy/specification/errcondition.rb +17 -0
- data/lib/webspicy/specification/postcondition.rb +1 -0
- data/lib/webspicy/specification/precondition.rb +1 -0
- data/lib/webspicy/specification/precondition/robust_to_invalid_input.rb +1 -1
- data/lib/webspicy/specification/service.rb +38 -25
- data/lib/webspicy/specification/test_case.rb +10 -17
- data/lib/webspicy/support.rb +22 -0
- data/lib/webspicy/support/data_object.rb +25 -0
- data/lib/webspicy/support/hooks.rb +65 -0
- data/lib/webspicy/support/world.rb +47 -0
- data/lib/webspicy/tester.rb +120 -61
- data/lib/webspicy/tester/asserter.rb +9 -4
- data/lib/webspicy/tester/assertions.rb +8 -9
- data/lib/webspicy/tester/client.rb +22 -42
- data/lib/webspicy/tester/failure.rb +6 -0
- data/lib/webspicy/tester/file_checker.rb +22 -0
- data/lib/webspicy/tester/invocation.rb +15 -196
- data/lib/webspicy/tester/reporter.rb +85 -0
- data/lib/webspicy/tester/reporter/composite.rb +38 -0
- data/lib/webspicy/tester/reporter/documentation.rb +67 -0
- data/lib/webspicy/tester/reporter/error_count.rb +25 -0
- data/lib/webspicy/tester/reporter/exceptions.rb +60 -0
- data/lib/webspicy/tester/reporter/file_progress.rb +22 -0
- data/lib/webspicy/tester/reporter/file_summary.rb +42 -0
- data/lib/webspicy/tester/reporter/progress.rb +28 -0
- data/lib/webspicy/tester/reporter/summary.rb +62 -0
- data/lib/webspicy/tester/result.rb +139 -0
- data/lib/webspicy/tester/result/assert_met.rb +29 -0
- data/lib/webspicy/tester/result/check.rb +33 -0
- data/lib/webspicy/tester/result/errcondition_met.rb +29 -0
- data/lib/webspicy/tester/result/error_schema_met.rb +24 -0
- data/lib/webspicy/tester/result/output_schema_met.rb +24 -0
- data/lib/webspicy/tester/result/postcondition_met.rb +29 -0
- data/lib/webspicy/tester/result/response_header_met.rb +43 -0
- data/lib/webspicy/tester/result/response_status_met.rb +25 -0
- data/lib/webspicy/version.rb +2 -2
- data/lib/webspicy/web.rb +4 -0
- data/lib/webspicy/web/client.rb +15 -0
- data/lib/webspicy/{tester → web}/client/http_client.rb +34 -14
- data/lib/webspicy/{tester → web}/client/rack_test_client.rb +3 -3
- data/lib/webspicy/{tester → web}/client/support.rb +2 -2
- data/lib/webspicy/web/invocation.rb +65 -0
- data/lib/webspicy/web/mocker.rb +90 -0
- data/lib/webspicy/web/mocker/config.ru +6 -0
- data/lib/webspicy/{openapi.rb → web/openapi.rb} +0 -0
- data/lib/webspicy/web/openapi/generator.rb +129 -0
- data/spec/unit/configuration/scope/test_each_service.rb +2 -2
- data/spec/unit/configuration/scope/test_each_specification.rb +7 -7
- data/spec/unit/specification/test_condition.rb +26 -0
- data/spec/unit/support/hooks/test_fire_after_each.rb +53 -0
- data/spec/unit/{tester/client/test_around.rb → support/hooks/test_fire_around.rb} +15 -10
- data/spec/unit/support/hooks/test_fire_before_each.rb +53 -0
- data/spec/unit/support/world/fixtures/array.json +8 -0
- data/spec/unit/support/world/fixtures/queue.rb +1 -0
- data/spec/unit/support/world/fixtures/single.json +11 -0
- data/spec/unit/support/world/fixtures/yaml.yml +3 -0
- data/spec/unit/support/world/test_world.rb +56 -0
- data/spec/unit/test_configuration.rb +50 -1
- data/spec/unit/tester/test_asserter.rb +198 -3
- data/spec/unit/tester/test_assertions.rb +8 -6
- data/spec/unit/web/mocker/test_mocker.rb +35 -0
- data/spec/unit/web/openapi/test_generator.rb +31 -0
- metadata +72 -61
- data/examples/restful/Gemfile +0 -5
- data/examples/restful/Gemfile.lock +0 -105
- data/examples/restful/Rakefile +0 -25
- data/examples/restful/app.rb +0 -180
- data/examples/restful/webspicy/config.rb +0 -23
- data/examples/restful/webspicy/rack.rb +0 -7
- data/examples/restful/webspicy/real.rb +0 -8
- data/examples/restful/webspicy/schema.fio +0 -20
- data/examples/restful/webspicy/support/must_be_an_admin.rb +0 -20
- data/examples/restful/webspicy/support/must_be_authenticated.rb +0 -48
- data/examples/restful/webspicy/support/todo_removed.rb +0 -18
- data/examples/restful/webspicy/todo/deleteTodo.yml +0 -52
- data/examples/restful/webspicy/todo/getTodo.yml +0 -50
- data/examples/restful/webspicy/todo/getTodoSingleServiceFormat.yml +0 -46
- data/examples/restful/webspicy/todo/getTodos.yml +0 -36
- data/examples/restful/webspicy/todo/options.yml +0 -32
- data/examples/restful/webspicy/todo/patchTodo.yml +0 -66
- data/examples/restful/webspicy/todo/postCsv.yml +0 -43
- data/examples/restful/webspicy/todo/postFile.yml +0 -40
- data/examples/restful/webspicy/todo/postTodos.yml +0 -51
- data/examples/restful/webspicy/todo/putTodo.yml +0 -65
- data/examples/restful/webspicy/todo/todos.csv +0 -4
- data/examples/single_spec/spec.yml +0 -59
- data/examples/website/config.rb +0 -2
- data/examples/website/schema.fio +0 -1
- data/examples/website/specification/get-http.yml +0 -34
- data/examples/website/specification/get-https.yml +0 -34
- data/lib/webspicy/checker.rb +0 -25
- data/lib/webspicy/mocker.rb +0 -88
- data/lib/webspicy/openapi/generator.rb +0 -127
- data/lib/webspicy/tester/rspec_asserter.rb +0 -108
- data/lib/webspicy/tester/rspec_matchers.rb +0 -104
- data/spec/unit/mocker/test_mocker.rb +0 -32
- data/spec/unit/openapi/test_generator.rb +0 -28
@@ -0,0 +1,90 @@
|
|
1
|
+
require "finitio/generation"
|
2
|
+
require "json"
|
3
|
+
module Webspicy
|
4
|
+
module Web
|
5
|
+
class Mocker
|
6
|
+
|
7
|
+
def initialize(config)
|
8
|
+
@config = Configuration.dress(config)
|
9
|
+
@generator = config.generator || Finitio::Generation.new
|
10
|
+
end
|
11
|
+
attr_reader :config, :generator
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
req = Rack::Request.new(env)
|
15
|
+
path = req.path
|
16
|
+
meth = req.request_method
|
17
|
+
if meth == "OPTIONS" && has_service?(path)
|
18
|
+
[204, {}, []]
|
19
|
+
elsif service = find_service(meth, path)
|
20
|
+
status = best_status_code(service)
|
21
|
+
body = status == 204 ? "" : random_body(service, req)
|
22
|
+
headers = generate_headers(service)
|
23
|
+
[ status, headers, [ body ].compact ]
|
24
|
+
else
|
25
|
+
[404, {}, []]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def has_service?(path)
|
32
|
+
config.each_scope do |scope|
|
33
|
+
scope.each_specification do |specification|
|
34
|
+
next unless url_matches?(specification, path)
|
35
|
+
return true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
|
41
|
+
def find_service(method, path)
|
42
|
+
config.each_scope do |scope|
|
43
|
+
scope.each_specification do |specification|
|
44
|
+
next unless url_matches?(specification, path)
|
45
|
+
scope.each_service(specification) do |service|
|
46
|
+
return service if service.method == method
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def generate_headers(service)
|
54
|
+
{
|
55
|
+
"Content-Type" => best_content_type(service)
|
56
|
+
}.delete_if{|k,v| v.nil? }
|
57
|
+
end
|
58
|
+
|
59
|
+
def best_status_code(service)
|
60
|
+
if ex = service.examples.first
|
61
|
+
(ex.expected_status && ex.expected_status.to_i) || 200
|
62
|
+
else
|
63
|
+
200
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def best_content_type(service)
|
68
|
+
if ex = service.examples.first
|
69
|
+
ex.expected_content_type
|
70
|
+
else
|
71
|
+
"application/json"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def url_matches?(specification, path)
|
76
|
+
specification.url_pattern.match(path)
|
77
|
+
end
|
78
|
+
|
79
|
+
def random_body(service, request)
|
80
|
+
world = OpenStruct.new({
|
81
|
+
service: service,
|
82
|
+
request: request
|
83
|
+
})
|
84
|
+
data = generator.call(service.output_schema.main, world)
|
85
|
+
JSON.pretty_generate(data) if data
|
86
|
+
end
|
87
|
+
|
88
|
+
end # class Mocker
|
89
|
+
end # module Web
|
90
|
+
end # module Webspicy
|
File without changes
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require "finitio/generation"
|
2
|
+
require "finitio/json_schema"
|
3
|
+
module Webspicy
|
4
|
+
module Web
|
5
|
+
module Openapi
|
6
|
+
class Generator
|
7
|
+
|
8
|
+
def initialize(config)
|
9
|
+
@config = Configuration.dress(config)
|
10
|
+
@generator = config.generator || Finitio::Generation.new
|
11
|
+
end
|
12
|
+
attr_reader :config, :generator
|
13
|
+
|
14
|
+
def call
|
15
|
+
{
|
16
|
+
openapi: "3.0.2",
|
17
|
+
info: {
|
18
|
+
version: "1.0.0",
|
19
|
+
title: "Hello API"
|
20
|
+
},
|
21
|
+
paths: paths
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def paths
|
28
|
+
config.each_scope.inject({}) do |paths,scope|
|
29
|
+
scope.each_specification.inject(paths) do |paths,specification|
|
30
|
+
paths.merge(path_for(specification)){|k,ps,qs|
|
31
|
+
ps.merge(qs)
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def path_for(specification)
|
38
|
+
{
|
39
|
+
specification.url => {
|
40
|
+
summary: specification.name
|
41
|
+
}.merge(verbs_for(specification))
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def verbs_for(specification)
|
46
|
+
specification.services.inject({}) do |verbs,service|
|
47
|
+
verb = service.method.downcase
|
48
|
+
verb_defn = {
|
49
|
+
description: service.description,
|
50
|
+
responses: responses_for(service)
|
51
|
+
}
|
52
|
+
unless ["get", "options", "delete", "head"].include?(verb)
|
53
|
+
verb_defn[:requestBody] = request_body_for(service)
|
54
|
+
end
|
55
|
+
verbs.merge({ verb => verb_defn })
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def request_body_for(service)
|
60
|
+
schema = actual_input_schema(service)
|
61
|
+
{
|
62
|
+
required: true,
|
63
|
+
content: {
|
64
|
+
"application/json" => {
|
65
|
+
schema: schema.to_json_schema,
|
66
|
+
example: generator.call(schema, {})
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
def responses_for(service)
|
73
|
+
result = {}
|
74
|
+
service.examples.each_with_object(result) do |test_case, rs|
|
75
|
+
rs.merge!(response_for(test_case, false)){|k,r1,r2| r1 }
|
76
|
+
end
|
77
|
+
service.counterexamples.each_with_object(result) do |test_case, rs|
|
78
|
+
rs.merge!(response_for(test_case, true)){|k,r1,r2| r1 }
|
79
|
+
end
|
80
|
+
result
|
81
|
+
end
|
82
|
+
|
83
|
+
def response_for(test_case, counterexample)
|
84
|
+
res = {
|
85
|
+
description: test_case.description,
|
86
|
+
}
|
87
|
+
status = (test_case.expected_status && test_case.expected_status.to_int) || 200
|
88
|
+
if test_case.expected_content_type && status != 204
|
89
|
+
content = {
|
90
|
+
schema: schema_for(test_case, counterexample)
|
91
|
+
}
|
92
|
+
unless counterexample
|
93
|
+
content[:example] = example_for(test_case, counterexample)
|
94
|
+
end
|
95
|
+
res[:content] = {
|
96
|
+
test_case.expected_content_type => content
|
97
|
+
}
|
98
|
+
end
|
99
|
+
{
|
100
|
+
status => res
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
def schema_for(test_case, counterexample)
|
105
|
+
schema = actual_output_schema(test_case, counterexample)
|
106
|
+
schema.to_json_schema
|
107
|
+
end
|
108
|
+
|
109
|
+
def example_for(test_case, counterexample)
|
110
|
+
schema = actual_output_schema(test_case, counterexample)
|
111
|
+
generator.call(schema, {})
|
112
|
+
end
|
113
|
+
|
114
|
+
def actual_output_schema(test_case, counterexample)
|
115
|
+
if counterexample
|
116
|
+
test_case.service.error_schema['Main']
|
117
|
+
else
|
118
|
+
test_case.service.output_schema['Main']
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def actual_input_schema(service)
|
123
|
+
service.input_schema['Main']
|
124
|
+
end
|
125
|
+
|
126
|
+
end # class Generator
|
127
|
+
end # module Openapi
|
128
|
+
end # module Web
|
129
|
+
end # module Webspicy
|
@@ -19,7 +19,7 @@ module Webspicy
|
|
19
19
|
|
20
20
|
let(:configuration) {
|
21
21
|
Configuration.new(restful_folder){|c|
|
22
|
-
c.file_filter = /
|
22
|
+
c.file_filter = /get.yml/
|
23
23
|
}
|
24
24
|
}
|
25
25
|
|
@@ -32,7 +32,7 @@ module Webspicy
|
|
32
32
|
|
33
33
|
let(:configuration) {
|
34
34
|
Configuration.new(restful_folder){|c|
|
35
|
-
c.file_filter = /
|
35
|
+
c.file_filter = /get.yml/
|
36
36
|
c.service_filter = ->(s) {
|
37
37
|
s.method == "POST"
|
38
38
|
}
|
@@ -27,13 +27,13 @@ module Webspicy
|
|
27
27
|
let(:configuration) {
|
28
28
|
Configuration.new(restful_folder){|c|
|
29
29
|
c.file_filter = ->(f) {
|
30
|
-
f.basename.to_s == "
|
30
|
+
f.basename.to_s == "get.yml"
|
31
31
|
}
|
32
32
|
}
|
33
33
|
}
|
34
34
|
|
35
|
-
it 'returns only that
|
36
|
-
expect(subject.size).to eql(
|
35
|
+
it 'returns only that files' do
|
36
|
+
expect(subject.size).to eql(2)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -41,12 +41,12 @@ module Webspicy
|
|
41
41
|
|
42
42
|
let(:configuration) {
|
43
43
|
Configuration.new(restful_folder){|c|
|
44
|
-
c.file_filter = /
|
44
|
+
c.file_filter = /get.yml/
|
45
45
|
}
|
46
46
|
}
|
47
47
|
|
48
|
-
it 'returns only that
|
49
|
-
expect(subject.size).to eql(
|
48
|
+
it 'returns only that files' do
|
49
|
+
expect(subject.size).to eql(2)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,7 +54,7 @@ module Webspicy
|
|
54
54
|
|
55
55
|
let(:configuration) {
|
56
56
|
Configuration.new(restful_folder) do |c|
|
57
|
-
c.folder 'todo'
|
57
|
+
c.folder 'formaldef/todo'
|
58
58
|
end
|
59
59
|
}
|
60
60
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
module Webspicy
|
3
|
+
class Specification
|
4
|
+
describe Condition do
|
5
|
+
describe "sooner_or_later" do
|
6
|
+
include Condition
|
7
|
+
|
8
|
+
it 'works when the block returns anything non falsy' do
|
9
|
+
x = sooner_or_later(max: 1){ 12 }
|
10
|
+
expect(x).to eql(12)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns nil otherwise' do
|
14
|
+
x = sooner_or_later(max: 1){ nil }
|
15
|
+
expect(x).to eql(nil)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'can raise for us' do
|
19
|
+
expect{
|
20
|
+
sooner_or_later(max: 1, raise: true){ nil }
|
21
|
+
}.to raise_error(TimeoutError)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Webspicy
|
3
|
+
module Support
|
4
|
+
describe Hooks, "fire_after_each" do
|
5
|
+
|
6
|
+
class Hooker
|
7
|
+
include Hooks
|
8
|
+
def initialize(config)
|
9
|
+
@config = config
|
10
|
+
end
|
11
|
+
attr_reader :config
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'work with no after_each at all' do
|
15
|
+
config = Configuration.new
|
16
|
+
Hooker.new(config).fire_after_each(1, 2, 3)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'work with one after_each' do
|
20
|
+
config = Configuration.new
|
21
|
+
|
22
|
+
seen_args = nil
|
23
|
+
config.after_each do |*args|
|
24
|
+
seen_args = args
|
25
|
+
end
|
26
|
+
|
27
|
+
Hooker.new(config).fire_after_each(1, 2, 3)
|
28
|
+
|
29
|
+
expect(seen_args).to eql([1, 2, 3])
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'works with two after_each' do
|
33
|
+
config = Configuration.new
|
34
|
+
|
35
|
+
seen = false
|
36
|
+
|
37
|
+
seen_args = []
|
38
|
+
config.after_each do |*args|
|
39
|
+
seen_args << args
|
40
|
+
end
|
41
|
+
config.after_each do |*args|
|
42
|
+
seen_args << args
|
43
|
+
end
|
44
|
+
|
45
|
+
Hooker.new(config).fire_after_each(1, 2, 3)
|
46
|
+
|
47
|
+
expect(seen_args.size).to eql(2)
|
48
|
+
expect(seen_args.all?{|sa| sa == [1,2,3] }).to be(true)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,7 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
module Webspicy
|
3
|
-
|
4
|
-
describe
|
3
|
+
module Support
|
4
|
+
describe Hooks, "fire_around" do
|
5
|
+
|
6
|
+
class Hooker
|
7
|
+
include Hooks
|
8
|
+
def initialize(config)
|
9
|
+
@config = config
|
10
|
+
end
|
11
|
+
attr_reader :config
|
12
|
+
end
|
5
13
|
|
6
14
|
it 'work with no around at all' do
|
7
15
|
config = Configuration.new
|
@@ -9,8 +17,7 @@ module Webspicy
|
|
9
17
|
seen = false
|
10
18
|
block = ->(){ seen = true }
|
11
19
|
|
12
|
-
|
13
|
-
Client.new(scope).around(1, 2, 3, &block)
|
20
|
+
Hooker.new(config).fire_around(1, 2, 3, &block)
|
14
21
|
expect(seen).to be(true)
|
15
22
|
end
|
16
23
|
|
@@ -24,11 +31,10 @@ module Webspicy
|
|
24
31
|
bl.call
|
25
32
|
end
|
26
33
|
|
27
|
-
scope = Configuration::Scope.new(config)
|
28
34
|
block = ->(){ seen = true }
|
29
|
-
|
35
|
+
Hooker.new(config).fire_around(1, 2, 3, &block)
|
30
36
|
|
31
|
-
expect(seen_args
|
37
|
+
expect(seen_args).to eql([1, 2, 3])
|
32
38
|
expect(seen).to be(true)
|
33
39
|
end
|
34
40
|
|
@@ -47,12 +53,11 @@ module Webspicy
|
|
47
53
|
bl.call
|
48
54
|
end
|
49
55
|
|
50
|
-
scope = Configuration::Scope.new(config)
|
51
56
|
block = ->(){ seen = true }
|
52
|
-
|
57
|
+
Hooker.new(config).fire_around(1, 2, 3, &block)
|
53
58
|
|
54
59
|
expect(seen_args.size).to eql(2)
|
55
|
-
expect(seen_args.all?{|sa| sa
|
60
|
+
expect(seen_args.all?{|sa| sa == [1,2,3] }).to be(true)
|
56
61
|
expect(seen).to be(true)
|
57
62
|
end
|
58
63
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Webspicy
|
3
|
+
module Support
|
4
|
+
describe Hooks, "fire_before_each" do
|
5
|
+
|
6
|
+
class Hooker
|
7
|
+
include Hooks
|
8
|
+
def initialize(config)
|
9
|
+
@config = config
|
10
|
+
end
|
11
|
+
attr_reader :config
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'work with no before_each at all' do
|
15
|
+
config = Configuration.new
|
16
|
+
Hooker.new(config).fire_before_each(1, 2, 3)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'work with one before_each' do
|
20
|
+
config = Configuration.new
|
21
|
+
|
22
|
+
seen_args = nil
|
23
|
+
config.before_each do |*args|
|
24
|
+
seen_args = args
|
25
|
+
end
|
26
|
+
|
27
|
+
Hooker.new(config).fire_before_each(1, 2, 3)
|
28
|
+
|
29
|
+
expect(seen_args).to eql([1, 2, 3])
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'works with two before_each' do
|
33
|
+
config = Configuration.new
|
34
|
+
|
35
|
+
seen = false
|
36
|
+
|
37
|
+
seen_args = []
|
38
|
+
config.before_each do |*args|
|
39
|
+
seen_args << args
|
40
|
+
end
|
41
|
+
config.before_each do |*args|
|
42
|
+
seen_args << args
|
43
|
+
end
|
44
|
+
|
45
|
+
Hooker.new(config).fire_before_each(1, 2, 3)
|
46
|
+
|
47
|
+
expect(seen_args.size).to eql(2)
|
48
|
+
expect(seen_args.all?{|sa| sa == [1,2,3] }).to be(true)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|