midiskirt 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -74,7 +74,7 @@ class Midiskirt
74
74
  # Call proc if value is proc or use copy of existent value if
75
75
  # it can be duplicated
76
76
  value = if value.kind_of?(Proc)
77
- value.call(record)
77
+ (value.arity > 0) ? value.call(record) : value.call
78
78
  else
79
79
  value.duplicable? ? value.dup : value
80
80
  end
@@ -1,3 +1,3 @@
1
1
  class Midiskirt
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -114,4 +114,16 @@ class MidiskirtTest < Test::Unit::TestCase
114
114
  def test_should_not_dup_proc_results
115
115
  assert_same Factory(:tenant).settings, DefaultSettings
116
116
  end
117
+
118
+ def test_should_respect_closure_arity
119
+ assert_nothing_raised(ArgumentError) {
120
+ Factory(:tenant, :settings => lambda { DefaultSettings })
121
+ }
122
+ end
123
+
124
+ def test_should_pass_record_to_closure
125
+ Factory(:tenant, :settings => lambda {|record|
126
+ assert_kind_of(User, record)
127
+ })
128
+ end
117
129
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midiskirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-03-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
17
- requirement: &70299044510760 !ruby/object:Gem::Requirement
17
+ requirement: &70342672886580 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 1.0.0
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70299044510760
25
+ version_requirements: *70342672886580
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
- requirement: &70299044509760 !ruby/object:Gem::Requirement
28
+ requirement: &70342672885980 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70299044509760
36
+ version_requirements: *70342672885980
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: activesupport
39
- requirement: &70299044508940 !ruby/object:Gem::Requirement
39
+ requirement: &70342672885120 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '2.2'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70299044508940
47
+ version_requirements: *70342672885120
48
48
  description: Test::Unit begot MiniTest; factory_girl begot Miniskirt, Miniskirt begets
49
49
  Midiskirt
50
50
  email: