Sha256: 15bf980514877f7483cb1b01f67a648a4b7fcc82ba574d27f815c081701efe96
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' require 'spec/support/rack_test' require 'spec/support/uses_redis' require 'spec/support/uses_dotenv' require 'spec/support/events' require 'routemaster/drain/cache_busting' require 'json' describe Routemaster::Drain::CacheBusting do uses_dotenv uses_redis let(:app) { described_class.new } let(:listener) { double 'listener' } before { app.subscribe(listener, prefix: true) } let(:path) { '/' } let(:payload) { [1,2,3,1].map { |idx| make_event(idx) }.to_json } let(:environment) {{ 'CONTENT_TYPE' => 'application/json' }} let(:perform) { post path, payload, environment } before { authorize 'd3m0', 'x' } it 'succeeds' do perform expect(last_response.status).to eq(204) end it 'emits events' do expect(listener).to receive(:on_events_received) do |payload| expect(payload.size).to eq(3) end perform end it 'increments the event index' do ei_double = double(increment: 1) allow(Routemaster::EventIndex).to receive(:new).and_return(ei_double) expect(ei_double).to receive(:increment).exactly(3).times perform end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
routemaster-drain-2.5.0 | spec/routemaster/drain/cache_busting_spec.rb |