Skip to content

Commit

Permalink
Adding in the pending spec for #656
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Aug 5, 2011
1 parent b6d3437 commit ab10be8
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions spec/functional/mongoid/relations/referenced/many_to_many_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1844,4 +1844,36 @@
)
end
end

pending "when the parent is not a new record and freshly loaded" do

let(:person) do
Person.create(:ssn => "437-11-1110")
end

let(:preference) do
Preference.new
end

before do
person.preferences = [ preference ]
person.save
# person.reload
person.preferences = nil
end

it "sets the relation to an empty array" do
person.preferences.should be_empty
end

it "removes the foreign key values" do
person.preference_ids.should be_empty
end

it "deletes the target from the database" do
expect {
preference.reload
}.to raise_error(Mongoid::Errors::DocumentNotFound)
end
end
end

0 comments on commit ab10be8

Please sign in to comment.