]> git.openstreetmap.org Git - rails.git/blob - test/unit/user_preference_test.rb
First current node tag test
[rails.git] / test / unit / user_preference_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class UserPreferenceTest < ActiveSupport::TestCase
4   fixtures :users, :user_preferences
5
6   # This checks to make sure that there are two user preferences
7   # stored in the test database.
8   # This test needs to be updated for every addition/deletion from
9   # the fixture file
10   def test_check_count
11     assert_equal 2, UserPreference.count
12   end
13
14   # Checks that you cannot add a new preference, that is a duplicate
15   def test_add_duplicate_preference
16     up = user_preferences(:a)
17     newUP = UserPreference.new
18     newUP.user = users(:normal_user)
19     newUP.k = up.k
20     newUP.v = "some other value"
21     assert_not_equal newUP.v, up.v
22     assert_raise (ActiveRecord::StatementInvalid) {newUP.save}
23   end
24   
25
26 end