ref: master
plugins/admin_notifications/test/functional/account_controller_test.rb
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 30 31 32 33 34 |
require 'test_helper' class AccountController include AdminNotificationsPlugin::NotificationHelper end class AccountControllerTest < ActionController::TestCase def setup @controller = AccountController.new @person = create_user('person').person @environment = Environment.default @environment.enable_plugin('AdminNotificationsPlugin') @environment.save! login_as(@person.user.login) end attr_accessor :person should 'clean hide_notifications cookie after logout' do @request.cookies[:hide_notifications] = JSON.generate([1,2]) get :index assert !@request.cookies[:hide_notifications].blank? @request.cookies[:hide_notifications] = nil get :logout assert_nil session[:user] assert_response :redirect assert_equal 1, @controller.hide_notifications.count assert @controller.hide_notifications.include?(-1) end end |