brynary / webrat

Webrat - Ruby Acceptance Testing for Web applications

webrat / lib / webrat / core / configuration.rb
31cc6b75 » brynary 2008-11-16 Collapsing Webrat::Core mod... 1 module Webrat
2
3 # Configures Webrat. If this is not done, Webrat will be created
4 # with all of the default settings.
5 def self.configure(configuration = Webrat::Configuration.new)
6 yield configuration if block_given?
7 @@configuration = configuration
8 end
9
f5ed57e0 » brynary 2008-11-30 Docs 10 def self.configuration # :nodoc:
31cc6b75 » brynary 2008-11-16 Collapsing Webrat::Core mod... 11 @@configuration ||= Webrat::Configuration.new
12 end
f5ed57e0 » brynary 2008-11-30 Docs 13
14 # Webrat can be configured using the Webrat.configure method. For example:
15 #
16 # Webrat.configure do |config|
17 # config.parse_with_nokogiri = false
18 # end
31cc6b75 » brynary 2008-11-16 Collapsing Webrat::Core mod... 19 class Configuration
22c78345 » gaffo 2008-12-25 Sets the Webrat mode with C... 20
e822535b » brynary 2008-11-24 More minor RDoc tweaks 21 # Should XHTML be parsed with Nokogiri? Defaults to true, except on JRuby. When false, Hpricot and REXML are used
f6ce5bbf » brynary 2008-11-23 Using configuration in Webr... 22 attr_writer :parse_with_nokogiri
adf68c2f » brynary 2008-11-22 Change Webrat Rails integra... 23
e822535b » brynary 2008-11-24 More minor RDoc tweaks 24 # Webrat's mode, set automatically when requiring webrat/rails, webrat/merb, etc.
f5ed57e0 » brynary 2008-11-30 Docs 25 attr_accessor :mode # :nodoc:
adf68c2f » brynary 2008-11-22 Change Webrat Rails integra... 26
e822535b » brynary 2008-11-24 More minor RDoc tweaks 27 # Save and open pages with error status codes (500-599) in a browser? Defualts to true.
f6ce5bbf » brynary 2008-11-23 Using configuration in Webr... 28 attr_writer :open_error_files
31cc6b75 » brynary 2008-11-16 Collapsing Webrat::Core mod... 29
2c51d908 » Kieran Pilkington 2008-12-27 adding configuration option... 30 # Which environment should the selenium tests be run in? Defaults to selenium.
31 attr_accessor :selenium_environment
32
33 # Which port should the selenium tests be run on? Defaults to 3001.
34 attr_accessor :selenium_port
35
e822535b » brynary 2008-11-24 More minor RDoc tweaks 36 def initialize # :nodoc:
31cc6b75 » brynary 2008-11-16 Collapsing Webrat::Core mod... 37 self.open_error_files = true
1017fdfb » brynary 2008-11-23 parse_with_nokogiri default... 38 self.parse_with_nokogiri = !Webrat.on_java?
2c51d908 » Kieran Pilkington 2008-12-27 adding configuration option... 39 self.selenium_environment = :selenium
40 self.selenium_port = 3001
31cc6b75 » brynary 2008-11-16 Collapsing Webrat::Core mod... 41 end
42
3b8fc555 » brynary 2008-11-24 RDoc tweaks 43 def parse_with_nokogiri? #:nodoc:
f6ce5bbf » brynary 2008-11-23 Using configuration in Webr... 44 @parse_with_nokogiri ? true : false
45 end
46
3b8fc555 » brynary 2008-11-24 RDoc tweaks 47 def open_error_files? #:nodoc:
f6ce5bbf » brynary 2008-11-23 Using configuration in Webr... 48 @open_error_files ? true : false
49 end
50
22c78345 » gaffo 2008-12-25 Sets the Webrat mode with C... 51 # Allows setting of webrat's mode, valid modes are:
52 # :rails, :selenium, :rack, :sinatra, :mechanize, :merb
53 def mode=(mode)
54 @mode = mode
55 require("webrat/#{mode}")
56 end
57
31cc6b75 » brynary 2008-11-16 Collapsing Webrat::Core mod... 58 end
59
19353b50 » gaffo 2008-11-14 Revert "[#33 state:resolved... 60 end