spec/ratchetio_spec.rb in ratchetio-0.5.5 vs spec/ratchetio_spec.rb in ratchetio-0.6.0
- old
+ new
@@ -91,11 +91,11 @@
end
it 'should report exception objects with no backtrace' do
payload = nil
Ratchetio.stub(:schedule_payload) do |*args|
- payload = JSON.parse( args[0] )
+ payload = MultiJson.load(args[0])
end
Ratchetio.report_exception(StandardError.new("oops"))
payload["data"]["body"]["trace"]["frames"].should == []
payload["data"]["body"]["trace"]["exception"]["class"].should == "StandardError"
payload["data"]["body"]["trace"]["exception"]["message"].should == "oops"
@@ -225,10 +225,12 @@
end
let(:logger_mock) { double("Rails.logger").as_null_object }
it 'should send the payload using the default asynchronous handler girl_friday' do
+ logger_mock.should_receive(:info).with('[Ratchet.io] Scheduling payload')
+ logger_mock.should_receive(:info).with('[Ratchet.io] Sending payload')
logger_mock.should_receive(:info).with('[Ratchet.io] Success')
Ratchetio.configure do |config|
config.use_async = true
GirlFriday::WorkQueue::immediate!
@@ -359,18 +361,16 @@
end
context 'build_payload' do
it 'should build valid json' do
json = Ratchetio.send(:build_payload, {:foo => {:bar => "baz"}})
- hash = ActiveSupport::JSON.decode(json)
+ hash = MultiJson.load(json)
hash["data"]["foo"]["bar"].should == "baz"
end
end
context 'base_data' do
- before(:each) do
- configure
- end
+ before(:each) { configure }
it 'should have the correct notifier name' do
Ratchetio.send(:base_data)[:notifier][:name].should == 'ratchetio-gem'
end