Sha256: e57a43d644229066562c8183988e37c1f1c5f46a2f0671710ae7e61d9ebf7969

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require 'capybara/spec/test_app'

class ExtendedTestApp < TestApp#< Sinatra::Base
  set :environment, :production # so we don't get debug info that makes our test pass!
  disable :protection

  get %r{/redirect_to/(.*)} do
    redirect params[:captures].first
  end

  get '/form_with_relative_action_to_host' do
    %{<form action="/request_info/host" method="post">
       <input type="submit" value="submit" />
      </form>}
  end

  get '/request_info/form_with_no_action' do
    %{<form method="post">
       <input type="submit" value="submit" />
      </form>}
  end

  get '/relative_link_to_host' do
    %{<a href="/request_info/host">host</a>}
  end

  get '/request_info/user_agent' do
    request.user_agent
  end

  get '/request_info/*' do
    current_request_info
  end

  post '/request_info/*' do
    current_request_info
  end

  get '/subsite/relative_link_to_host' do
    %{<a href="/subsite/request_info2/host">host</a>}
  end

  get '/subsite/local_link_to_host' do
    %{<a href="request_info2/host">host</a>}
  end

  get '/subsite/request_info2/*' do
    "subsite: " + current_request_info
  end

  get '/redirect_with_http_param' do
    redirect '/redirect_target?foo=http'
  end

  get '/redirect_target' do
    %{correct redirect}
  end

  private

    def current_request_info
      "Current host is #{request.url}, method #{request.request_method.downcase}"
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ryansch-capybara-mechanize-1.0.0 lib/capybara/spec/extended_test_app.rb