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.0.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.5.4 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.5.3 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.5.2 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.5.1 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.5.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.4.4 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.4.3 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.4.2 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.4.1 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.4.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.3.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.2.2 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-2.0.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-1.1.0 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-1.0.5 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-1.0.4 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-1.0.3 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-1.0.2 spec/routemaster/middleware/dirty_spec.rb
routemaster-drain-1.0.1 spec/routemaster/middleware/dirty_spec.rb