Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for Rails 5.1 apps #286

Merged
merged 1 commit into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/appsignal/integrations/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def self.initialize_appsignal(app)
# Start logger
Appsignal.start_logger

app.middleware.insert_before(
ActionDispatch::RemoteIp,
app.middleware.insert_after(
ActionDispatch::DebugExceptions,
Appsignal::Rack::RailsInstrumentation
)

Expand Down
17 changes: 10 additions & 7 deletions spec/lib/appsignal/integrations/railtie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

describe "#initialize_appsignal" do
let(:app) { MyApp::Application }
before { allow(app.middleware).to receive(:insert_before).and_return(true) }
before do
allow(app.middleware).to receive(:insert_before)
allow(app.middleware).to receive(:insert_after)
end

describe ".logger" do
before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
Expand Down Expand Up @@ -68,8 +71,8 @@

describe "Rails listener middleware" do
it "adds the Rails listener middleware" do
expect(app.middleware).to receive(:insert_before).with(
ActionDispatch::RemoteIp,
expect(app.middleware).to receive(:insert_after).with(
ActionDispatch::DebugExceptions,
Appsignal::Rack::RailsInstrumentation
)
end
Expand All @@ -93,8 +96,8 @@
let(:enable_frontend_error_catching) { true }

it "adds the Rails and JSExceptionCatcher middleware" do
expect(app.middleware).to receive(:insert_before).with(
ActionDispatch::RemoteIp,
expect(app.middleware).to receive(:insert_after).with(
ActionDispatch::DebugExceptions,
Appsignal::Rack::RailsInstrumentation
)

Expand All @@ -109,8 +112,8 @@
let(:enable_frontend_error_catching) { false }

it "adds the Rails middleware, but not the JSExceptionCatcher middleware" do
expect(app.middleware).to receive(:insert_before).with(
ActionDispatch::RemoteIp,
expect(app.middleware).to receive(:insert_after).with(
ActionDispatch::DebugExceptions,
Appsignal::Rack::RailsInstrumentation
)

Expand Down