cucumber-blendle-steps 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/cucumber-blendle-steps.gemspec +2 -2
- data/lib/cucumber/blendle/steps/model_steps.rb +28 -7
- data/lib/cucumber/blendle/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7320de3eb5c6186e98321d606bbfb9ac0a1500de
|
4
|
+
data.tar.gz: 816e6291f8beb068bcc6782fb05aa9152d03e082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fbcf0e02fdcf9dab18f63060894d3448322195524f8074344ed5b30cdf0bffa719a1671feafde5a8949730b2d956bcb901869cf35af83bd323f93291141ac7d
|
7
|
+
data.tar.gz: 836fa6d7b1268b8e5cb2ce312d57dd89b4578b4a37fc8ed35e44673f743fae3b8dc2dca1dee5fd032d65fea5252fedd93bf5b985ea654d655c18599744944988
|
data/CHANGELOG.md
CHANGED
@@ -22,15 +22,15 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'hyperresource'
|
23
23
|
spec.add_dependency 'json_spec'
|
24
24
|
spec.add_dependency 'minitest'
|
25
|
-
spec.add_dependency 'rspec-expectations'
|
26
25
|
spec.add_dependency 'rack-test'
|
27
26
|
spec.add_dependency 'rack'
|
27
|
+
spec.add_dependency 'rspec-expectations'
|
28
|
+
spec.add_dependency 'sequel'
|
28
29
|
|
29
30
|
spec.add_development_dependency 'bundler'
|
30
31
|
spec.add_development_dependency 'pry'
|
31
32
|
spec.add_development_dependency 'rake'
|
32
33
|
spec.add_development_dependency 'rubocop'
|
33
|
-
spec.add_development_dependency 'sequel'
|
34
34
|
spec.add_development_dependency 'sqlite3'
|
35
35
|
spec.add_development_dependency 'webmachine'
|
36
36
|
end
|
@@ -1,27 +1,48 @@
|
|
1
1
|
require 'active_support/core_ext/hash/keys'
|
2
2
|
require 'active_support/core_ext/object/blank'
|
3
3
|
require 'active_support/core_ext/string/inflections'
|
4
|
+
require 'sequel'
|
4
5
|
|
5
|
-
# rubocop:disable Lint/Eval
|
6
|
-
# rubocop:disable Lint/UnusedBlockArgument
|
6
|
+
# rubocop:disable Lint/Eval,Metrics/LineLength,Lint/UselessAssignment
|
7
7
|
|
8
8
|
Given(/^the following (\S+) exist:$/) do |object, table|
|
9
9
|
table.hashes.each do |row|
|
10
|
-
|
11
|
-
|
10
|
+
hash = parse_row(row)
|
11
|
+
|
12
|
+
assert eval("#{object.singularize.capitalize}.create(hash)")
|
13
|
+
step %(the following #{object.singularize} should exist:), table([hash.keys, hash.values])
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
|
-
Then(/^the (\S+) with (\S+) "([^"]*)" should( not)? exist$/) do |object, attribute,
|
17
|
+
Then(/^the (\S+) with (\S+)(?: \((\S+)\))? "([^"]*)" should( not)? exist$/) do |object, attribute, type, value, negate|
|
18
|
+
hash = parse_row("#{attribute} (#{type})" => value)
|
16
19
|
assertion = negate ? 'blank?' : 'present?'
|
17
20
|
|
18
|
-
assert eval("#{object.capitalize}.first(
|
21
|
+
assert eval("#{object.capitalize}.first(hash).#{assertion}"),
|
22
|
+
%(#{object.capitalize} not found \(#{attribute}: #{value}\))
|
19
23
|
end
|
20
24
|
|
21
25
|
Then(/^the following (\S+) should( not)? exist:$/) do |object, negate, table|
|
22
26
|
assertion = negate ? 'blank?' : 'present?'
|
23
27
|
|
24
28
|
table.hashes.each do |row|
|
25
|
-
|
29
|
+
hash = parse_row(row)
|
30
|
+
|
31
|
+
assert eval("#{object.capitalize}.first(hash).#{assertion}")
|
26
32
|
end
|
27
33
|
end
|
34
|
+
|
35
|
+
def parse_row(row)
|
36
|
+
hash = row.map do |attribute, value|
|
37
|
+
value = case attribute[/\s\((\w+)\)$/, 1]
|
38
|
+
when 'Array'
|
39
|
+
Sequel.pg_array(eval(value))
|
40
|
+
else
|
41
|
+
value
|
42
|
+
end
|
43
|
+
|
44
|
+
[attribute.to_s.split.first.to_sym, value]
|
45
|
+
end
|
46
|
+
|
47
|
+
Hash[hash]
|
48
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-blendle-steps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Mertz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rack-test
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: rack
|
112
|
+
name: rack
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: rspec-expectations
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,13 +137,13 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: sequel
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
|
-
type: :
|
146
|
+
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: bundler
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -165,7 +165,7 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: pry
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: rake
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
@@ -193,7 +193,7 @@ dependencies:
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: rubocop
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - ">="
|