Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/spec/functional/embedded_document_spec.rb b/spec/functional/embedded_document_spec.rb
index 22112d5..166eefe 100644
--- a/spec/functional/embedded_document_spec.rb
+++ b/spec/functional/embedded_document_spec.rb
@@ -9,6 +9,7 @@ describe "EmbeddedDocument" do
@pet_klass = EDoc('Pet') do
key :name, String
+ key :flag, Boolean
end
@klass.many :pets, :class => @pet_klass
@@ -294,4 +295,20 @@ describe "EmbeddedDocument" do
pets[0].name.should == "Sasha"
end
end
-end
\ No newline at end of file
+
+ it "should pass but fails" do
+ person = @klass.create(:pets => [@pet_klass.new(:name => 'Rasmus', :flag => true)])
+ person.update_attributes!({"pets" => ["name" => "sparky", "flag" => "false"]})
+ person.reload
+ person.pets.first.name.should == "sparky"
+ person.pets.first.flag.should be_false # THIS FAILS
+ end
+
+ it "passes" do
+ person = @klass.create(:pets => [@pet_klass.new(:name => 'Rasmus', :flag => true)])
+ person.update_attributes!({pets: [:name => "sparky", :flag => "false"]})
+ person.reload
+ person.pets.first.name.should == "sparky"
+ person.pets.first.flag.should be_false
+ end
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment