representable 2.3.0 → 2.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +47 -0
  3. data/Gemfile +5 -0
  4. data/README.md +33 -0
  5. data/lib/representable.rb +60 -73
  6. data/lib/representable/binding.rb +37 -194
  7. data/lib/representable/cached.rb +10 -46
  8. data/lib/representable/coercion.rb +8 -8
  9. data/lib/representable/config.rb +15 -75
  10. data/lib/representable/debug.rb +41 -59
  11. data/lib/representable/declarative.rb +34 -53
  12. data/lib/representable/decorator.rb +11 -40
  13. data/lib/representable/definition.rb +14 -15
  14. data/lib/representable/deprecations.rb +90 -0
  15. data/lib/representable/deserializer.rb +87 -82
  16. data/lib/representable/for_collection.rb +5 -3
  17. data/lib/representable/hash.rb +5 -3
  18. data/lib/representable/hash/binding.rb +6 -15
  19. data/lib/representable/hash/collection.rb +10 -6
  20. data/lib/representable/hash_methods.rb +5 -5
  21. data/lib/representable/insert.rb +31 -0
  22. data/lib/representable/json.rb +7 -3
  23. data/lib/representable/json/hash.rb +1 -1
  24. data/lib/representable/object/binding.rb +5 -5
  25. data/lib/representable/parse_strategies.rb +37 -3
  26. data/lib/representable/pipeline.rb +37 -5
  27. data/lib/representable/pipeline_factories.rb +88 -0
  28. data/lib/representable/serializer.rb +38 -44
  29. data/lib/representable/version.rb +1 -1
  30. data/lib/representable/xml.rb +4 -0
  31. data/lib/representable/xml/binding.rb +25 -31
  32. data/lib/representable/xml/collection.rb +5 -3
  33. data/lib/representable/xml/hash.rb +7 -2
  34. data/lib/representable/yaml.rb +6 -3
  35. data/lib/representable/yaml/binding.rb +4 -4
  36. data/representable.gemspec +3 -3
  37. data/test/---deserialize-pipeline_test.rb +37 -0
  38. data/test/binding_test.rb +7 -7
  39. data/test/cached_test.rb +31 -19
  40. data/test/coercion_test.rb +2 -2
  41. data/test/config/inherit_test.rb +13 -12
  42. data/test/config_test.rb +12 -67
  43. data/test/decorator_test.rb +4 -5
  44. data/test/default_test.rb +34 -0
  45. data/test/defaults_options_test.rb +93 -0
  46. data/test/definition_test.rb +19 -39
  47. data/test/exec_context_test.rb +1 -1
  48. data/test/filter_test.rb +18 -20
  49. data/test/getter_setter_test.rb +1 -8
  50. data/test/hash_bindings_test.rb +13 -13
  51. data/test/heritage_test.rb +62 -0
  52. data/test/if_test.rb +1 -0
  53. data/test/inherit_test.rb +5 -3
  54. data/test/instance_test.rb +3 -4
  55. data/test/json_test.rb +3 -59
  56. data/test/lonely_test.rb +47 -3
  57. data/test/nested_test.rb +8 -2
  58. data/test/pipeline_test.rb +259 -0
  59. data/test/populator_test.rb +76 -0
  60. data/test/realistic_benchmark.rb +39 -7
  61. data/test/render_nil_test.rb +21 -0
  62. data/test/represent_test.rb +2 -2
  63. data/test/representable_test.rb +33 -103
  64. data/test/schema_test.rb +5 -15
  65. data/test/serialize_deserialize_test.rb +2 -2
  66. data/test/skip_test.rb +1 -1
  67. data/test/test_helper.rb +6 -0
  68. data/test/uncategorized_test.rb +67 -0
  69. data/test/xml_bindings_test.rb +6 -6
  70. data/test/xml_test.rb +6 -6
  71. metadata +33 -13
  72. data/lib/representable/apply.rb +0 -13
  73. data/lib/representable/inheritable.rb +0 -71
  74. data/lib/representable/mapper.rb +0 -83
  75. data/lib/representable/populator.rb +0 -56
  76. data/test/inheritable_test.rb +0 -97
@@ -16,20 +16,21 @@ class ConfigInheritTest < MiniTest::Spec
16
16
 
17
17
  # end
18
18
  module GenreModule
19
- include Representable
19
+ include Representable::Hash
20
20
  property :genre
21
21
  end
22
22
 
23
23
 
24
24
  # in Decorator ------------------------------------------------
25
25
  class Decorator < Representable::Decorator
26
+ include Representable::Hash
26
27
  property :title
27
28
  property :artist do
28
29
  property :id
29
30
  end
30
31
  end
31
32
 
32
- it { Decorator.representable_attrs[:definitions].keys.must_equal ["title", "artist"] }
33
+ it { Decorator.definitions.keys.must_equal ["title", "artist"] }
33
34
 
34
35
  # in inheriting Decorator
35
36
 
@@ -37,7 +38,7 @@ class ConfigInheritTest < MiniTest::Spec
37
38
  property :location
38
39
  end
39
40
 
40
- it { InheritingDecorator.representable_attrs[:definitions].keys.must_equal ["title", "artist", "location"] }
41
+ it { InheritingDecorator.definitions.keys.must_equal ["title", "artist", "location"] }
41
42
  it { assert_cloned(InheritingDecorator, Decorator, "title") }
42
43
  it do
43
44
  InheritingDecorator.representable_attrs.get(:artist).representer_module.object_id.wont_equal Decorator.representable_attrs.get(:artist).representer_module.object_id
@@ -50,7 +51,7 @@ class ConfigInheritTest < MiniTest::Spec
50
51
  property :location
51
52
  end
52
53
 
53
- it { InheritingAndIncludingDecorator.representable_attrs[:definitions].keys.must_equal ["title", "artist", "genre", "location"] }
54
+ it { InheritingAndIncludingDecorator.definitions.keys.must_equal ["title", "artist", "genre", "location"] }
54
55
  it { assert_cloned(InheritingAndIncludingDecorator, GenreModule, :genre) }
55
56
 
56
57
 
@@ -60,7 +61,7 @@ class ConfigInheritTest < MiniTest::Spec
60
61
  property :title
61
62
  end
62
63
 
63
- it { Module.representable_attrs[:definitions].keys.must_equal ["title"] }
64
+ it { Module.definitions.keys.must_equal ["title"] }
64
65
 
65
66
 
66
67
  # in module including module
@@ -71,7 +72,7 @@ class ConfigInheritTest < MiniTest::Spec
71
72
  property :location
72
73
  end
73
74
 
74
- it { SubModule.representable_attrs[:definitions].keys.must_equal ["title", "location"] }
75
+ it { SubModule.definitions.keys.must_equal ["title", "location"] }
75
76
  it { assert_cloned(SubModule, Module, :title) }
76
77
 
77
78
  # including preserves order
@@ -83,7 +84,7 @@ class ConfigInheritTest < MiniTest::Spec
83
84
  property :location
84
85
  end
85
86
 
86
- it { IncludingModule.representable_attrs[:definitions].keys.must_equal ["genre", "title", "location"] }
87
+ it { IncludingModule.definitions.keys.must_equal ["genre", "title", "location"] }
87
88
 
88
89
 
89
90
  # included in class -------------------------------------------
@@ -92,7 +93,7 @@ class ConfigInheritTest < MiniTest::Spec
92
93
  include IncludingModule
93
94
  end
94
95
 
95
- it { Class.representable_attrs[:definitions].keys.must_equal ["genre", "title", "location"] }
96
+ it { Class.definitions.keys.must_equal ["genre", "title", "location"] }
96
97
  it { assert_cloned(Class, IncludingModule, :title) }
97
98
  it { assert_cloned(Class, IncludingModule, :location) }
98
99
  it { assert_cloned(Class, IncludingModule, :genre) }
@@ -104,7 +105,7 @@ class ConfigInheritTest < MiniTest::Spec
104
105
  include IncludingModule
105
106
  end
106
107
 
107
- it { DefiningClass.representable_attrs[:definitions].keys.must_equal ["street_cred", "genre", "title", "location"] }
108
+ it { DefiningClass.definitions.keys.must_equal ["street_cred", "genre", "title", "location"] }
108
109
 
109
110
  # in class
110
111
  class RepresenterClass
@@ -112,7 +113,7 @@ class ConfigInheritTest < MiniTest::Spec
112
113
  property :title
113
114
  end
114
115
 
115
- it { RepresenterClass.representable_attrs[:definitions].keys.must_equal ["title"] }
116
+ it { RepresenterClass.definitions.keys.must_equal ["title"] }
116
117
 
117
118
 
118
119
  # in inheriting class
@@ -121,7 +122,7 @@ class ConfigInheritTest < MiniTest::Spec
121
122
  property :location
122
123
  end
123
124
 
124
- it { InheritingClass.representable_attrs[:definitions].keys.must_equal ["title", "location"] }
125
+ it { InheritingClass.definitions.keys.must_equal ["title", "location"] }
125
126
  it { assert_cloned(InheritingClass, RepresenterClass, :title) }
126
127
 
127
128
  # in inheriting class and including
@@ -130,5 +131,5 @@ class ConfigInheritTest < MiniTest::Spec
130
131
  include GenreModule
131
132
  end
132
133
 
133
- it { InheritingAndIncludingClass.representable_attrs[:definitions].keys.must_equal ["title", "location", "genre"] }
134
+ it { InheritingAndIncludingClass.definitions.keys.must_equal ["title", "location", "genre"] }
134
135
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class ConfigTest < MiniTest::Spec
4
- subject { Representable::Config.new }
4
+ subject { Representable::Config.new(Representable::Definition) }
5
5
  PunkRock = Class.new
6
6
  Definition = Representable::Definition
7
7
 
@@ -10,15 +10,15 @@ class ConfigTest < MiniTest::Spec
10
10
  assert_equal nil, subject.wrap_for("Punk", nil)
11
11
  end
12
12
 
13
- it "infers a printable class name if set to true" do
14
- subject.wrap = true
15
- assert_equal "punk_rock", subject.wrap_for(PunkRock, nil)
16
- end
13
+ # it "infers a printable class name if set to true" do
14
+ # subject.wrap = true
15
+ # assert_equal "punk_rock", subject.wrap_for(PunkRock, nil)
16
+ # end
17
17
 
18
- it "can be set explicitely" do
19
- subject.wrap = "Descendents"
20
- assert_equal "Descendents", subject.wrap_for(PunkRock, nil)
21
- end
18
+ # it "can be set explicitely" do
19
+ # subject.wrap = "Descendents"
20
+ # assert_equal "Descendents", subject.wrap_for(PunkRock, nil)
21
+ # end
22
22
  end
23
23
 
24
24
  describe "#[]" do
@@ -42,7 +42,7 @@ class ConfigTest < MiniTest::Spec
42
42
  describe "returns" do
43
43
  it do
44
44
  # #add returns Definition.`
45
- subject = Representable::Config.new.add(:title, {:me => true})
45
+ subject = Representable::Config.new(Representable::Definition).add(:title, {:me => true})
46
46
 
47
47
  subject.must_be_kind_of Representable::Definition
48
48
  subject[:me].must_equal true
@@ -76,7 +76,7 @@ class ConfigTest < MiniTest::Spec
76
76
 
77
77
 
78
78
  describe "#remove" do
79
- subject { Representable::Config.new }
79
+ subject { Representable::Config.new(Representable::Definition) }
80
80
 
81
81
  it do
82
82
  subject.add(:title, {:me => true})
@@ -109,7 +109,7 @@ class ConfigTest < MiniTest::Spec
109
109
  end
110
110
 
111
111
  describe "#get" do
112
- subject { Representable::Config.new }
112
+ subject { Representable::Config.new(Representable::Definition) }
113
113
 
114
114
  it do
115
115
  title = subject.add(:title, {})
@@ -119,59 +119,4 @@ class ConfigTest < MiniTest::Spec
119
119
  subject.get(:length).must_equal length
120
120
  end
121
121
  end
122
-
123
-
124
- describe "#inherit!" do
125
- let (:title) { Definition.new(:title) }
126
- let (:length) { Definition.new(:length) }
127
- let (:stars) { Definition.new(:stars) }
128
-
129
- it do
130
- parent = Representable::Config.new
131
- parent.add(:title, {:alias => "Callname"})
132
- parent[:features][Object] = true
133
- # DISCUSS: build Inheritable::Hash automatically in options? is there a gem for that?
134
- parent.options[:additional_features] = Representable::Inheritable::Hash[Object => true]
135
-
136
- subject.inherit!(parent)
137
-
138
- # add to inherited config:
139
- subject.add(:stars, {})
140
- subject[:features][Module] = true
141
- subject.options[:additional_features][Module] = true
142
-
143
- subject[:features].must_equal({Object => true, Module => true})
144
-
145
- parent.options[:additional_features].must_equal({Object => true})
146
- subject.options[:additional_features].must_equal({Object => true, Module => true})
147
-
148
- # test Definition interface:
149
-
150
- # definitions.size.must_equal([subject.get(:title), subject.get(:stars)])
151
- subject.get(:title).object_id.wont_equal parent.get(:title).object_id
152
- # subject.get(:stars).object_id.must_equal stars.object_id
153
- end
154
-
155
- # Config with Inheritable::Array
156
- it "xx" do
157
- parent = Representable::Config.new
158
- parent.options[:links] = Representable::Inheritable::Array.new
159
- parent.options[:links] << "//1"
160
-
161
- subject.options[:links] = Representable::Inheritable::Array.new
162
- subject.options[:links] << "//2"
163
-
164
- subject.inherit!(parent)
165
- subject.options[:links].must_equal ["//2", "//1"]
166
- end
167
- end
168
-
169
- describe "#features" do
170
- it do
171
- subject[:features][Object] = true
172
- subject[:features][Module] = true
173
-
174
- subject.features.must_equal [Object, Module]
175
- end
176
- end
177
122
  end
@@ -1,7 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class DecoratorTest < MiniTest::Spec
4
- # TODO: Move to global place since it's used twice.
5
4
  class SongRepresentation < Representable::Decorator
6
5
  include Representable::JSON
7
6
  property :name
@@ -79,7 +78,7 @@ class InheritanceWithDecoratorTest < MiniTest::Spec
79
78
  class Twin
80
79
  extend Uber::InheritableAttr
81
80
  inheritable_attr :representer_class
82
- self.representer_class = Representable::Decorator
81
+ self.representer_class = Class.new(Representable::Decorator){ include Representable::Hash }
83
82
  end
84
83
 
85
84
  class Album < Twin
@@ -90,8 +89,8 @@ class InheritanceWithDecoratorTest < MiniTest::Spec
90
89
  end
91
90
 
92
91
  it do
93
- Twin.representer_class.representable_attrs[:definitions].size.must_equal 0
94
- Album.representer_class.representable_attrs[:definitions].size.must_equal 1
95
- Song.representer_class.representable_attrs[:definitions].size.must_equal 0
92
+ Twin.representer_class.definitions.size.must_equal 0
93
+ Album.representer_class.definitions.size.must_equal 1
94
+ Song.representer_class.definitions.size.must_equal 0
96
95
  end
97
96
  end
@@ -0,0 +1,34 @@
1
+ require "test_helper"
2
+
3
+ class DefaultTest < MiniTest::Spec
4
+ Song = Struct.new(:id, :title)
5
+
6
+ representer! do
7
+ property :id
8
+ property :title, default: "Huber Breeze" #->(options) { options[:default] }
9
+ end
10
+
11
+ describe "#from_hash" do
12
+ let (:song) { Song.new.extend(representer) }
13
+
14
+ it { song.from_hash({}).must_equal Song.new(nil, "Huber Breeze") }
15
+ # default doesn't apply when empty string.
16
+ it { song.from_hash({"title"=>""}).must_equal Song.new(nil, "") }
17
+ it { song.from_hash({"title"=>nil}).must_equal Song.new(nil, nil) }
18
+ it { song.from_hash({"title"=>"Blindfold"}).must_equal Song.new(nil, "Blindfold") }
19
+ end
20
+
21
+ describe "#to_json" do
22
+ it "uses :default when not available from object" do
23
+ Song.new.extend(representer).to_hash.must_equal({"title"=>"Huber Breeze"})
24
+ end
25
+
26
+ it "uses value from represented object when present" do
27
+ Song.new(nil, "After The War").extend(representer).to_hash.must_equal({"title"=>"After The War"})
28
+ end
29
+
30
+ it "uses value from represented object when emtpy string" do
31
+ Song.new(nil, "").extend(representer).to_hash.must_equal({"title"=>""})
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,93 @@
1
+ require 'test_helper'
2
+
3
+ class DefaultsOptionsTest < BaseTest
4
+ let (:format) { :hash }
5
+ let (:song) { Struct.new(:title, :author_name, :song_volume, :description).new("Revolution", "Some author", 20, nil) }
6
+ let (:prepared) { representer.prepare song }
7
+
8
+ describe "hash options combined with dynamic options" do
9
+ representer! do
10
+ defaults render_nil: true do |name|
11
+ { as: name.to_s.upcase }
12
+ end
13
+
14
+ property :title
15
+ property :author_name
16
+ property :description
17
+ property :song_volume
18
+ end
19
+
20
+ it { render(prepared).must_equal_document({"TITLE" => "Revolution", "AUTHOR_NAME" => "Some author", "DESCRIPTION" => nil, "SONG_VOLUME" => 20}) }
21
+ end
22
+
23
+ describe "with only dynamic property options" do
24
+ representer! do
25
+ defaults do |name|
26
+ { as: name.to_s.upcase }
27
+ end
28
+
29
+ property :title
30
+ property :author_name
31
+ property :description
32
+ property :song_volume
33
+ end
34
+
35
+ it { render(prepared).must_equal_document({"TITLE" => "Revolution", "AUTHOR_NAME" => "Some author", "SONG_VOLUME" => 20}) }
36
+ end
37
+
38
+ describe "with only hashes" do
39
+ representer! do
40
+ defaults render_nil: true
41
+
42
+ property :title
43
+ property :author_name
44
+ property :description
45
+ property :song_volume
46
+ end
47
+
48
+ it { render(prepared).must_equal_document({"title" => "Revolution", "author_name" => "Some author", "description" => nil, "song_volume" => 20}) }
49
+ end
50
+
51
+ describe "direct defaults hash" do
52
+ representer! do
53
+ defaults render_nil: true
54
+
55
+ property :title
56
+ property :author_name
57
+ property :description
58
+ property :song_volume
59
+ end
60
+
61
+ it { render(prepared).must_equal_document({"title" => "Revolution", "author_name" => "Some author", "description" => nil, "song_volume" => 20}) }
62
+ end
63
+
64
+ describe "direct defaults hash with dynamic options" do
65
+ representer! do
66
+ defaults render_nil: true do |name|
67
+ { as: name.to_s.upcase }
68
+ end
69
+
70
+ property :title
71
+ property :author_name
72
+ property :description
73
+ property :song_volume
74
+ end
75
+
76
+ it { render(prepared).must_equal_document({"TITLE" => "Revolution", "AUTHOR_NAME" => "Some author", "DESCRIPTION" => nil, "SONG_VOLUME" => 20}) }
77
+ end
78
+
79
+ describe "prioritizes specific options" do
80
+ representer! do
81
+ defaults render_nil: true do |name|
82
+ { as: name.to_s.upcase }
83
+ end
84
+
85
+ property :title
86
+ property :author_name
87
+ property :description, render_nil: false
88
+ property :song_volume, as: :volume
89
+ end
90
+
91
+ it { render(prepared).must_equal_document({"TITLE" => "Revolution", "AUTHOR_NAME" => "Some author", "volume" => 20}) }
92
+ end
93
+ end
@@ -14,14 +14,15 @@ class DefinitionTest < MiniTest::Spec
14
14
  options[:parse_filter] << 1
15
15
 
16
16
  # default variables
17
- options[:as].must_equal "song"
17
+ options[:as].must_equal nil
18
18
  options[:extend].must_equal Module
19
19
  end
20
+ definition.name.must_equal "song"
20
21
 
21
22
  #
22
23
  definition[:awesome].must_equal true
23
- definition[:parse_filter].instance_variable_get(:@value).must_equal Representable::Pipeline[1]
24
- definition[:render_filter].instance_variable_get(:@value).must_equal Representable::Pipeline[]
24
+ definition[:parse_filter].must_equal Representable::Pipeline[1]
25
+ definition[:render_filter].must_equal Representable::Pipeline[]
25
26
  end
26
27
  end
27
28
 
@@ -62,8 +63,8 @@ class DefinitionTest < MiniTest::Spec
62
63
 
63
64
  definition[:awesome].must_equal true
64
65
  definition[:something].must_equal true
65
- definition[:render_filter].instance_variable_get(:@value).must_equal Representable::Pipeline[1]
66
- definition[:parse_filter].instance_variable_get(:@value).must_equal Representable::Pipeline[]
66
+ definition[:render_filter].must_equal Representable::Pipeline[1]
67
+ definition[:parse_filter].must_equal Representable::Pipeline[]
67
68
  end
68
69
 
69
70
  describe "with :parse_filter" do
@@ -73,12 +74,12 @@ class DefinitionTest < MiniTest::Spec
73
74
  it do
74
75
  merged = definition.merge!(:parse_filter => 2)[:parse_filter]
75
76
 
76
- merged.instance_variable_get(:@value).must_be_kind_of Representable::Pipeline
77
- merged.instance_variable_get(:@value).size.must_equal 2
77
+ merged.must_be_kind_of Representable::Pipeline
78
+ merged.size.must_equal 2
78
79
  end
79
80
 
80
81
  # :parse_filter can also be array.
81
- it { definition.merge!(:parse_filter => [2, 3])[:parse_filter].instance_variable_get(:@value).size.must_equal 3 }
82
+ it { definition.merge!(:parse_filter => [2, 3])[:parse_filter].size.must_equal 3 }
82
83
  end
83
84
 
84
85
  # does not change arguments
@@ -100,7 +101,7 @@ class DefinitionTest < MiniTest::Spec
100
101
 
101
102
  # #inspect
102
103
  describe "#inspect" do
103
- it { Definition.new(:songs).inspect.must_equal "#<Representable::Definition ==>songs @options={:parse_filter=>[], :render_filter=>[], :as=>\"songs\"}>" }
104
+ it { Definition.new(:songs).inspect.must_equal "#<Representable::Definition ==>songs @options={:name=>\"songs\", :parse_filter=>[], :render_filter=>[]}>" }
104
105
  end
105
106
 
106
107
 
@@ -154,6 +155,14 @@ class DefinitionTest < MiniTest::Spec
154
155
  assert_equal :"songs=", @def.setter
155
156
  end
156
157
 
158
+ describe "nested: FIXME" do
159
+ it do
160
+ dfn = Representable::Definition.new(:songs, nested: Module)
161
+ assert dfn.typed?
162
+ dfn[:extend].(nil).must_equal Module
163
+ end
164
+ end
165
+
157
166
 
158
167
  describe "#clone" do
159
168
  subject { Representable::Definition.new(:title, :volume => 9, :clonable => Uber::Options::Value.new(1)) }
@@ -170,34 +179,6 @@ class DefinitionTest < MiniTest::Spec
170
179
  assert_equal @def[:volume], 9
171
180
  assert_equal cloned[:volume], 8
172
181
  end
173
-
174
- # cloning of Cloneables in @options.
175
- it do
176
- definition = Representable::Definition.new(:title)
177
- definition.merge!(deserializer: Representable::Inheritable::Hash.new)
178
-
179
- clone = definition.clone
180
- clone[:deserializer].merge!(b: 2)
181
-
182
- definition[:deserializer].object_id.wont_equal clone[:deserializer].object_id
183
- end
184
-
185
- # pipeline gets cloned properly
186
- describe "pipeline cloning" do
187
- subject { Definition.new(:title, :render_filter => 1) }
188
-
189
- it ("yy")do
190
- cloned = subject.clone
191
-
192
- cloned.merge!(:render_filter => 2)
193
-
194
- subject.instance_variable_get(:@options)[:render_filter].must_equal [1]
195
- cloned.instance_variable_get(:@options)[:render_filter].must_equal [1,2]
196
-
197
- subject[:render_filter].instance_variable_get(:@value).must_equal [1]
198
- cloned[:render_filter].instance_variable_get(:@value).must_equal [1,2]
199
- end
200
- end
201
182
  end
202
183
  end
203
184
 
@@ -225,8 +206,7 @@ class DefinitionTest < MiniTest::Spec
225
206
  describe "#create_binding" do
226
207
  it "executes the block (without special context)" do
227
208
  definition = Representable::Definition.new(:title, :binding => lambda { |*args| @binding = Representable::Binding.new(*args) })
228
- definition.create_binding(object=Object.new).must_equal @binding
229
- @binding.instance_variable_get(:@parent_decorator).must_equal object
209
+ definition.create_binding.must_equal @binding
230
210
  end
231
211
  end
232
212