blob: fb7722087592c9d2ef25f98b6d80b69a2694022b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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 'graeters', @john.reload.settings[:icecream]
end
end
|