1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/store_test.rb
Jon Leighton 4f20eb5908 Fix typo
2011-11-30 23:18:40 +00:00

34 lines
854 B
Ruby

require 'cases/helper'
require 'models/admin'
require 'models/admin/user'
class StoreTest < ActiveRecord::TestCase
setup do
@john = Admin::User.create(:name => 'John Doe', :color => 'black')
end
test "reading store attributes through accessors" do
assert_equal 'black', @john.color
assert_nil @john.homepage
end
test "writing store attributes through accessors" do
@john.color = 'red'
@john.homepage = '37signals.com'
assert_equal 'red', @john.color
assert_equal '37signals.com', @john.homepage
end
test "accessing attributes not exposed by accessors" do
@john.settings[:icecream] = 'graeters'
@john.save
assert_equal 'graeters', @john.reload.settings[:icecream]
end
test "updating the store will mark it as changed" do
@john.color = 'red'
assert @john.settings_changed?
end
end