Sha256: 1e52d2782708554654574cbf9e3125b8f43b0080bf4f0c4264335775c8f5fb11

Contents?: true

Size: 842 Bytes

Versions: 31

Compression:

Stored size: 842 Bytes

Contents

require 'support/metal_controller'

# helper to configure the middleware stack with custom handlers
# and capybara app setup for more convenient testing.
# You can use this in your integration spec by placing it in a before block.
#
# Example:
#
# before do
#   setup_app(action: :your_controller_action) do |tracker|
#     tracker.handler :your_new_handler, { custom_tracker_key: 'SomeKey123' }
#   end
# end
#
# By default this dispatches to a metal controller as a simple rack endpoint
# like rails would do, but without booting up a full rails environment.
def setup_app(options={}, &block)
  rack_endpoint     = options[:endpoint] || MetalController
  controller_action = options[:action]

  Capybara.app = Rack::Builder.new do
    use Rack::Tracker do
      block[self]
    end
    run rack_endpoint.action(controller_action)
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
rack-tracker-1.13.0 spec/support/capybara_app_helper.rb
rack-tracker-1.12.1 spec/support/capybara_app_helper.rb
rack-tracker-1.12.0 spec/support/capybara_app_helper.rb
rack-tracker-1.11.2 spec/support/capybara_app_helper.rb
rack-tracker-1.11.1 spec/support/capybara_app_helper.rb
rack-tracker-1.11.0 spec/support/capybara_app_helper.rb
rack-tracker-1.10.0 spec/support/capybara_app_helper.rb
rack-tracker-1.9.0 spec/support/capybara_app_helper.rb
rack-tracker-1.8.0 spec/support/capybara_app_helper.rb
rack-tracker-1.7.0 spec/support/capybara_app_helper.rb
rack-tracker-1.6.0 spec/support/capybara_app_helper.rb
rack-tracker-1.5.0 spec/support/capybara_app_helper.rb
rack-tracker-1.4.0 spec/support/capybara_app_helper.rb
rack-tracker-1.3.1 spec/support/capybara_app_helper.rb
rack-tracker-1.3.0 spec/support/capybara_app_helper.rb
rack-tracker-1.2.0 spec/support/capybara_app_helper.rb
rack-tracker-1.1.0 spec/support/capybara_app_helper.rb
rack-tracker-1.0.2 spec/support/capybara_app_helper.rb
rack-tracker-1.0.1 spec/support/capybara_app_helper.rb
rack-tracker-1.0.0 spec/support/capybara_app_helper.rb