test/controller_methods_test.rb in airbrake-3.1.12 vs test/controller_methods_test.rb in airbrake-3.1.13

- old
+ new

@@ -8,10 +8,20 @@ def current_user nil end end +class NoSessionTestController + include Airbrake::Rails::ControllerMethods + + def session + nil + end +end + + + class ControllerMethodsTest < Test::Unit::TestCase context "#airbrake_current_user" do setup do NilClass.class_eval do @@ -32,6 +42,18 @@ should "not call #id on NilClass" do @controller.send(:airbrake_current_user) assert_equal false, NilClass.called end end + + context '#airbrake_session_data' do + setup do + @controller = NoSessionTestController.new + end + should 'not call session if no session' do + no_session = @controller.send(:airbrake_session_data) + assert_equal no_session, {:session => 'no session found'} + end + end + end +