hash_dealer 1.2.2 → 1.2.3
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.
- data/VERSION +1 -1
- data/hash_dealer.gemspec +2 -2
- data/lib/hash_dealer.rb +1 -1
- data/spec/lib/hash_dealer_spec.rb +11 -0
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.3
|
data/hash_dealer.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{hash_dealer}
|
|
8
|
-
s.version = "1.2.
|
|
8
|
+
s.version = "1.2.3"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Dan Langevin"]
|
|
12
|
-
s.date = %q{2011-08-
|
|
12
|
+
s.date = %q{2011-08-23}
|
|
13
13
|
s.description = %q{Like Factory Girl but for Hashes only}
|
|
14
14
|
s.email = %q{dan.langevin@lifebooker.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/hash_dealer.rb
CHANGED
|
@@ -36,7 +36,7 @@ class HashDealer
|
|
|
36
36
|
def _attributes(*args)
|
|
37
37
|
|
|
38
38
|
# allows us to set a root value
|
|
39
|
-
return @attributes unless @attributes.is_a?(Hash)
|
|
39
|
+
return @attributes.clone unless @attributes.is_a?(Hash)
|
|
40
40
|
att = @parent ? HashDealer.roll(@parent.to_sym) : Hash.new
|
|
41
41
|
@attributes.each do |k,v|
|
|
42
42
|
att[k] = v.is_a?(Proc) ? v.call(*args) : v
|
|
@@ -103,6 +103,17 @@ describe HashDealer do
|
|
|
103
103
|
end
|
|
104
104
|
HashDealer.roll(:variable).matcher.should eql([{:abc => ":123", :deff => ":1234"}])
|
|
105
105
|
end
|
|
106
|
+
|
|
107
|
+
it "should return a clone of its attributes, not an actual reference" do
|
|
108
|
+
HashDealer.define(:a) do
|
|
109
|
+
root({:a => "b"})
|
|
110
|
+
end
|
|
111
|
+
HashDealer.define(:b) do
|
|
112
|
+
a "test"
|
|
113
|
+
end
|
|
114
|
+
HashDealer.roll(:a).should_not be HashDealer.roll(:a)
|
|
115
|
+
HashDealer.roll(:b).should_not be HashDealer.roll(:b)
|
|
116
|
+
end
|
|
106
117
|
|
|
107
118
|
it "should allow defining a hash where one of the keys is attributes" do
|
|
108
119
|
HashDealer.define(:test) do
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: hash_dealer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 1.2.
|
|
5
|
+
version: 1.2.3
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Dan Langevin
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2011-08-
|
|
13
|
+
date: 2011-08-23 00:00:00 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activesupport
|
|
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
129
129
|
requirements:
|
|
130
130
|
- - ">="
|
|
131
131
|
- !ruby/object:Gem::Version
|
|
132
|
-
hash:
|
|
132
|
+
hash: -4242599819582722325
|
|
133
133
|
segments:
|
|
134
134
|
- 0
|
|
135
135
|
version: "0"
|