pickle 0.2.4 → 0.2.5

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.
@@ -1,9 +1,17 @@
1
+ == 0.2.5 - 17 Mar 2010
2
+
3
+ * 2 improvements
4
+ * Bugfix for find_models_via_table (failing to find models was not causing an error) [Chris Flipse]
5
+ * find_models_via_table & create_models_via_table return the found/created models [Chris Flipse, Ian White]
6
+
7
+
1
8
  == 0.2.4 - 9 Mar 2010
2
9
 
3
10
  * 1 major improvement
4
11
  * Finding models via a table now works in the same way as creating models via a table (0.2.3), you
5
12
  can create pickle refs
6
13
 
14
+
7
15
  == 0.2.3 - 9 Mar 2010
8
16
 
9
17
  * 1 major improvement
@@ -68,6 +68,7 @@ The following people have made Pickle better:
68
68
  * {Michael Moen}[http://github.com/UnderpantsGnome]
69
69
  * {Myron Marston}[http://github.com/myronmarston]
70
70
  * {Stephan Hagemann}[http://github.com/xing]
71
+ * {Chris Flipse}[http://github.com/cflipse]
71
72
 
72
73
  == Get Started
73
74
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -27,7 +27,7 @@ end
27
27
 
28
28
  # find models with a table
29
29
  Then(/^the following #{capture_plural_factory} should exists?:?$/) do |plural_factory, table|
30
- find_models_from_table(plural_factory, table)
30
+ find_models_from_table(plural_factory, table).should_not be_any(&:nil?)
31
31
  end
32
32
 
33
33
  # find exactly n models
@@ -31,7 +31,7 @@ module Pickle
31
31
  # if a column exists in the table which matches the singular factory name, this is used as the pickle ref
32
32
  def create_models_from_table(plural_factory, table)
33
33
  factory = plural_factory.singularize
34
- table.hashes.each do |hash|
34
+ table.hashes.map do |hash|
35
35
  pickle_ref = factory + (hash[factory] ? " \"#{hash.delete(factory)}\"" : "")
36
36
  create_model(pickle_ref, hash)
37
37
  end
@@ -61,7 +61,7 @@ module Pickle
61
61
  # if a column exists in the table which matches the singular factory name, this is used as the pickle ref
62
62
  def find_models_from_table(plural_factory, table)
63
63
  factory = plural_factory.singularize
64
- table.hashes.each do |hash|
64
+ table.hashes.map do |hash|
65
65
  pickle_ref = factory + (hash[factory] ? " \"#{hash.delete(factory)}\"" : "")
66
66
  find_model(pickle_ref, hash)
67
67
  end
@@ -172,4 +172,4 @@ module Pickle
172
172
  models_by_index(factory) << record
173
173
  end
174
174
  end
175
- end
175
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pickle}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ian White"]
12
- s.date = %q{2010-03-09}
12
+ s.date = %q{2010-03-17}
13
13
  s.description = %q{Easy model creation and reference in your cucumber features}
14
14
  s.email = %q{ian.w.white@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -27,7 +27,7 @@ end
27
27
 
28
28
  # find models with a table
29
29
  Then(/^the following #{capture_plural_factory} should exists?:?$/) do |plural_factory, table|
30
- find_models_from_table(plural_factory, table)
30
+ find_models_from_table(plural_factory, table).should_not be_any(&:nil?)
31
31
  end
32
32
 
33
33
  # find exactly n models
@@ -213,16 +213,16 @@ describe Pickle::Session do
213
213
  @table = mock(:hashes => [{'name' => 'Fred'}, {'name' => 'Betty'}])
214
214
  end
215
215
 
216
- it "#create_models_from_table(<plural factory>, <table>) should call create_model for each of the table hashes with plain factory name" do
217
- should_receive(:create_model).with("user", 'name' => "Fred").once.ordered
218
- should_receive(:create_model).with("user", 'name' => "Betty").once.ordered
219
- create_models_from_table("users", @table)
216
+ it "#create_models_from_table(<plural factory>, <table>) should call create_model for each of the table hashes with plain factory name and return the models" do
217
+ should_receive(:create_model).with("user", 'name' => "Fred").once.ordered.and_return(:fred)
218
+ should_receive(:create_model).with("user", 'name' => "Betty").once.ordered.and_return(:betty)
219
+ create_models_from_table("users", @table).should == [:fred, :betty]
220
220
  end
221
221
 
222
- it "#find_models_from_table(<plural factory>, <table>) should call find_model for each of the table hashes with plain factory name" do
223
- should_receive(:find_model).with("user", 'name' => "Fred").once.ordered
224
- should_receive(:find_model).with("user", 'name' => "Betty").once.ordered
225
- find_models_from_table("users", @table)
222
+ it "#find_models_from_table(<plural factory>, <table>) should call find_model for each of the table hashes with plain factory name and return the models" do
223
+ should_receive(:find_model).with("user", 'name' => "Fred").once.ordered.and_return(:fred)
224
+ should_receive(:find_model).with("user", 'name' => "Betty").once.ordered.and_return(:betty)
225
+ find_models_from_table("users", @table).should == [:fred, :betty]
226
226
  end
227
227
  end
228
228
 
@@ -232,15 +232,15 @@ describe Pickle::Session do
232
232
  end
233
233
 
234
234
  it "#create_models_from_table(<plural factory>, <table>) should call create_model for each of the table hashes with labelled pickle ref" do
235
- should_receive(:create_model).with("user \"fred\"", 'name' => "Fred").once.ordered
236
- should_receive(:create_model).with("user \"betty\"", 'name' => "Betty").once.ordered
237
- create_models_from_table("users", @table)
235
+ should_receive(:create_model).with("user \"fred\"", 'name' => "Fred").once.ordered.and_return(:fred)
236
+ should_receive(:create_model).with("user \"betty\"", 'name' => "Betty").once.ordered.and_return(:betty)
237
+ create_models_from_table("users", @table).should == [:fred, :betty]
238
238
  end
239
239
 
240
240
  it "#find_models_from_table(<plural factory>, <table>) should call find_model for each of the table hashes with labelled pickle ref" do
241
- should_receive(:find_model).with("user \"fred\"", 'name' => "Fred").once.ordered
242
- should_receive(:find_model).with("user \"betty\"", 'name' => "Betty").once.ordered
243
- find_models_from_table("users", @table)
241
+ should_receive(:find_model).with("user \"fred\"", 'name' => "Fred").once.ordered.and_return(:fred)
242
+ should_receive(:find_model).with("user \"betty\"", 'name' => "Betty").once.ordered.and_return(:betty)
243
+ find_models_from_table("users", @table).should == [:fred, :betty]
244
244
  end
245
245
  end
246
246
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 4
9
- version: 0.2.4
8
+ - 5
9
+ version: 0.2.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ian White
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-09 00:00:00 +00:00
17
+ date: 2010-03-17 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies: []
20
20