Sha256: 43648800968e527298ec0e5418683e603a8a5d59da8690e4a6ff59a301066570
Contents?: true
Size: 922 Bytes
Versions: 1
Compression:
Stored size: 922 Bytes
Contents
require 'spec_helper' describe 'Validic Subscriptions' do include Rack::Test::Methods let(:app) { Jawbit::ValidicRack.new } let(:subscriptions) { [] } def subscribe(&block) subscriptions << ActiveSupport::Notifications.subscribe( 'notification.validic', &block ) end after :each do subscriptions.each do |subscription| ActiveSupport::Notifications.unsubscribe(subscription) end end it 'returns a 200' do post '/', '[]' expect(last_response.status).to eq(200) end it 'fires an event' do notification = false subscribe { |*args| notification = true } post '/', '[]' expect(notification).to eq(true) end it 'includes the JSON body' do subscribe { |*args| event = ActiveSupport::Notifications::Event.new *args expect(event.payload[:json]).to eq([{'foo' => 'bar'}]) } post '/', '[{"foo":"bar"}]' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jawbit-0.1.0 | spec/acceptance/validic_notifications_spec.rb |