spec/rollbar_spec.rb in rollbar-0.10.9 vs spec/rollbar_spec.rb in rollbar-0.10.10

- old
+ new

@@ -1,9 +1,16 @@ require 'logger' require 'socket' require 'spec_helper' +require 'girl_friday' +begin + require 'sucker_punch' + require 'sucker_punch/testing/inline' +rescue LoadError +end + describe Rollbar do context 'report_exception' do before(:each) do configure @@ -168,11 +175,11 @@ end exception = CustomException.new("oops") Rollbar.report_exception(exception) - + payload["data"]["body"]["trace"]["frames"][0]["method"].should == "custom backtrace line" end end context 'report_message' do @@ -339,9 +346,28 @@ Rollbar.report_exception(@exception) Rollbar.configure do |config| config.use_async = false config.async_handler = Rollbar.method(:default_async_handler) + end + end + + if defined?(SuckerPunch) + it "should send the payload to sucker_punch delayer" do + logger_mock.should_receive(:info).with('[Rollbar] Scheduling payload') + logger_mock.should_receive(:info).with('[Rollbar] Sending payload') + logger_mock.should_receive(:info).with('[Rollbar] Success') + + Rollbar.configure do |config| + config.use_sucker_punch = true + end + + Rollbar.report_exception(@exception) + + Rollbar.configure do |config| + config.use_async = false + config.async_handler = Rollbar.method(:default_async_handler) + end end end it "should send the payload to sidekiq delayer" do module Rollbar