Sha256: 91a7281f43696caecd7fda7c2db41e95c913fc47a1e3bf5e77c79ef19fbe3c1f

Contents?: true

Size: 675 Bytes

Versions: 5

Compression:

Stored size: 675 Bytes

Contents

require File.expand_path '../helper', __FILE__

require 'airbrake/rails/controller_methods'

class TestController
  include Airbrake::Rails::ControllerMethods

  def current_user
    nil
  end
end

class ControllerMethodsTest < Test::Unit::TestCase
  context "#airbrake_current_user" do
    setup do

      NilClass.class_eval do
        @@called = false

        def self.called
          !! @@called
        end

        def id
          @@called = true
        end
      end

      @controller = TestController.new
    end

    should "not call #id on NilClass" do
      @controller.send(:airbrake_current_user)
      assert_equal false, NilClass.called
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
airbrake-3.1.12 test/controller_methods_test.rb
airbrake-3.1.11 test/controller_methods_test.rb
airbrake-3.1.10 test/controller_methods_test.rb
airbrake-3.1.9 test/controller_methods_test.rb
airbrake-3.1.8 test/controller_methods_test.rb