test/definition_test.rb in representable-0.9.2 vs test/definition_test.rb in representable-0.9.3
- old
+ new
@@ -7,11 +7,10 @@
end
it "responds to #typed?" do
assert ! @def.typed?
assert Representable::Definition.new(:songs, :as => Hash).typed?
- assert Representable::Definition.new(:songs, :as => [Hash]).typed?
end
it "responds to #getter and returns string" do
assert_equal "songs", @def.getter
end
@@ -39,44 +38,32 @@
@d = Representable::Definition.new(:song)
assert_equal 2, @d.apply(1) { |v| v+1 }
end
it "works with collection" do
- @d = Representable::Definition.new(:song, :as => [])
+ @d = Representable::Definition.new(:song, :collection => true)
assert_equal [2,3,4], @d.apply([1,2,3]) { |v| v+1 }
end
it "skips with collection and nil" do
- @d = Representable::Definition.new(:song, :as => [])
+ @d = Representable::Definition.new(:song, :collection => true)
assert_equal nil, @d.apply(nil) { |v| v+1 }
end
end
- describe ":as => []" do
+ describe ":collection => true" do
before do
- @def = Representable::Definition.new(:songs, :as => [], :tag => :song)
+ @def = Representable::Definition.new(:songs, :collection => true, :tag => :song)
end
it "responds to #array?" do
assert @def.array?
end
it "responds to #sought_type" do
assert_equal :text, @def.sought_type
end
end
-
-
- describe ":as => [Item]" do
- before do
- @def = Representable::Definition.new(:songs, :as => [Hash])
- end
-
- it "responds to #sought_type" do
- assert_equal Hash, @def.sought_type
- end
- end
-
describe ":as => Item" do
before do
@def = Representable::Definition.new(:songs, :as => Hash)
end