Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix AR#update_columns tests on Ruby 1.8.7

  • Loading branch information...
commit 17a64de4980683da3ca3c185205013a29a8cf88d 1 parent def9c85
Carlos Antonio da Silva carlosantoniodasilva authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 activerecord/test/cases/persistence_test.rb
14 activerecord/test/cases/persistence_test.rb
View
@@ -526,7 +526,7 @@ def test_update_column_with_one_changed_and_one_updated
def test_update_columns
topic = Topic.find(1)
- topic.update_columns({ "approved" => true, title: "Sebastian Topic" })
+ topic.update_columns("approved" => true, :title => "Sebastian Topic")
assert topic.approved?
assert_equal "Sebastian Topic", topic.title
topic.reload
@@ -536,19 +536,19 @@ def test_update_columns
def test_update_columns_should_raise_exception_if_new_record
topic = Topic.new
- assert_raises(ActiveRecord::ActiveRecordError) { topic.update_columns({ approved: false }) }
+ assert_raises(ActiveRecord::ActiveRecordError) { topic.update_columns(:approved => false) }
end
def test_update_columns_should_not_leave_the_object_dirty
topic = Topic.find(1)
- topic.update_attributes({ "content" => "Have a nice day", :author_name => "Jose" })
+ topic.update_attributes("content" => "Have a nice day", :author_name => "Jose")
topic.reload
- topic.update_columns({ content: "You too", "author_name" => "Sebastian" })
+ topic.update_columns(:content => "You too", "author_name" => "Sebastian")
assert_equal [], topic.changed
topic.reload
- topic.update_columns({ content: "Have a nice day", author_name: "Jose" })
+ topic.update_columns(:content => "Have a nice day", :author_name => "Jose")
assert_equal [], topic.changed
end
@@ -556,7 +556,7 @@ def test_update_columns_with_one_readonly_attribute
minivan = Minivan.find('m1')
prev_color = minivan.color
prev_name = minivan.name
- assert_raises(ActiveRecord::ActiveRecordError) { minivan.update_columns({ name: "My old minivan", color: 'black' }) }
+ assert_raises(ActiveRecord::ActiveRecordError) { minivan.update_columns(:name => "My old minivan", :color => 'black') }
assert_equal prev_color, minivan.color
assert_equal prev_name, minivan.name
@@ -572,7 +572,7 @@ def test_update_columns_should_not_modify_updated_at
developer.update_column(:updated_at, prev_month)
assert_equal prev_month, developer.updated_at
- developer.update_columns({ salary: 80000 })
+ developer.update_columns(:salary => 80000)
assert_equal prev_month, developer.updated_at
assert_equal 80000, developer.salary

1 comment on commit 17a64de

Philip Arndt

Good catch :+1: I've been using Ruby 1.9 hashes so much lately I didn't even notice!

Please sign in to comment.
Something went wrong with that request. Please try again.