spec/lib/appsignal/rack/rails_instrumentation_spec.rb in appsignal-2.1.0.alpha.3 vs spec/lib/appsignal/rack/rails_instrumentation_spec.rb in appsignal-2.1.0.beta.1

- old
+ new

@@ -7,14 +7,14 @@ start_agent end let(:app) { double(:call => true) } let(:env) do - http_request_env_with_data('action_dispatch.request_id' => '1').tap do |request| - request['action_controller.instance'] = double( + http_request_env_with_data("action_dispatch.request_id" => "1").tap do |request| + request["action_controller.instance"] = double( :class => MockController, - :action_name => 'index' + :action_name => "index" ) end end let(:middleware) { Appsignal::Rack::RailsInstrumentation.new(app, {}) } @@ -25,36 +25,36 @@ context "when appsignal is active" do before { Appsignal.stub(:active? => true) } it "should call with monitoring" do - expect( middleware ).to receive(:call_with_appsignal_monitoring).with(env) + expect(middleware).to receive(:call_with_appsignal_monitoring).with(env) end end context "when appsignal is not active" do before { Appsignal.stub(:active? => false) } it "should not call with monitoring" do - expect( middleware ).to_not receive(:call_with_appsignal_monitoring) + expect(middleware).to_not receive(:call_with_appsignal_monitoring) end it "should call the app" do - expect( app ).to receive(:call).with(env) + expect(app).to receive(:call).with(env) end end after { middleware.call(env) } end describe "#call_with_appsignal_monitoring" do it "should create a transaction" do Appsignal::Transaction.should_receive(:create).with( - '1', + "1", Appsignal::Transaction::HTTP_REQUEST, kind_of(ActionDispatch::Request), - :params_method=>:filtered_parameters + :params_method => :filtered_parameters ).and_return( double( :set_action => nil, :set_http_or_background_queue_start => nil, :set_metadata => nil @@ -82,23 +82,23 @@ it "should set metadata" do Appsignal::Transaction.any_instance.should_receive(:set_metadata).twice end it "should set the action and queue start" do - Appsignal::Transaction.any_instance.should_receive(:set_action).with('MockController#index') + Appsignal::Transaction.any_instance.should_receive(:set_action).with("MockController#index") Appsignal::Transaction.any_instance.should_receive(:set_http_or_background_queue_start) end after { middleware.call(env) rescue VerySpecificError } end describe "#request_id" do subject { middleware.request_id(env) } context "with request id set" do - let(:env) { {'action_dispatch.request_id' => 'id'} } + let(:env) { { "action_dispatch.request_id" => "id" } } - it { should eq 'id' } + it { should eq "id" } end context "with request id not set" do let(:env) { {} }