test/definition_test.rb in representable-0.10.2 vs test/definition_test.rb in representable-0.10.3
- old
+ new
@@ -60,17 +60,33 @@
end
it "responds to #sought_type" do
assert_equal :text, @def.sought_type
end
+
+ it "responds to #default" do
+ assert_equal [], @def.default
+ 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 ":default => value" do
+ it "responds to #default" do
+ @def = Representable::Definition.new(:song)
+ assert_equal nil, @def.default
+ end
+
+ it "accepts a default value" do
+ @def = Representable::Definition.new(:song, :default => "Atheist Peace")
+ assert_equal "Atheist Peace", @def.default
end
end
end