assert_response :unauthorized, "should be authenticated"
# authenticate as a user with no preferences
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
# try the read again
get :read
user = create(:user)
user_preference = create(:user_preference, :user => user)
user_preference2 = create(:user_preference, :user => user)
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# try the read again
get :read
assert_response :unauthorized, "should be authenticated"
# authenticate as a user with preferences
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# try the read again
get :read_one, :params => { :preference_key => "key" }
end
# authenticate as a user with preferences
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# try the put again
assert_no_difference "UserPreference.count" do
end
# authenticate as a user with preferences
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# try adding a new preference
assert_difference "UserPreference.count", 1 do
assert_equal "value", UserPreference.find([user.id, "key"]).v
# authenticate as a user with preferences
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# try the delete again
assert_difference "UserPreference.count", -1 do