From 32a2fe3bce49e88a1417591e2dc552d9c114508d Mon Sep 17 00:00:00 2001 From: Zach Dennis Date: Sat, 19 Mar 2011 15:19:50 -0400 Subject: [PATCH] Adding a test to ensure that specified ids are being saved when imported. https://github.com/zdennis/activerecord-import/issues#issue/4 --- test/import_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/import_test.rb b/test/import_test.rb index 4512c6d..3c3fd5e 100644 --- a/test/import_test.rb +++ b/test/import_test.rb @@ -142,6 +142,13 @@ describe "#import" do end end + context "with an array of columns and an array of values" do + it "should import ids when specified" do + Topic.import [:id, :author_name, :title], [[99, "Bob Jones", "Topic 99"]] + assert_equal 99, Topic.last.id + end + end + context "ActiveRecord timestamps" do context "when the timestamps columns are present" do setup do @@ -217,5 +224,4 @@ describe "#import" do assert_equal "05/14/2010".to_date, Topic.last.last_read.to_date end end - end \ No newline at end of file