cranky 0.3.0 → 0.3.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.
@@ -1,5 +1,10 @@
1
1
  # Overview of Changes
2
2
 
3
+ ## 0.3.1
4
+
5
+ * Bugfix, generating a hash of attributes via _attrs did not work with factory methods
6
+ that used the inherit method
7
+
3
8
  ## 0.3.0
4
9
 
5
10
  * Updated README to present the crank syntax as the default
@@ -62,10 +62,6 @@ module Cranky
62
62
  @n += 1
63
63
  end
64
64
 
65
- def inherit(what, overrides={})
66
- build(what, overrides.merge(options))
67
- end
68
-
69
65
  # Execute the requested factory method, crank out the target object!
70
66
  def crank_it(what, overrides)
71
67
  if what.to_s =~ /(.*)_attrs$/
@@ -86,6 +82,12 @@ module Cranky
86
82
  current_job.execute
87
83
  end
88
84
 
85
+ def inherit(what, overrides={})
86
+ overrides = overrides.merge(options)
87
+ overrides = overrides.merge(:_return_attributes => true) if current_job.return_attributes
88
+ build(what, overrides)
89
+ end
90
+
89
91
  def current_job
90
92
  @pipeline.last
91
93
  end
@@ -2,7 +2,7 @@ module Cranky
2
2
  class Job
3
3
 
4
4
  attr_writer :defaults
5
- attr_reader :overrides
5
+ attr_reader :overrides, :return_attributes
6
6
 
7
7
  def initialize(target, overrides={})
8
8
  @defaults = {}
@@ -1,3 +1,3 @@
1
1
  module Cranky
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -140,5 +140,9 @@ describe "The Cranky factory" do
140
140
  crank(:user_attrs).size.should == 6
141
141
  end
142
142
 
143
+ specify "attributes for works with factory methods using inherit" do
144
+ crank(:admin_by_define_attrs).class.should == Hash
145
+ end
146
+
143
147
  end
144
148
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Stephen McGinty
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-10-16 00:00:00 +01:00
17
+ date: 2011-10-22 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- hash: -860389489
56
+ hash: -570131409
57
57
  segments:
58
58
  - 0
59
59
  version: "0"