Sha256: 91193879d0541adbdaac03ac569f06d5c8480dbffe30afef69ac662821e23a8a

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'
require 'action_controller/railtie'
require 'justlogging/railtie'

describe Justlogging::Railtie do

  before :all do
    MyApp::Application.initialize!
  end

  it "should have set the justlogging subscriber" do
    Justlogging.subscriber.should be_a ActiveSupport::Notifications::Fanout::Subscriber
  end

  it "should have added the middleware for exceptions" do
    MyApp::Application.middleware.middlewares.should include Justlogging::Middleware
  end

  context "non action_controller event" do

    it "should call add_event for non action_controller event" do
      current = stub
      current.should_receive(:add_event)
      Justlogging::Transaction.should_receive(:current).and_return(current)
    end

    after do
      ActiveSupport::Notifications.instrument 'query.mongoid'
    end

  end

  context "action_controller event" do

    it "should call set_log_entry for action_controller event" do
      current = stub
      current.should_receive(:set_log_entry)
      Justlogging::Transaction.should_receive(:current).and_return(current)
    end

    after do
      ActiveSupport::Notifications.instrument 'process_action.action_controller'
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
justlogging-rails-0.0.4 spec/justlogging/railtie_spec.rb
justlogging-rails-0.0.3 spec/justlogging/railtie_spec.rb
justlogging-rails-0.0.2 spec/justlogging/railtie_spec.rb
justlogging-rails-0.0.1 spec/justlogging/railtie_spec.rb