Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add update image spec

  • Loading branch information...
commit de0d423d5c924c4ffab24459724125f281fd2d4a 1 parent 2ddedb1
@aklaiber aklaiber authored rmm5t committed
Showing with 8 additions and 1 deletion.
  1. +8 −1 spec/mongoid_spec.rb
View
9 spec/mongoid_spec.rb
@@ -676,7 +676,7 @@ def filename
end
@class.class_eval do
- embeds_many :mongo_locations
+ embeds_many :mongo_locations, cascade_callbacks: true
accepts_nested_attributes_for :mongo_locations
end
@@ -690,6 +690,13 @@ def filename
@doc.mongo_locations.first.image.path.should match(/old\.jpeg$/)
@embedded_doc.image.path.should match(/old\.jpeg$/)
end
+
+ it "should update the image on update_attributes" do
+ @doc.update_attributes(mongo_locations_attributes: [{id: @embedded_doc.id, image: stub_file("new.jpeg")}]).should be_true
+ @doc.reload
+ @doc.mongo_locations.first.image.path.should match(/new\.jpeg$/)
+ @embedded_doc.image.path.should match(/new\.jpeg$/)
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.