Commit Graph

12 Commits

Author SHA1 Message Date
Damian Janowski deccefa2c3 Some explicit requires of RubyGems are necessary for integration tests.
Should not affect the way Webrat behaves as a library.
2010-04-12 23:30:56 -03:00
Simon Rozet 10c70a37de Get rid of needless require "rubygems" 2010-04-12 22:28:14 -03:00
Bryan Helmkamp 561525dd81 Rename RackSession to RackAdapter 2009-08-12 20:39:35 -04:00
Bryan Helmkamp a015931578 Comment out redgreen because it has issues on Ruby 1.9 2009-06-15 00:03:46 -04:00
Simon Rozet 90baf3311c Sinatra now provides sensible options for testing
In the lastest release, 0.9.1:

* Set sensible defaults on Default for test env [1]
  5a33a9586f

* Set :environment to :test in TestHarness
  9af37724e0

* Set :environment to :test when Sinatra::Test is included
  93b19a3492

[1] Only Sinatra::Default provides special options for testing. If you subclass
    Sinatra::Base, you'll have to set them yourself.

foo
2009-03-08 23:41:34 +01:00
Simon Rozet 4e07f5b654 Fix following of absolute redirect URL in Sinatra
What's going on when the app redirects to an absolute URL?

* Sinatra relies on Rack::MockSession which sets SERVER_NAME to
  "example.org" [1] on request it makes. However, Webrat expects
  it to be "www.example.com"

* In MyClassyApp, the redirect URL is made out of Rack::Request#url [2]
  which uses  SERVER_NAME, which is set to "example.org" by Rack::MockSession.
  As a result, Webrat see it as an external redirect and don't follow it.

NOTE:

* SERVER_NAME is stricly equivalent to HTTP_HOST [3]
* This could have been fixed in Webrat::Session too. I'am not sure
  that it won't affect other frameworks so I left it intact.

      def request_page(url, http_method, data) #:nodoc:
         h = headers
         h['HTTP_REFERER'] = @current_url if @current_url
  +      h['HTTP_HOST']    = 'www.example.com'

[1] 5c00dd698e/lib/rack/mock.rb (L79)
[2] 5c00dd698e/lib/rack/request.rb (L201)
[3] 5c00dd698e/lib/rack/request.rb (L72)
2009-02-28 03:30:26 +01:00
Simon Rozet 7d7c32256d Support for "modular" Sinatra app style
Since Sinatra 0.9, apps can be ancapsulated in a class ("modular" style)
or be on the top level, just like before ("classic" style)

* http://wiki.github.com/brynary/webrat/sinatra
* http://www.sinatrarb.com/extensions.html
2009-02-28 03:30:25 +01:00
Bryan Helmkamp 6676ae2da9 Adding integration test for field_labeled 2009-01-17 17:13:20 -05:00
Josh Knowles 9825aee47e Don't follow external redirects 2009-01-04 23:56:52 -05:00
Nicolas Sanguinetti 4565a3cea6 Unescape the values passed to the sinatra test helpers 2009-01-04 22:36:21 -05:00
Josh Knowles 34ea3e64b8 Sinatra integration tests for following redirects 2009-01-04 22:34:47 -05:00
Nicolas Sanguinetti 499dcefefe Add integration tests for sinatra 2008-12-29 06:41:50 -02:00