representable 3.0.3 → 3.0.4

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -1
  3. data/CHANGES.md +5 -0
  4. data/README.md +1 -1
  5. data/TODO +1 -3
  6. data/TODO-4.0.md +72 -0
  7. data/lib/representable/declarative.rb +3 -3
  8. data/lib/representable/deserializer.rb +1 -1
  9. data/lib/representable/serializer.rb +1 -1
  10. data/lib/representable/version.rb +1 -1
  11. data/lib/representable/xml.rb +6 -4
  12. data/lib/representable/xml/binding.rb +19 -12
  13. data/lib/representable/xml/namespace.rb +122 -0
  14. data/representable.gemspec +2 -2
  15. data/test/as_test.rb +2 -2
  16. data/test/binding_test.rb +7 -7
  17. data/test/cached_test.rb +13 -13
  18. data/test/class_test.rb +2 -2
  19. data/test/coercion_test.rb +1 -1
  20. data/test/config_test.rb +5 -5
  21. data/test/decorator_scope_test.rb +1 -1
  22. data/test/decorator_test.rb +8 -8
  23. data/test/default_test.rb +1 -1
  24. data/test/defaults_options_test.rb +3 -3
  25. data/test/definition_test.rb +9 -11
  26. data/test/examples/object.rb +1 -5
  27. data/test/exec_context_test.rb +2 -2
  28. data/test/features_test.rb +3 -3
  29. data/test/filter_test.rb +2 -2
  30. data/test/for_collection_test.rb +8 -8
  31. data/test/generic_test.rb +11 -11
  32. data/test/hash_bindings_test.rb +1 -1
  33. data/test/hash_test.rb +13 -13
  34. data/test/heritage_test.rb +16 -13
  35. data/test/if_test.rb +3 -3
  36. data/test/include_exclude_test.rb +2 -2
  37. data/test/inherit_test.rb +3 -3
  38. data/test/inline_test.rb +13 -13
  39. data/test/instance_test.rb +2 -2
  40. data/test/json_test.rb +4 -6
  41. data/test/lonely_test.rb +15 -15
  42. data/test/nested_test.rb +6 -6
  43. data/test/object_test.rb +4 -4
  44. data/test/parse_pipeline_test.rb +0 -2
  45. data/test/pipeline_test.rb +7 -7
  46. data/test/populator_test.rb +7 -7
  47. data/test/prepare_test.rb +2 -2
  48. data/test/represent_test.rb +10 -10
  49. data/test/representable_test.rb +7 -7
  50. data/test/schema_test.rb +3 -6
  51. data/test/skip_test.rb +6 -6
  52. data/test/test_helper.rb +16 -6
  53. data/test/wrap_test.rb +8 -8
  54. data/test/xml_namespace_test.rb +186 -0
  55. data/test/xml_test.rb +53 -34
  56. data/test/yaml_test.rb +11 -11
  57. metadata +9 -7
  58. data/lib/representable/TODO.getting_serious +0 -11
@@ -53,15 +53,15 @@ class CachedTest < MiniTest::Spec
53
53
 
54
54
 
55
55
  describe "serialization" do
56
- let (:album_hash) { {"name"=>"Louder And Even More Dangerous", "songs"=>[{"title"=>"Southbound:{:volume=>10}"}, {"title"=>"Jailbreak:{:volume=>10}"}]} }
56
+ let(:album_hash) { {"name"=>"Louder And Even More Dangerous", "songs"=>[{"title"=>"Southbound:{:volume=>10}"}, {"title"=>"Jailbreak:{:volume=>10}"}]} }
57
57
 
58
- let (:song) { Model::Song.new("Jailbreak") }
59
- let (:song2) { Model::Song.new("Southbound") }
60
- let (:album) { Model::Album.new("Live And Dangerous", [song, song2, Model::Song.new("Emerald")]) }
61
- let (:representer) { AlbumRepresenter.new(album) }
58
+ let(:song) { Model::Song.new("Jailbreak") }
59
+ let(:song2) { Model::Song.new("Southbound") }
60
+ let(:album) { Model::Album.new("Live And Dangerous", [song, song2, Model::Song.new("Emerald")]) }
61
+ let(:representer) { AlbumRepresenter.new(album) }
62
62
 
63
63
  it do
64
- album2 = Model::Album.new("Louder And Even More Dangerous", [song2, song])
64
+ # album2 = Model::Album.new("Louder And Even More Dangerous", [song2, song])
65
65
 
66
66
  # makes sure options are passed correctly.
67
67
  representer.to_hash(user_options: {volume: 9}).must_equal({"name"=>"Live And Dangerous",
@@ -81,20 +81,20 @@ class CachedTest < MiniTest::Spec
81
81
  data = Profiler.profile { representer.to_hash }
82
82
 
83
83
  # 3 songs get decorated.
84
- data.must_match /3\s*Representable::Function::Decorate#call/m
84
+ data.must_match(/3\s*Representable::Function::Decorate#call/m)
85
85
  # These weird Regexp bellow are a quick workaround to accomodate
86
86
  # the different profiler result formats.
87
87
  # - "3 <Class::Representable::Decorator>#prepare" -> At MRI Ruby
88
88
  # - "3 Representable::Decorator.prepare" -> At JRuby
89
89
 
90
90
  # 3 nested decorator is instantiated for 3 Songs, though.
91
- data.must_match /3\s*(<Class::)?Representable::Decorator\>?[\#.]prepare/m
91
+ data.must_match(/3\s*(<Class::)?Representable::Decorator\>?[\#.]prepare/m)
92
92
  # no Binding is instantiated at runtime.
93
93
  data.wont_match "Representable::Binding#initialize"
94
94
  # 2 mappers for Album, Song
95
95
  # data.must_match "2 Representable::Mapper::Methods#initialize"
96
96
  # title, songs, 3x title, composer
97
- data.must_match /8\s*Representable::Binding[#\.]render_pipeline/m
97
+ data.must_match(/8\s*Representable::Binding[#\.]render_pipeline/m)
98
98
  data.wont_match "render_functions"
99
99
  data.wont_match "Representable::Binding::Factories#render_functions"
100
100
  end
@@ -102,7 +102,7 @@ class CachedTest < MiniTest::Spec
102
102
 
103
103
 
104
104
  describe "deserialization" do
105
- let (:album_hash) {
105
+ let(:album_hash) {
106
106
  {
107
107
  "name"=>"Louder And Even More Dangerous",
108
108
  "songs"=>[
@@ -125,7 +125,7 @@ class CachedTest < MiniTest::Spec
125
125
  album.songs[1].title.must_equal "Jailbreak"
126
126
  album.songs[1].composer.name.must_equal "Phil Lynott"
127
127
  album.songs[2].title.must_equal "Emerald"
128
- album.songs[2].composer.must_equal nil
128
+ album.songs[2].composer.must_be_nil
129
129
 
130
130
  # TODO: test options.
131
131
  end
@@ -139,12 +139,12 @@ class CachedTest < MiniTest::Spec
139
139
  # only 2 nested decorators are instantiated, Song, and Artist.
140
140
  # Didn't like the regexp?
141
141
  # MRI and JRuby has different output formats. See note above.
142
- data.must_match /5\s*(<Class::)?Representable::Decorator>?[#\.]prepare/
142
+ data.must_match(/5\s*(<Class::)?Representable::Decorator>?[#\.]prepare/)
143
143
  # a total of 5 properties in the object graph.
144
144
  data.wont_match "Representable::Binding#initialize"
145
145
 
146
146
  data.wont_match "parse_functions" # no pipeline creation.
147
- data.must_match /10\s*Representable::Binding[#\.]parse_pipeline/
147
+ data.must_match(/10\s*Representable::Binding[#\.]parse_pipeline/)
148
148
  # three mappers for Album, Song, composer
149
149
  # data.must_match "3 Representable::Mapper::Methods#initialize"
150
150
  # # 6 deserializers as the songs collection uses 2.
@@ -54,7 +54,7 @@ class ClassTest < BaseTest
54
54
 
55
55
 
56
56
  describe "lambda receiving fragment and args" do
57
- let (:klass) { Class.new do
57
+ let(:klass) { Class.new do
58
58
  class << self
59
59
  attr_accessor :args
60
60
  end
@@ -75,7 +75,7 @@ class ClassTest < BaseTest
75
75
 
76
76
 
77
77
  describe "collection: lambda receiving fragment and args" do
78
- let (:klass) { Class.new do
78
+ let(:klass) { Class.new do
79
79
  class << self
80
80
  attr_accessor :args
81
81
  end
@@ -17,7 +17,7 @@ class VirtusCoercionTest < MiniTest::Spec
17
17
  end
18
18
  end
19
19
 
20
- let (:album) { OpenStruct.new(:title => "Dire Straits", :length => 41.34,
20
+ let(:album) { OpenStruct.new(:title => "Dire Straits", :length => 41.34,
21
21
  :band => OpenStruct.new(:founded => "1977"),
22
22
  :songs => [OpenStruct.new(:ok => 1), OpenStruct.new(:ok => 0)]) }
23
23
 
@@ -7,7 +7,7 @@ class ConfigTest < MiniTest::Spec
7
7
 
8
8
  describe "wrapping" do
9
9
  it "returns false per default" do
10
- assert_equal nil, subject.wrap_for("Punk", nil)
10
+ assert_nil subject.wrap_for("Punk", nil)
11
11
  end
12
12
 
13
13
  # it "infers a printable class name if set to true" do
@@ -23,13 +23,13 @@ class ConfigTest < MiniTest::Spec
23
23
 
24
24
  describe "#[]" do
25
25
  # does return nil for non-existent
26
- it { subject[:hello].must_equal nil }
26
+ it { subject[:hello].must_be_nil }
27
27
  end
28
28
 
29
29
  # describe "#[]" do
30
30
  # before { subject.add(:title, {:me => true}) }
31
31
 
32
- # it { subject[:unknown].must_equal nil }
32
+ # it { subject[:unknown].must_be_nil }
33
33
  # it { subject.get(:title)[:me].must_equal true }
34
34
  # it { subject["title"][:me].must_equal true }
35
35
  # end
@@ -59,7 +59,7 @@ class ConfigTest < MiniTest::Spec
59
59
  # this is actually tested in context in inherit_test.
60
60
  it "overrides former definition" do
61
61
  subject.add(:title, {:peer => Module})
62
- subject.get(:title)[:me].must_equal nil
62
+ subject.get(:title)[:me].must_be_nil
63
63
  subject.get(:title)[:peer].must_equal Module
64
64
  end
65
65
 
@@ -84,7 +84,7 @@ class ConfigTest < MiniTest::Spec
84
84
  subject.get(:genre).must_be_kind_of Representable::Definition
85
85
 
86
86
  subject.remove(:genre)
87
- subject.get(:genre).must_equal nil
87
+ subject.get(:genre).must_be_nil
88
88
  end
89
89
  end
90
90
 
@@ -6,7 +6,7 @@ class DecoratorScopeTest < MiniTest::Spec
6
6
  property :title, :getter => lambda { |*| title_from_representer }, :decorator_scope => true
7
7
  end
8
8
 
9
- let (:representer_with_method) {
9
+ let(:representer_with_method) {
10
10
  Module.new do
11
11
  include Representable::Hash
12
12
  property :title, :decorator_scope => true
@@ -19,13 +19,13 @@ class DecoratorTest < MiniTest::Spec
19
19
  property :value
20
20
  end
21
21
 
22
- let (:song) { Song.new("Mama, I'm Coming Home") }
23
- let (:album) { Album.new([song]) }
22
+ let(:song) { Song.new("Mama, I'm Coming Home") }
23
+ let(:album) { Album.new([song]) }
24
24
 
25
- let (:rating) { OpenStruct.new(system: 'MPAA', value: 'R') }
25
+ let(:rating) { OpenStruct.new(system: 'MPAA', value: 'R') }
26
26
 
27
27
  describe "inheritance" do
28
- let (:inherited_decorator) do
28
+ let(:inherited_decorator) do
29
29
  Class.new(AlbumRepresentation) do
30
30
  property :best_song
31
31
  end.new(Album.new([song], "Stand Up"))
@@ -34,7 +34,7 @@ class DecoratorTest < MiniTest::Spec
34
34
  it { inherited_decorator.to_hash.must_equal({"songs"=>[{"name"=>"Mama, I'm Coming Home"}], "best_song"=>"Stand Up"}) }
35
35
  end
36
36
 
37
- let (:decorator) { AlbumRepresentation.new(album) }
37
+ let(:decorator) { AlbumRepresentation.new(album) }
38
38
 
39
39
  let(:rating_decorator) { RatingRepresentation.new(rating) }
40
40
 
@@ -43,7 +43,7 @@ class DecoratorTest < MiniTest::Spec
43
43
  album.wont_respond_to :to_hash
44
44
  song.wont_respond_to :to_hash # DISCUSS: weak test, how to assert blank slate?
45
45
  # no @representable_attrs in decorated objects
46
- song.instance_variable_get(:@representable_attrs).must_equal nil
46
+ song.wont_be(:instance_variable_defined?, :@representable_attrs)
47
47
 
48
48
  rating_decorator.to_hash.must_equal({"system" => "MPAA", "value" => "R"})
49
49
  end
@@ -80,8 +80,8 @@ class DecoratorTest < MiniTest::Spec
80
80
  representer.new(album).from_hash({"songs"=>[{"name"=>"Atomic Garden"}]})
81
81
 
82
82
  # no @representable_attrs in decorated objects
83
- song.instance_variable_get(:@representable_attrs).must_equal nil
84
- album.instance_variable_get(:@representable_attrs).must_equal nil
83
+ song.wont_be(:instance_variable_defined?, :@representable_attrs)
84
+ album.wont_be(:instance_variable_defined?, :@representable_attrs)
85
85
  end
86
86
  end
87
87
  end
@@ -9,7 +9,7 @@ class DefaultTest < MiniTest::Spec
9
9
  end
10
10
 
11
11
  describe "#from_hash" do
12
- let (:song) { Song.new.extend(representer) }
12
+ let(:song) { Song.new.extend(representer) }
13
13
 
14
14
  it { song.from_hash({}).must_equal Song.new(nil, "Huber Breeze") }
15
15
  # default doesn't apply when empty string.
@@ -1,9 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
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 }
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
7
 
8
8
  describe "hash options combined with dynamic options" do
9
9
  representer! do
@@ -6,15 +6,13 @@ class DefinitionTest < MiniTest::Spec
6
6
  # TODO: test that we DON'T clone options, that must happen in
7
7
  describe "#initialize" do
8
8
  it do
9
- opts = nil
10
-
11
9
  # new yields the defaultized options HASH.
12
10
  definition = Definition.new(:song, :extend => Module) do |options|
13
11
  options[:awesome] = true
14
12
  options[:parse_filter] << 1
15
13
 
16
14
  # default variables
17
- options[:as].must_equal nil
15
+ options[:as].must_be_nil
18
16
  options[:extend].must_equal Module
19
17
  end
20
18
  definition.name.must_equal "song"
@@ -27,14 +25,14 @@ class DefinitionTest < MiniTest::Spec
27
25
  end
28
26
 
29
27
  describe "#[]" do
30
- let (:definition) { Definition.new(:song) }
28
+ let(:definition) { Definition.new(:song) }
31
29
  # default is nil.
32
- it { definition[:bla].must_equal nil }
30
+ it { definition[:bla].must_be_nil }
33
31
  end
34
32
 
35
33
  # merge!
36
34
  describe "#merge!" do
37
- let (:definition) { Definition.new(:song, :whatever => true) }
35
+ let(:definition) { Definition.new(:song, :whatever => true) }
38
36
 
39
37
  # merges new options.
40
38
  it { definition.merge!(:something => true)[:something].must_equal true }
@@ -61,7 +59,7 @@ class DefinitionTest < MiniTest::Spec
61
59
  end
62
60
 
63
61
  describe "with :parse_filter" do
64
- let (:definition) { Definition.new(:title, :parse_filter => 1) }
62
+ let(:definition) { Definition.new(:title, :parse_filter => 1) }
65
63
 
66
64
  # merges :parse_filter and :render_filter.
67
65
  it do
@@ -85,11 +83,11 @@ class DefinitionTest < MiniTest::Spec
85
83
 
86
84
  # delete!
87
85
  describe "#delete!" do
88
- let (:definition) { Definition.new(:song, serialize: "remove me!") }
86
+ let(:definition) { Definition.new(:song, serialize: "remove me!") }
89
87
 
90
88
  before { definition[:serialize].(nil).must_equal "remove me!" }
91
89
 
92
- it { definition.delete!(:serialize)[:serialize].must_equal nil }
90
+ it { definition.delete!(:serialize)[:serialize].must_be_nil }
93
91
  end
94
92
 
95
93
  # #inspect
@@ -104,7 +102,7 @@ class DefinitionTest < MiniTest::Spec
104
102
  end
105
103
 
106
104
  it "responds to #representer_module" do
107
- assert_equal nil, Representable::Definition.new(:song).representer_module
105
+ assert_nil Representable::Definition.new(:song).representer_module
108
106
  assert_equal Hash, Representable::Definition.new(:song, :extend => Hash).representer_module
109
107
  end
110
108
 
@@ -217,7 +215,7 @@ class DefinitionTest < MiniTest::Spec
217
215
  describe ":default => value" do
218
216
  it "responds to #default" do
219
217
  @def = Representable::Definition.new(:song)
220
- assert_equal nil, @def[:default]
218
+ assert_nil @def[:default]
221
219
  end
222
220
 
223
221
  it "accepts a default value" do
@@ -7,8 +7,6 @@ require "pp"
7
7
  source = OpenStruct.new(name: "30 Years Live", songs: [
8
8
  OpenStruct.new(id: 1, title: "Dear Beloved"), OpenStruct.new(id: 2, title: "Fuck Armageddon")])
9
9
 
10
- pp source
11
-
12
10
  require "representable/object"
13
11
 
14
12
  class AlbumRepresenter < Representable::Decorator
@@ -26,6 +24,4 @@ Song = Struct.new(:title)
26
24
 
27
25
  target = Album.new
28
26
 
29
- AlbumRepresenter.new(target).from_object(source)
30
-
31
- pp target
27
+ AlbumRepresenter.new(target).from_object(source)
@@ -7,8 +7,8 @@ class ExecContextTest < MiniTest::Spec
7
7
  # :yaml => [Representable::YAML, "---\nsong:\n name: Alive\n", "---\nsong:\n name: You've Taken Everything\n"],
8
8
  ) do |format, mod, input, output|
9
9
 
10
- let (:song) { representer.prepare(Song.new("Timing")) }
11
- let (:format) { format }
10
+ let(:song) { representer.prepare(Song.new("Timing")) }
11
+ let(:format) { format }
12
12
 
13
13
 
14
14
  describe "exec_context: nil" do
@@ -20,11 +20,11 @@ class FeaturesTest < MiniTest::Spec
20
20
  end
21
21
  }
22
22
 
23
- let (:song) { OpenStruct.new(:details => Object.new) }
23
+ let(:song) { OpenStruct.new(:details => Object.new) }
24
24
 
25
25
  describe "Module" do
26
26
  representer! do
27
- instance_exec &definition
27
+ instance_exec(&definition)
28
28
  end
29
29
 
30
30
  it { song.extend(representer).to_hash.must_equal({"title"=>"Is It A Lie", "length"=>"2:31", "details"=>{"title"=>"Is It A Lie"}}) }
@@ -33,7 +33,7 @@ class FeaturesTest < MiniTest::Spec
33
33
 
34
34
  describe "Decorator" do
35
35
  representer!(:decorator => true) do
36
- instance_exec &definition
36
+ instance_exec(&definition)
37
37
  end
38
38
 
39
39
  it { representer.new(song).to_hash.must_equal({"title"=>"Is It A Lie", "length"=>"2:31", "details"=>{"title"=>"Is It A Lie"}}) }
@@ -1,8 +1,8 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class FilterPipelineTest < MiniTest::Spec
4
- let (:block1) { lambda { |input, options| "1: #{input}" } }
5
- let (:block2) { lambda { |input, options| "2: #{input}" } }
4
+ let(:block1) { lambda { |input, options| "1: #{input}" } }
5
+ let(:block2) { lambda { |input, options| "2: #{input}" } }
6
6
 
7
7
  subject { Representable::Pipeline[block1, block2] }
8
8
 
@@ -7,8 +7,8 @@ class ForCollectionTest < MiniTest::Spec
7
7
  property :name
8
8
  end
9
9
 
10
- let (:songs) { [Song.new("Days Go By"), Song.new("Can't Take Them All")] }
11
- let (:json) { "[{\"name\":\"Days Go By\"},{\"name\":\"Can't Take Them All\"}]" }
10
+ let(:songs) { [Song.new("Days Go By"), Song.new("Can't Take Them All")] }
11
+ let(:json) { "[{\"name\":\"Days Go By\"},{\"name\":\"Can't Take Them All\"}]" }
12
12
 
13
13
 
14
14
  # Module.for_collection
@@ -20,9 +20,9 @@ class ForCollectionTest < MiniTest::Spec
20
20
  ) do |format, mod, output, input|
21
21
 
22
22
  describe "Module::for_collection [#{format}]" do
23
- let (:format) { format }
23
+ let(:format) { format }
24
24
 
25
- let (:representer) {
25
+ let(:representer) {
26
26
  Module.new do
27
27
  include mod
28
28
  property :name#, :as => :title
@@ -40,9 +40,9 @@ class ForCollectionTest < MiniTest::Spec
40
40
  end
41
41
 
42
42
  describe "Module::for_collection without configuration [#{format}]" do
43
- let (:format) { format }
43
+ let(:format) { format }
44
44
 
45
- let (:representer) {
45
+ let(:representer) {
46
46
  Module.new do
47
47
  include mod
48
48
  property :name
@@ -55,8 +55,8 @@ class ForCollectionTest < MiniTest::Spec
55
55
 
56
56
 
57
57
  describe "Decorator::for_collection [#{format}]" do
58
- let (:format) { format }
59
- let (:representer) {
58
+ let(:format) { format }
59
+ let(:representer) {
60
60
  Class.new(Representable::Decorator) do
61
61
  include mod
62
62
  property :name
@@ -1,10 +1,10 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class GenericTest < MiniTest::Spec # TODO: rename/restructure to CollectionTest.
4
- let (:new_album) { OpenStruct.new.extend(representer) }
5
- let (:album) { OpenStruct.new(:songs => ["Fuck Armageddon"]).extend(representer) }
6
- let (:song) { OpenStruct.new(:title => "Resist Stance") }
7
- let (:song_representer) { Module.new do include Representable::Hash; property :title end }
4
+ let(:new_album) { OpenStruct.new.extend(representer) }
5
+ let(:album) { OpenStruct.new(:songs => ["Fuck Armageddon"]).extend(representer) }
6
+ let(:song) { OpenStruct.new(:title => "Resist Stance") }
7
+ let(:song_representer) { Module.new do include Representable::Hash; property :title end }
8
8
 
9
9
 
10
10
  describe "::collection" do
@@ -14,7 +14,7 @@ class GenericTest < MiniTest::Spec # TODO: rename/restructure to CollectionTest.
14
14
 
15
15
  it "doesn't initialize property" do
16
16
  new_album.from_hash({})
17
- new_album.songs.must_equal nil
17
+ new_album.songs.must_be_nil
18
18
  end
19
19
 
20
20
  it "leaves properties untouched" do
@@ -32,14 +32,14 @@ class GenericTest < MiniTest::Spec # TODO: rename/restructure to CollectionTest.
32
32
  ) do |format, mod, output, input|
33
33
 
34
34
  describe "nil collections" do
35
- let (:format) { format }
35
+ let(:format) { format }
36
36
 
37
37
  representer!(:module => mod) do
38
38
  collection :songs
39
39
  self.representation_wrap = :album if format == :xml
40
40
  end
41
41
 
42
- let (:album) { Album.new.extend(representer) }
42
+ let(:album) { Album.new.extend(representer) }
43
43
 
44
44
  it "doesn't render collection in #{format}" do
45
45
  render(album).must_equal_document output
@@ -55,14 +55,14 @@ class GenericTest < MiniTest::Spec # TODO: rename/restructure to CollectionTest.
55
55
  ) do |format, mod, output, input|
56
56
 
57
57
  describe "empty collections" do
58
- let (:format) { format }
58
+ let(:format) { format }
59
59
 
60
60
  representer!(:module => mod) do
61
61
  collection :songs
62
62
  self.representation_wrap = :album if format == :xml
63
63
  end
64
64
 
65
- let (:album) { OpenStruct.new(:songs => []).extend(representer) }
65
+ let(:album) { OpenStruct.new(:songs => []).extend(representer) }
66
66
 
67
67
  it "renders empty collection in #{format}" do
68
68
  render(album).must_equal_document output
@@ -79,14 +79,14 @@ class GenericTest < MiniTest::Spec # TODO: rename/restructure to CollectionTest.
79
79
  ) do |format, mod, output, input|
80
80
 
81
81
  describe "render_empty [#{format}]" do
82
- let (:format) { format }
82
+ let(:format) { format }
83
83
 
84
84
  representer!(:module => mod) do
85
85
  collection :songs, :render_empty => false
86
86
  self.representation_wrap = :album if format == :xml
87
87
  end
88
88
 
89
- let (:album) { OpenStruct.new(:songs => []).extend(representer) }
89
+ let(:album) { OpenStruct.new(:songs => []).extend(representer) }
90
90
 
91
91
  it { render(album).must_equal_document output }
92
92
  end