diff options
author | azul <azul@riseup.net> | 2013-01-14 11:05:52 -0800 |
---|---|---|
committer | azul <azul@riseup.net> | 2013-01-14 11:05:52 -0800 |
commit | ee2ea4ac8f4c6b0c3b09be6ed49e7a1faec7a9c1 (patch) | |
tree | 45eb6dcddd743de2b9f999d54751d9d4fc0fcbdd /users/test/unit/user_test.rb | |
parent | 4fd47160e0c43695aada330154f41821099bdda0 (diff) | |
parent | 7b323c5dbd7171cf98f69ca159b5aa2174a5d069 (diff) |
Merge pull request #15 from leapcode/feature/test-data-with-faker
Test data with faker, using factory girl
Diffstat (limited to 'users/test/unit/user_test.rb')
-rw-r--r-- | users/test/unit/user_test.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/users/test/unit/user_test.rb b/users/test/unit/user_test.rb index 0c79f1f..917728b 100644 --- a/users/test/unit/user_test.rb +++ b/users/test/unit/user_test.rb @@ -4,9 +4,7 @@ class UserTest < ActiveSupport::TestCase include SRP::Util setup do - @attribs = User.valid_attributes_hash - User.find_by_login(@attribs[:login]).try(:destroy) - @user = User.new(@attribs) + @user = FactoryGirl.build(:user) end test "test set of attributes should be valid" do @@ -49,13 +47,14 @@ class UserTest < ActiveSupport::TestCase assert_equal client_rnd, srp_session.aa end - test 'is user an admin' do - admin_login = APP_CONFIG['admins'].first - attribs = User.valid_attributes_hash - attribs[:login] = admin_login - admin_user = User.new(attribs) - assert admin_user.is_admin? + test 'normal user is no admin' do assert !@user.is_admin? end + test 'user with login in APP_CONFIG is an admin' do + admin_login = APP_CONFIG['admins'].first + @user.login = admin_login + assert @user.is_admin? + end + end |