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-12-26 04:04:41 +00:00
|
|
|
|
2008-11-23 19:44:13 +00:00
|
|
|
it "should have a mode" do
|
|
|
|
Webrat.configuration.should respond_to(:mode)
|
|
|
|
end
|
2009-01-12 18:13:22 +00:00
|
|
|
|
2008-11-23 19:44:13 +00:00
|
|
|
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
|
2009-01-12 18:13:22 +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
|
2009-01-12 18:13:22 +00:00
|
|
|
|
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
|
2009-01-12 18:13:22 +00:00
|
|
|
|
2008-12-28 01:18:55 +00:00
|
|
|
it "should use 'selenium' as the selenium environment by default" do
|
2008-12-27 23:52:10 +00:00
|
|
|
config = Webrat::Configuration.new
|
|
|
|
config.selenium_environment.should == :selenium
|
|
|
|
end
|
2009-01-12 18:13:22 +00:00
|
|
|
|
|
|
|
it "should use 3001 as the application port by default" do
|
2008-12-28 01:18:55 +00:00
|
|
|
config = Webrat::Configuration.new
|
2009-01-12 18:13:22 +00:00
|
|
|
config.application_port.should == 3001
|
2008-12-28 01:18:55 +00:00
|
|
|
end
|
2009-01-12 18:13:22 +00:00
|
|
|
|
2008-11-16 23:58:24 +00:00
|
|
|
it "should be configurable with a block" do
|
|
|
|
Webrat.configure do |config|
|
|
|
|
config.open_error_files = false
|
|
|
|
end
|
2009-01-12 18:13:22 +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
|
2009-01-12 18:13:22 +00:00
|
|
|
|
|
|
|
[:rails,
|
2008-12-26 04:04:41 +00:00
|
|
|
:selenium,
|
|
|
|
:rack,
|
|
|
|
:sinatra,
|
|
|
|
:merb,
|
|
|
|
:mechanize].each do |mode|
|
|
|
|
it "should require correct lib when in #{mode} mode" do
|
|
|
|
config = Webrat::Configuration.new
|
|
|
|
config.should_receive(:require).with("webrat/#{mode}")
|
|
|
|
config.mode = mode
|
|
|
|
end
|
|
|
|
end
|
2009-01-12 18:13:22 +00:00
|
|
|
|
|
|
|
describe "Selenium config" do
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|