Add config option which disabled server errors being raise, closes #932
This commit is contained in:
parent
a1c8453342
commit
e22c937884
|
@ -18,7 +18,7 @@ module Capybara
|
|||
attr_accessor :asset_root, :app_host, :run_server, :default_host, :always_include_port
|
||||
attr_accessor :server_host, :server_port, :exact, :match, :exact_options
|
||||
attr_accessor :default_selector, :default_wait_time, :ignore_hidden_elements
|
||||
attr_accessor :save_and_open_page_path, :automatic_reload
|
||||
attr_accessor :save_and_open_page_path, :automatic_reload, :raise_server_errors
|
||||
attr_writer :default_driver, :current_driver, :javascript_driver, :session_name
|
||||
attr_accessor :app
|
||||
|
||||
|
@ -346,6 +346,7 @@ Capybara.configure do |config|
|
|||
config.automatic_reload = true
|
||||
config.match = :smart
|
||||
config.exact = false
|
||||
config.raise_server_errors = true
|
||||
end
|
||||
|
||||
Capybara.register_driver :rack_test do |app|
|
||||
|
|
|
@ -75,7 +75,7 @@ module Capybara
|
|||
def reset!
|
||||
driver.reset! if @touched
|
||||
@touched = false
|
||||
raise @server.error if @server and @server.error
|
||||
raise @server.error if Capybara.raise_server_errors and @server and @server.error
|
||||
ensure
|
||||
@server.reset_error! if @server
|
||||
end
|
||||
|
|
|
@ -31,12 +31,20 @@ Capybara::SpecHelper.spec '#reset_session!' do
|
|||
@session.should have_no_selector('.//h1')
|
||||
end
|
||||
|
||||
it "raises any errors caught inside the server" do
|
||||
expect do
|
||||
it "raises any errors caught inside the server", :requires => [:server] do
|
||||
quietly { @session.visit("/error") }
|
||||
expect do
|
||||
@session.reset_session!
|
||||
end.to raise_error(TestApp::TestAppError)
|
||||
@session.visit("/")
|
||||
@session.current_path.should == "/"
|
||||
end
|
||||
|
||||
it "ignores server errors when `Capybara.raise_server_errors = false`", :requires => [:server] do
|
||||
Capybara.raise_server_errors = false
|
||||
quietly { @session.visit("/error") }
|
||||
@session.reset_session!
|
||||
@session.visit("/")
|
||||
@session.current_path.should == "/"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,7 @@ module Capybara
|
|||
Capybara.ignore_hidden_elements = true
|
||||
Capybara.exact = false
|
||||
Capybara.exact_options = false
|
||||
Capybara.raise_server_errors = true
|
||||
Capybara.match = :smart
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue