2008-11-16 23:58:24 +00:00
|
|
|
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
|
|
|
|
|
|
|
describe Webrat::Configuration do
|
2008-11-23 19:59:07 +00:00
|
|
|
predicate_matchers[:parse_with_nokogiri] = :parse_with_nokogiri?
|
|
|
|
predicate_matchers[:open_error_files] = :open_error_files?
|
|
|
|
|
2008-11-16 23:58:24 +00:00
|
|
|
before do
|
|
|
|
Webrat.cache_config_for_test
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
Webrat.reset_for_test
|
|
|
|
end
|
2008-11-23 19:44:13 +00:00
|
|
|
|
|
|
|
it "should have a mode" do
|
|
|
|
Webrat.configuration.should respond_to(:mode)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should use Nokogiri as the parser by default" do
|
2008-11-23 19:49:05 +00:00
|
|
|
Webrat.stub!(:on_java? => false)
|
|
|
|
config = Webrat::Configuration.new
|
2008-11-23 19:59:07 +00:00
|
|
|
config.should parse_with_nokogiri
|
2008-11-23 19:44:13 +00:00
|
|
|
end
|
2008-11-16 23:58:24 +00:00
|
|
|
|
2008-11-23 19:49:05 +00:00
|
|
|
it "should not use Nokogiri as the parser when on JRuby" do
|
|
|
|
Webrat.stub!(:on_java? => true)
|
|
|
|
config = Webrat::Configuration.new
|
2008-11-23 19:59:07 +00:00
|
|
|
config.should_not parse_with_nokogiri
|
2008-11-23 19:49:05 +00:00
|
|
|
end
|
|
|
|
|
2008-11-23 04:49:12 +00:00
|
|
|
it "should open error files by default" do
|
2008-11-23 19:49:05 +00:00
|
|
|
config = Webrat::Configuration.new
|
2008-11-23 19:59:07 +00:00
|
|
|
config.should open_error_files
|
2008-11-16 23:58:24 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should be configurable with a block" do
|
|
|
|
Webrat.configure do |config|
|
|
|
|
config.open_error_files = false
|
|
|
|
end
|
2008-11-23 04:49:12 +00:00
|
|
|
|
2008-11-16 23:58:24 +00:00
|
|
|
config = Webrat.configuration
|
2008-11-23 19:59:07 +00:00
|
|
|
config.should_not open_error_files
|
2008-11-16 23:58:24 +00:00
|
|
|
end
|
2008-11-15 00:32:05 +00:00
|
|
|
end
|