Add failing test for destroyed records.

Also, generalize the previous test to use persisted? rather than !new_record?.
master
Doug Orleans 2012-09-03 02:29:42 -04:00 committed by Zach Dennis
parent 31ff20a332
commit 413e35fedd
1 changed files with 11 additions and 1 deletions

View File

@ -135,7 +135,17 @@ describe "#import" do
it "reloads data for existing in-memory instances" do
Topic.import(new_topics, :synchronize => new_topics, :synchronize_keys => [:title] )
assert !new_topics.any?(&:new_record?), "Records should have been reloaded"
assert new_topics.all?(&:persisted?), "Records should have been reloaded"
end
end
context "synchronizing on destroyed records with explicit conditions" do
let(:new_topics) { Generate(3, :topics) }
it "reloads data for existing in-memory instances" do
new_topics.each &:destroy
Topic.import(new_topics, :synchronize => new_topics, :synchronize_keys => [:title] )
assert new_topics.all?(&:persisted?), "Records should have been reloaded"
end
end
end