cucumber_factory 1.14.0 → 1.14.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fe3dc644f2055470649f9f9c6e4c1daab8ee30b4ad2136cc12011c393404fb9
4
- data.tar.gz: 7ee265cbb4c3c83752f39ba8f5af0aff938fbee6a83e8fc5b7f4d4d77a2407c6
3
+ metadata.gz: 5bccae277bb1c545da7f91a887837f4a930b4848b71c7508f1a56b18d4bce755
4
+ data.tar.gz: 14169c7d0c43ad800364a9765bf644558a6920b57293ce1f6dcab4de5a9179ae
5
5
  SHA512:
6
- metadata.gz: d37b11bf0e7ac0d9c3103734c102ce88df8eec096d171ebc239ebc9306e0cb767eb75c11a272c10d7a643b7edaa5658475f34884d4ce2e287ccec2c96025dc3c
7
- data.tar.gz: cfecaf32af5b283cc2f77bba6c69d96bc52bf69a37862e5e2e2562a73a30674842291aa0dbd60f240edf34121cdc251bc9829492ea0f57a809f33bec71afe7d2
6
+ metadata.gz: f5a2fdfc5b6eb970617dca9f769f58e197ac12eb0903db3d3b171040cd85b2da8027d7a620dfbdfaceddafe521eb5e271126820699eb93380e94b2057e5e0101
7
+ data.tar.gz: 6a88c46c19ed150fb39c9df5bfa25b799e8b9e36d0e338c12fae0ffacb5edc50d209df7abc0caae82625af2456818a59265f19d1dcefd35b370efe6f66070bb8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- cucumber_factory (1.13.0)
4
+ cucumber_factory (1.14.0)
5
5
  activerecord
6
6
  activesupport
7
7
  cucumber
@@ -151,8 +151,11 @@ module Cucumber
151
151
  elsif matches_fully?(value, VALUE_STRING)
152
152
  value = unquote(value)
153
153
  value = get_named_record(world, value) || transform_value(world, value)
154
+ elsif matches_fully?(value, VALUE_INTEGER)
155
+ value = value.to_s
156
+ value = get_named_record(world, value) || transform_value(world, value)
154
157
  else
155
- raise Error, "Cannot set association #{model_class}##{attribute} to #{value}. To identify a previously created record, use `above` or a quoted string."
158
+ raise Error, "Cannot set association #{model_class}##{attribute} to #{value}."
156
159
  end
157
160
  else
158
161
  value = resolve_scalar_value(world, model_class, attribute, value)
@@ -203,9 +206,9 @@ module Cucumber
203
206
  end
204
207
 
205
208
  def remember_record_names(world, record, attributes)
206
- string_values = attributes.values.select { |v| v.is_a?(String) }
207
- for string_value in string_values
208
- set_named_record(world, string_value, record)
209
+ rememberable_values = attributes.values.select { |v| v.is_a?(String) || v.is_a?(Fixnum) }
210
+ for value in rememberable_values
211
+ set_named_record(world, value.to_s, record)
209
212
  end
210
213
  end
211
214
 
@@ -1,3 +1,3 @@
1
1
  module CucumberFactory
2
- VERSION = '1.14.0'
2
+ VERSION = '1.14.1'
3
3
  end
@@ -133,6 +133,12 @@ describe 'steps provided by cucumber_factory' do
133
133
  payment.comment.should == 'Thanks for lending'
134
134
  end
135
135
 
136
+ it "should allow to set an explicit primary key" do
137
+ invoke_cucumber_step('there is a payment with the ID 2')
138
+ payment = Payment.last
139
+ payment.id.should == 2
140
+ end
141
+
136
142
  it "should allow to name records and set a belongs_to association to that record by refering to that name" do
137
143
  invoke_cucumber_step('"Some Prequel" is a movie with the title "Before Sunrise"')
138
144
  invoke_cucumber_step('there is a movie with the title "Limitless"')
@@ -151,6 +157,14 @@ describe 'steps provided by cucumber_factory' do
151
157
  movie.prequel.should == prequel
152
158
  end
153
159
 
160
+ it "should allow to set a belongs_to association to a previously created record by refering to their explicitely set primary keys" do
161
+ invoke_cucumber_step('there is a movie with the ID 123')
162
+ invoke_cucumber_step('there is a movie with the title "Before Sunset" and the prequel 123')
163
+ movie = Movie.find_by_title!('Before Sunset')
164
+ prequel = Movie.find(123)
165
+ movie.prequel.should == prequel
166
+ end
167
+
154
168
  it "should allow to set a belongs_to association to a previously created record by saying 'above'" do
155
169
  invoke_cucumber_step('there is a user with the name "Jane"')
156
170
  invoke_cucumber_step('there is a user with the name "John"')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch