Sha256: 727366f0f0130fd212c035de1d580a67af6c390b08c6adba155ed7dae112865b

Contents?: true

Size: 909 Bytes

Versions: 41

Compression:

Stored size: 909 Bytes

Contents

require 'spec_helper'
require 'spec/support/rack_test'
require 'spec/support/events'
require 'routemaster/middleware/dirty'

describe Routemaster::Middleware::Dirty do
  let(:terminator) { ErrorRackApp.new }
  let(:app) { described_class.new(terminator, options) }
  
  def perform(payload = nil)
    post '/whatever', '', 'routemaster.payload' => payload
  end

  describe '#call' do
    let(:map) { double 'dirty_map' }
    let(:options) {{ dirty_map: map }}
    let(:handler) { double }

    it 'marks the dirty map on events' do
      expect(map).to receive(:mark).exactly(:twice)
      perform([make_event(1), make_event(2)])
    end

    it 'stores dirty URLs in the environment' do
      allow(map).to receive(:mark).and_return(true, false)
      perform([make_event(1), make_event(1)])
      expect(terminator.last_env['routemaster.dirty']).to eq(['https://example.com/stuff/1'])
    end
  end
end



Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
routemaster-drain-3.7.1 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.7.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.8 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.7 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.6 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.5 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.4 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.3 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.2 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.1 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.6.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.5.1 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.5.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.4.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.3.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.2.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.1.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.0.3 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.0.2 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-3.0.1 spec/routemaster/middleware/dirty_spec.rb