spec/lib/appsignal/transaction_spec.rb in appsignal-1.1.0.beta.6 vs spec/lib/appsignal/transaction_spec.rb in appsignal-1.1.0.beta.7
- old
+ new
@@ -331,10 +331,15 @@
'params',
'{"controller":"blog_posts","action":"show","id":"1"}'
).once
Appsignal::Extension.should_receive(:set_transaction_sample_data).with(
kind_of(Integer),
+ 'metadata',
+ '{"key":"value"}'
+ ).once
+ Appsignal::Extension.should_receive(:set_transaction_sample_data).with(
+ kind_of(Integer),
'tags',
"{}"
).once
transaction.sample_data
@@ -611,9 +616,25 @@
it "does not pass the session data into the params sanitizer" do
Appsignal::ParamsSanitizer.should_not_receive(:sanitize)
subject.should be_nil
end
end
+ end
+ end
+
+ describe "#metadata" do
+ subject { transaction.send(:metadata) }
+
+ context "when env is nil" do
+ before { transaction.request.stub(:env => nil) }
+
+ it { should be_nil }
+ end
+
+ context "when env is present" do
+ let(:env) { {:metadata => {:key => 'value'}} }
+
+ it { should == env[:metadata] }
end
end
describe '#sanitized_tags' do
before do