Permalink
Browse files

Add failing test for destroyed records.

Also, generalize the previous test to use persisted? rather than !new_record?.
  • Loading branch information...
1 parent 31ff20a commit 413e35feddd8f86d16bfdab6b8291986ba2a8014 @dougo dougo committed with Sep 3, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 test/import_test.rb
View
@@ -135,7 +135,17 @@
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

0 comments on commit 413e35f

Please sign in to comment.