datts_right 0.0.29 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datts_right (0.0.28)
4
+ datts_right (0.0.29)
5
5
  datts_right
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.29
1
+ 0.0.30
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{datts_right}
8
- s.version = "0.0.29"
8
+ s.version = "0.0.30"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ramon Tayag"]
@@ -182,13 +182,16 @@ module DattsRight
182
182
  def update_definition(key, new_values={})
183
183
  if dynamic_attributes_options[:definition]
184
184
  if definition && definition[key]
185
- attr_key = new_values[:attr_key]
185
+ attr_key = new_values.symbolize_keys[:attr_key]
186
186
  new_values.each do |k, v|
187
- definition[key][k] = v unless k.to_sym == :attr_key
187
+ definition[key][k] = v unless k.to_s == "attr_key"
188
188
  end
189
189
 
190
+ #puts "attr_key is #{attr_key}"
190
191
  if attr_key
192
+ #puts "Adding definition: #{attr_key} => #{definition[key]}"
191
193
  add_definition(attr_key, definition[key])
194
+ #puts "Removing definition: #{key} => #{definition[key]}"
192
195
  remove_definition(key)
193
196
  end
194
197
  else
@@ -12,6 +12,14 @@ describe DattsRight, ".update_definition(key, value)" do
12
12
  c.definition[:robot].should be_nil
13
13
  c.definition[:bodi].should == {:object_type => "string"}
14
14
  end
15
+
16
+ it "should update attr_key of a definition even if it's not symbolized" do
17
+ c = Category.create
18
+ c.definition = {:robot => {:object_type => "string"}}
19
+ c.update_definition(:robot, "attr_key" => "bodi")
20
+ c.definition[:robot].should be_nil
21
+ c.definition[:bodi].should == {:object_type => "string"}
22
+ end
15
23
 
16
24
  it "should be able to update the rest (all except attr_key) of the definition" do
17
25
  c = Category.create
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datts_right
3
3
  version: !ruby/object:Gem::Version
4
- hash: 37
4
+ hash: 35
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 29
10
- version: 0.0.29
9
+ - 30
10
+ version: 0.0.30
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ramon Tayag