shokkenki-provider 0.0.5 → 1.0.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.
@@ -9,8 +9,16 @@ module Shokkenki
9
9
  validate!
10
10
  end
11
11
 
12
+ def name
13
+ @name_pattern.inspect
14
+ end
15
+
16
+ def matches? required_fixture
17
+ !match(required_fixture).nil?
18
+ end
19
+
12
20
  def establish required_fixture
13
- match = @name_pattern.match required_fixture.name
21
+ match = match(required_fixture)
14
22
  if match
15
23
  arguments = {
16
24
  :arguments => required_fixture.arguments,
@@ -22,8 +30,12 @@ module Shokkenki
22
30
 
23
31
  private
24
32
 
33
+ def match required_fixture
34
+ @name_pattern.match required_fixture.name
35
+ end
36
+
25
37
  def validate!
26
- message = "Fixture establisher for name pattern /#{@name_pattern}/ must only accept zero or one argument."
38
+ message = "Fixture establisher for name pattern #{@name_pattern.inspect} must only accept zero or one argument."
27
39
  raise message unless @establisher.arity <= 1
28
40
  end
29
41
 
@@ -20,7 +20,22 @@ module Shokkenki
20
20
 
21
21
  def establish required_fixtures
22
22
  required_fixtures.each do |required_fixture|
23
- @fixtures.each { |fixture| fixture.establish required_fixture }
23
+ fixtures = @fixtures.select {|f| f.matches?(required_fixture) }
24
+ assert_single_match! required_fixture, fixtures
25
+ fixtures.first.establish required_fixture
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def assert_single_match! required_fixture, fixtures
32
+ if fixtures.length > 1
33
+ fixture_names = fixtures.map(&:name).join(', ')
34
+ raise "Multiple fixtures found to match '#{required_fixture.name}' (#{fixture_names}): Do you need to make your fixture matchers stricter?"
35
+ end
36
+
37
+ if fixtures.length == 0
38
+ raise "No fixture found to match '#{required_fixture.name}': Did you define one in the provider configuration?"
24
39
  end
25
40
  end
26
41
  end
@@ -5,7 +5,7 @@ module Shokkenki
5
5
  module RegexpTerm
6
6
  def verify_within context
7
7
  term_value = value
8
- context.it %Q{matches /#{term_value}/} do
8
+ context.it %Q{matches #{term_value.inspect}} do
9
9
  @actual_values.each{ |value| expect(value.to_s).to(match(term_value)) }
10
10
  end
11
11
  end
@@ -23,7 +23,7 @@ module Shokkenki
23
23
  def redeem_tickets
24
24
  @ticket_reader.read_from(ticket_location).each do |ticket|
25
25
  provider = providers[ticket.provider.name]
26
- raise "No provided named '#{ticket.provider.name}' was found. Did you register one?" unless provider
26
+ raise "No provider named '#{ticket.provider.name}' was found. Did you register one?" unless provider
27
27
  ticket.verify_with provider
28
28
  end
29
29
  end
@@ -1,7 +1,7 @@
1
1
  module Shokkenki
2
2
  module Provider
3
3
  module Version
4
- STRING = '0.0.5'
4
+ STRING = '1.0.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shokkenki-provider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 1.0.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Brent Snook
@@ -13,127 +14,145 @@ dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rspec
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ">="
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: activesupport
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: 3.0.0
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: 3.0.0
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: faraday
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - ">="
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - ">="
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rack-test
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - ">="
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - ">="
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: jsonpath
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - ">="
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - ">="
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: shokkenki-support
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - ">="
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
- version: 0.0.5
101
+ version: 1.0.0
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - ">="
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
- version: 0.0.5
109
+ version: 1.0.0
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: rake
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - "~>"
115
+ - - ~>
102
116
  - !ruby/object:Gem::Version
103
117
  version: 10.0.0
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - "~>"
123
+ - - ~>
109
124
  - !ruby/object:Gem::Version
110
125
  version: 10.0.0
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: cucumber
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
- - - ">="
131
+ - - ! '>='
116
132
  - !ruby/object:Gem::Version
117
133
  version: '0'
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
- - - ">="
139
+ - - ! '>='
123
140
  - !ruby/object:Gem::Version
124
141
  version: '0'
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: relish
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
- - - ">="
147
+ - - ! '>='
130
148
  - !ruby/object:Gem::Version
131
149
  version: '0'
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
- - - ">="
155
+ - - ! '>='
137
156
  - !ruby/object:Gem::Version
138
157
  version: '0'
139
158
  description: Example-driven consumer-driven contracts. For providers.
@@ -167,26 +186,30 @@ files:
167
186
  homepage: http://github.com/brentsnook/shokkenki-provider
168
187
  licenses:
169
188
  - GPL2
170
- metadata: {}
171
189
  post_install_message:
172
190
  rdoc_options:
173
- - "--charset=UTF-8"
191
+ - --charset=UTF-8
174
192
  require_paths:
175
193
  - lib
176
194
  required_ruby_version: !ruby/object:Gem::Requirement
195
+ none: false
177
196
  requirements:
178
- - - ">="
197
+ - - ! '>='
179
198
  - !ruby/object:Gem::Version
180
199
  version: '1.9'
181
200
  required_rubygems_version: !ruby/object:Gem::Requirement
201
+ none: false
182
202
  requirements:
183
- - - ">="
203
+ - - ! '>='
184
204
  - !ruby/object:Gem::Version
185
205
  version: '0'
206
+ segments:
207
+ - 0
208
+ hash: 3186180067421366972
186
209
  requirements: []
187
210
  rubyforge_project:
188
- rubygems_version: 2.2.0
211
+ rubygems_version: 1.8.23
189
212
  signing_key:
190
- specification_version: 4
191
- summary: shokkenki-0.0.5
213
+ specification_version: 3
214
+ summary: shokkenki-1.0.0
192
215
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 5cc65f523125f14555e350faf062b59d15fb840b
4
- data.tar.gz: 7d0ecd02eeb3af224d4de57b38ad37e079acd7b7
5
- SHA512:
6
- metadata.gz: 3bf25cbc160477bbe6aff2b2c6dfd21dc033657560c7249994c12467b109e20407da0411d525215856e0354e46ab54eaff6432c931147bdaea8d1bb27890d55a
7
- data.tar.gz: 88b9df463b4795bfba64749c158a88122450bd514433672d03e9b87e92e2f8d77fce9f4a79fc02eeb768917fa0356531065709154425664100ef148eabcbfe41