aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/base_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-10-06 00:49:58 +0000
committerMichael Koziarski <michael@koziarski.com>2007-10-06 00:49:58 +0000
commit638505b90f593c8ee48a060f378ed6a9c93442e1 (patch)
tree6a4e7ecf398429d16ec58e515255f2f43fa6baa4 /activerecord/test/base_test.rb
parent4db718e2bb514be7a2e76e56cb5027c4007528b4 (diff)
downloadrails-638505b90f593c8ee48a060f378ed6a9c93442e1.tar.gz
rails-638505b90f593c8ee48a060f378ed6a9c93442e1.tar.bz2
rails-638505b90f593c8ee48a060f378ed6a9c93442e1.zip
Send the correct INSERT statement when dealing with objects with only primary keys. Closes #9523 [tarmo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7753 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/base_test.rb')
-rwxr-xr-xactiverecord/test/base_test.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index 4418b8d9e6..53ef4a5e86 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -11,6 +11,7 @@ require 'fixtures/column_name'
require 'fixtures/subscriber'
require 'fixtures/keyboard'
require 'fixtures/post'
+require 'fixtures/minimalistic'
class Category < ActiveRecord::Base; end
class Smarts < ActiveRecord::Base; end
@@ -64,7 +65,7 @@ class TopicWithProtectedContentAndAccessibleAuthorName < ActiveRecord::Base
end
class BasicsTest < Test::Unit::TestCase
- fixtures :topics, :companies, :developers, :projects, :computers, :accounts
+ fixtures :topics, :companies, :developers, :projects, :computers, :accounts, :minimalistics
def test_table_exists
assert !NonExistentTable.table_exists?
@@ -184,6 +185,15 @@ class BasicsTest < Test::Unit::TestCase
assert_nil topic.title
end
+ def test_save_for_record_with_only_primary_key
+ minimalistic = Minimalistic.new
+ assert_nothing_raised { minimalistic.save }
+ end
+
+ def test_save_for_record_with_only_primary_key_that_is_provided
+ assert_nothing_raised { Minimalistic.create!(:id => 2) }
+ end
+
def test_hashes_not_mangled
new_topic = { :title => "New Topic" }
new_topic_values = { :title => "AnotherTopic" }
@@ -240,6 +250,11 @@ class BasicsTest < Test::Unit::TestCase
topicReloaded.send :write_attribute, 'does_not_exist', 'test'
assert_nothing_raised { topicReloaded.save }
end
+
+ def test_update_for_record_with_only_primary_key
+ minimalistic = minimalistics(:first)
+ assert_nothing_raised { minimalistic.save }
+ end
def test_write_attribute
topic = Topic.new