Skip to content

Commit

Permalink
Allow multiple configuration blocks without dropping previous configu…
Browse files Browse the repository at this point in the history
…ration.

If you really want to start with a default configuration use:

  Webrat.configure(Webrat::Configuration.new) do |config|
    ...
  end
  • Loading branch information
brynary committed Jan 18, 2009
1 parent 0b07dfe commit fdb94f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webrat/core/configuration.rb
Expand Up @@ -4,7 +4,7 @@ module Webrat

# Configures Webrat. If this is not done, Webrat will be created
# with all of the default settings.
def self.configure(configuration = Webrat::Configuration.new)
def self.configure(configuration = Webrat.configuration)
yield configuration if block_given?
@@configuration = configuration
end
Expand Down
14 changes: 14 additions & 0 deletions spec/private/core/configuration_spec.rb
Expand Up @@ -34,6 +34,20 @@
config.should_not open_error_files
end

it "should be configurable with multiple blocks" do
Webrat.configure do |config|
config.open_error_files = false
end

Webrat.configure do |config|
config.selenium_server_port = 1234
end

config = Webrat.configuration
config.should_not open_error_files
config.selenium_server_port.should == 1234
end

[:rails,
:selenium,
:rack,
Expand Down

0 comments on commit fdb94f3

Please sign in to comment.