* I took the conservative approach here: the sinatra code could
be removed but that'd cause a regression. (using Sinatra::Application
when `app` is not defined)
* I left the sinatra tests for now; they should be removed
once we're fully confident with rack session ones.
* Webrat::Session.new now take a session adapter class as it's argument and
delegates methods such as #response_body and #response_code to an instance
of it.
* Some of these methods will go away in the future. However, *a lot*
of specs depends on them so I've left them for now. The plan is to
strip down the session adapter API to these three methods:
* request
* response_code
* response_body
* I had to mark a spec as pending: spec/private/rails/rails_session_spec.rb
application_address is used to know where Selenium should navitate to,
but we always are booting app servers on 0.0.0.0 so that's where we
should verify they exist
This reverts commit 4daf037146.
This was causing failures in the Weplay selenium suite, where we
we're using partial matches. For example:
fill_in "Write a message", ...
When the markup was:
<label>Write a message to Bryan ...</label>
Mechanize takes input as plaintext and escapes field values on its own.
If the values are escaped before they are passed to Mechanize, the values will be escaped twice.
These doubly-escaped values will result in incorrect behavior on the server side.
I don't think silence_stream.rb should be stored under
core_extensions, because the way it's implemented, it simply is
no core extension. Also, a grep through webrat source shows that
silence_stream is only used inside the selenium support. This is
why I added webrat/selenium/silence_stream.rb and require it
*before* all other selenium related files in webrat/selenium.rb.
It's necessary to include it this early, because if mode is set
to :selenium, webrat/selenium.rb is required, which in turn
requires webrat/selenium/selenium_session.rb and silence_stream
must be available before selenium_session gets required because
selenium_session already wants to silence the stream.
I added the implementation to webrat/core/configuration.rb because
it seems to me that this always gets read first. I decided to put
it inside a util module Webrat::SilentStream and include this where
appropriate, instead of altering Kernel.
Webrat didn't properly follow internal redirects when using the Host
header, this lets Webrat check the Host header before falling back
to www.example.com as the current_host.
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
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)