So, I am writing an rspec test. It will check if the model is duplicated correctly. So the specification looks something like this:
it "should copy the data" do @model = build(:model) @another_model.copy_data(@model) @model.data.should == @another_model.data end
Data is an embedded document, so it is duplicated when I do this. All model attributes are copied successfully minus id and date created_at. Is there a way to do something like this?
@model.data.attributes.without(:_id, :created_at).should == @another_model.data.attributes.without(:_id, :created_at)
Or vice versa, where do I select all other fields without id and created_at?
Thanks!
source share