spec/lib/appsignal/integrations/webmachine_spec.rb in appsignal-1.3.6 vs spec/lib/appsignal/integrations/webmachine_spec.rb in appsignal-1.4.0.alpha.1
- old
+ new
@@ -1,18 +1,22 @@
+require 'spec_helper'
if webmachine_present?
require 'appsignal/integrations/webmachine'
describe Appsignal::Integrations::WebmachinePlugin::FSM do
+ before(:all) do
+ Appsignal::Hooks::WebmachineHook.new.install
+ end
let(:request) do
Webmachine::Request.new('GET', 'http://google.com:80/foo', {}, nil)
end
let(:resource) { double(:trace? => false, :handle_exception => true) }
let(:response) { double }
let(:transaction) { double(:set_action => true) }
+
let(:fsm) { Webmachine::Decision::FSM.new(resource, request, response) }
- before(:all) { start_agent }
# Make sure the request responds to the method we need to get query params.
describe "request" do
it "should respond to `query`" do
expect( request ).to respond_to(:query)
@@ -53,18 +57,21 @@
end
after { fsm.run }
end
- describe "#handle_exceptions_with_appsignal" do
- let(:error) { VerySpecificError.new }
+ describe "handle_exceptions_with_appsignal" do
+ let(:error) { VerySpecificError.new('error') }
it "should catch the error and send it to AppSignal" do
expect( Appsignal ).to receive(:set_error).with(error)
end
after do
- fsm.send(:handle_exceptions) { raise error }
+ begin
+ fsm.send(:handle_exceptions) { raise error };
+ rescue VerySpecificError
+ end
end
end
end
end