spec/lib/appsignal/transaction_spec.rb in appsignal-0.12.beta.8 vs spec/lib/appsignal/transaction_spec.rb in appsignal-0.12.beta.9

- old
+ new

@@ -48,11 +48,11 @@ context "with a current transaction" do before { Appsignal::Transaction.create('2', {}) } it "should complete the current transaction and set the thread appsignal_transaction to nil" do - Appsignal::Extension.should_receive(:finish_transaction).with('2') + Appsignal::Extension.should_receive(:finish_transaction).with(kind_of(Integer)) Appsignal::Transaction.complete_current! Thread.current[:appsignal_transaction].should be_nil end @@ -112,10 +112,11 @@ context "initialization" do subject { transaction } its(:request_id) { should == '3' } + its(:transaction_index) { should be_a Integer } its(:root_event_payload) { should be_nil } its(:exception) { should be_nil } its(:env) { should == env } its(:tags) { should == {} } its(:queue_start) { should == -1 } @@ -139,12 +140,12 @@ context "for a process_action event" do let(:name) { 'process_action.action_controller' } let(:payload) { create_payload } it "should set the meta data in the transaction and native" do - Appsignal::Extension.should_receive(:set_transaction_basedata).with( - '3', + Appsignal::Extension.should_receive(:set_transaction_base_data).with( + kind_of(Integer), 'http_request', 'BlogPostsController#show', kind_of(Integer) ) @@ -170,12 +171,12 @@ context "for a perform_job event" do let(:name) { 'perform_job.delayed_job' } let(:payload) { create_background_payload } it "should set the meta data in the transaction and native" do - Appsignal::Extension.should_receive(:set_transaction_basedata).with( - '3', + Appsignal::Extension.should_receive(:set_transaction_base_data).with( + kind_of(Integer), 'background_job', 'BackgroundJob#perform', kind_of(Integer) ) @@ -190,11 +191,11 @@ end describe "#set_metadata" do it "should set the metdata in native" do Appsignal::Extension.should_receive(:set_transaction_metadata).with( - '3', + kind_of(Integer), 'request_method', 'GET' ).once transaction.set_metadata('request_method', 'GET') @@ -214,31 +215,31 @@ transaction.should respond_to(:add_exception) end it "should set an error and it's data in native" do Appsignal::Extension.should_receive(:set_transaction_error).with( - '3', + kind_of(Integer), 'RSpec::Mocks::Mock', 'test message' ) Appsignal::Extension.should_receive(:set_transaction_error_data).with( - '3', + kind_of(Integer), 'environment', "{\"SERVER_NAME\":\"localhost\",\"HTTP_X_REQUEST_START\":\"1000000\",\"HTTP_USER_AGENT\":\"IE6\"}" ).once Appsignal::Extension.should_receive(:set_transaction_error_data).with( - '3', + kind_of(Integer), 'session_data', "{}" ).once Appsignal::Extension.should_receive(:set_transaction_error_data).with( - '3', + kind_of(Integer), 'backtrace', "[\"line 1\"]" ).once Appsignal::Extension.should_receive(:set_transaction_error_data).with( - '3', + kind_of(Integer), 'tags', "{}" ).once transaction.set_error(error) @@ -249,16 +250,16 @@ transaction.set_root_event('process_action.action_controller', create_payload) end it "should also set params" do Appsignal::Extension.should_receive(:set_transaction_error_data).with( - '3', + kind_of(Integer), 'params', '{"controller":"blog_posts","action":"show","id":"1"}' ).once Appsignal::Extension.should_receive(:set_transaction_error_data).with( - '3', + kind_of(Integer), kind_of(String), kind_of(String) ).exactly(4).times transaction.set_error(error) @@ -270,15 +271,15 @@ transaction.stub(:sanitized_params => 'a string') end it "should skip the field" do Appsignal::Extension.should_not_receive(:set_transaction_error_data).with( - '3', + kind_of(Integer), 'params', kind_of(String) ) Appsignal::Extension.should_receive(:set_transaction_error_data).with( - '3', + kind_of(Integer), kind_of(String), kind_of(String) ).exactly(4).times transaction.set_error(error)