midiskirt 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  class Midiskirt
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
data/lib/midiskirt.rb CHANGED
@@ -71,8 +71,15 @@ class Midiskirt
71
71
 
72
72
  klass.new do |record|
73
73
  attributes.each do |name, value|
74
- value = value.kind_of?(Proc) ? value.call(record) : value
75
- record.send(:"#{name}=", value.duplicable? ? value.dup : value)
74
+ # Call proc if value is proc or use copy of existent value if
75
+ # it can be duplicated
76
+ value = if value.kind_of?(Proc)
77
+ value.call(record)
78
+ else
79
+ value.duplicable? ? value.dup : value
80
+ end
81
+
82
+ record.send(:"#{name}=", value)
76
83
  end
77
84
  end
78
85
  end
data/test/test_helper.rb CHANGED
@@ -51,6 +51,11 @@ Midiskirt.define :guest, :class => :user do |f|
51
51
  f.settings DefaultSettings
52
52
  end
53
53
 
54
+ Midiskirt.define :tenant, :class => :user do |f|
55
+ f.login "tenant"
56
+ f.settings { DefaultSettings }
57
+ end
58
+
54
59
  Midiskirt.define :unbeatable do |f|
55
60
  f.locked false
56
61
  f.state :enabled
@@ -110,4 +110,8 @@ class MidiskirtTest < Test::Unit::TestCase
110
110
  Factory(:unbeatable)
111
111
  }
112
112
  end
113
+
114
+ def test_should_not_dup_proc_results
115
+ assert_same Factory(:tenant).settings, DefaultSettings
116
+ end
113
117
  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.1
4
+ version: 1.2.2
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: &70260846686360 !ruby/object:Gem::Requirement
17
+ requirement: &70299044510760 !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: *70260846686360
25
+ version_requirements: *70299044510760
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
- requirement: &70260846685920 !ruby/object:Gem::Requirement
28
+ requirement: &70299044509760 !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: *70260846685920
36
+ version_requirements: *70299044509760
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: activesupport
39
- requirement: &70260846685320 !ruby/object:Gem::Requirement
39
+ requirement: &70299044508940 !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: *70260846685320
47
+ version_requirements: *70299044508940
48
48
  description: Test::Unit begot MiniTest; factory_girl begot Miniskirt, Miniskirt begets
49
49
  Midiskirt
50
50
  email: