Revision 9d43fc71
Added by Michael Moll almost 6 years ago
test/controllers/notification_recipients_controller_test.rb | ||
---|---|---|
|
||
test "should be able to update seen flag" do
|
||
add_notification
|
||
get :index, params: { :format=>'json' }, session: set_session_user
|
||
get :index, params: { :format => 'json' }, session: set_session_user
|
||
put :update, params: { :format => 'json', :id => first_notification,
|
||
:notification_recipient => {:seen => true} }, session: set_session_user
|
||
assert_response :success
|
||
... | ... | |
|
||
test "should be able to delete notification" do
|
||
add_notification
|
||
get :index, params: { :format=>'json' }, session: set_session_user
|
||
get :index, params: { :format => 'json' }, session: set_session_user
|
||
notice_id = first_notification
|
||
assert NotificationRecipient.find(notice_id)
|
||
delete :destroy, params: { :id => notice_id }
|
||
... | ... | |
end
|
||
|
||
test "should get 404 on invalid notification deletion" do
|
||
get :index, params: { :format=>'json' }, session: set_session_user
|
||
get :index, params: { :format => 'json' }, session: set_session_user
|
||
notice_id = 1
|
||
refute response['notifications'].map{|n| n['id']}.include?(notice_id)
|
||
refute NotificationRecipient.find_by_id(notice_id)
|
||
... | ... | |
|
||
test "should not get notifications if settings login is disabled" do
|
||
SETTINGS[:login] = false
|
||
get :index, params: { :format=>'json' }
|
||
get :index, params: { :format => 'json' }
|
||
SETTINGS[:login] = true
|
||
assert_response :not_found
|
||
end
|
Also available in: Unified diff
Fixes #19789 - fix Layout/SpaceAroundOperators cop