test/controllers/internal_helpers_test.rb in devise-1.2.1 vs test/controllers/internal_helpers_test.rb in devise-1.3.0

- old
+ new

@@ -43,10 +43,18 @@ @mock_warden.expects(:user).with(:user).returns(User.new) @controller.expects(:redirect_to).with(root_path) @controller.send :require_no_authentication end + test 'require no authentication sets a flash message' do + @mock_warden.expects(:authenticated?).with(:user).returns(true) + @mock_warden.expects(:user).with(:user).returns(User.new) + @controller.expects(:redirect_to).with(root_path) + @controller.send :require_no_authentication + assert flash[:alert] == I18n.t("devise.failure.already_authenticated") + end + test 'signed in resource returns signed in resource for current scope' do @mock_warden.expects(:authenticate).with(:scope => :user).returns(User.new) assert_kind_of User, @controller.signed_in_resource end @@ -66,7 +74,14 @@ MyController.send(:public, :set_flash_message) I18n.stubs(:t).returns('non-blank') @controller.set_flash_message :notice, :send_instructions assert flash[:notice] == 'non-blank' MyController.send(:protected, :set_flash_message) + end + + test 'navigational_formats not returning a wild card' do + MyController.send(:public, :navigational_formats) + Devise.navigational_formats = [:"*/*", :html] + assert_not @controller.navigational_formats.include?(:"*/*") + MyController.send(:protected, :navigational_formats) end end