diff --git a/test/import_test.rb b/test/import_test.rb index d89c5de..d25e069 100644 --- a/test/import_test.rb +++ b/test/import_test.rb @@ -19,6 +19,16 @@ describe "#import" do end end + describe "with non-default ActiveRecord models" do + context "that have a non-standard primary key (that is no sequence)" do + it "should import models successfully" do + assert_difference "Widget.count", +3 do + Widget.import Build(3, :widgets) + end + end + end + end + context "with :validation option" do let(:columns) { %w(title author_name) } let(:valid_values) { [[ "LDAP", "Jerry Carter"], ["Rails Recipes", "Chad Fowler"]] } diff --git a/test/models/widget.rb b/test/models/widget.rb new file mode 100644 index 0000000..15bea59 --- /dev/null +++ b/test/models/widget.rb @@ -0,0 +1,3 @@ +class Widget < ActiveRecord::Base + self.primary_key = :w_id +end \ No newline at end of file diff --git a/test/postgresql/import_test.rb b/test/postgresql/import_test.rb index 0dec7e3..45e97ef 100644 --- a/test/postgresql/import_test.rb +++ b/test/postgresql/import_test.rb @@ -17,9 +17,4 @@ describe "#import" do assert_equal 1, result.num_inserts end end - - it "should import models whose primary key has no sequence if the primary key's value is specified" do - result = Widget.import Build(3, :widgets) - assert_equal 1, result.num_inserts - end end