Users may specify a different browser to run jasmine:ci in by setting ENV['JASMINE_BROWSER']
This commit is contained in:
parent
199517abaa
commit
a0fbbd7f67
|
@ -5,9 +5,8 @@ module Jasmine
|
|||
def initialize(options = {})
|
||||
require 'selenium_rc'
|
||||
@selenium_jar_path = SeleniumRC::Server.allocate.jar_path
|
||||
@options = options
|
||||
|
||||
@browser = options[:browser] ? options.delete(:browser) : 'firefox'
|
||||
@browser = ENV["JASMINE_BROWSER"] || 'firefox'
|
||||
@selenium_pid = nil
|
||||
@jasmine_server_pid = nil
|
||||
end
|
||||
|
|
|
@ -1,12 +1,39 @@
|
|||
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
||||
|
||||
describe Jasmine::Config do
|
||||
|
||||
describe "configuration" do
|
||||
|
||||
before(:each) do
|
||||
@template_dir = File.expand_path(File.join(File.dirname(__FILE__), "../generators/jasmine/templates"))
|
||||
@config = Jasmine::Config.new
|
||||
end
|
||||
|
||||
describe "configuration" do
|
||||
describe "defaults" do
|
||||
|
||||
it "src_dir uses root when src dir is blank" do
|
||||
@config.stub!(:project_root).and_return('some_project_root')
|
||||
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
|
||||
YAML.stub!(:load).and_return({'src_dir' => nil})
|
||||
@config.src_dir.should == 'some_project_root'
|
||||
end
|
||||
|
||||
it "should use correct default yaml config" do
|
||||
@config.stub!(:project_root).and_return('some_project_root')
|
||||
@config.simple_config_file.should == (File.join('some_project_root', 'spec/javascripts/support/jasmine.yml'))
|
||||
end
|
||||
|
||||
|
||||
it "should provide dir mappings" do
|
||||
@config.mappings.should == {
|
||||
'/__root__' => @config.project_root,
|
||||
'/__spec__' => @config.spec_dir
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "simple_config" do
|
||||
before(:each) do
|
||||
@config.stub!(:src_dir).and_return(File.join(@template_dir, "public"))
|
||||
@config.stub!(:spec_dir).and_return(File.join(@template_dir, "spec"))
|
||||
|
@ -90,24 +117,28 @@ describe Jasmine::Config do
|
|||
|
||||
end
|
||||
|
||||
it "src_dir uses root when src dir is blank" do
|
||||
@config.stub!(:project_root).and_return('some_project_root')
|
||||
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
|
||||
YAML.stub!(:load).and_return({'src_dir' => nil})
|
||||
@config.src_dir.should == 'some_project_root'
|
||||
end
|
||||
|
||||
it "should use correct default yaml config" do
|
||||
@config.stub!(:project_root).and_return('some_project_root')
|
||||
@config.simple_config_file.should == (File.join('some_project_root', 'spec/javascripts/support/jasmine.yml'))
|
||||
describe "browsers" do
|
||||
it "should use firefox by default" do
|
||||
ENV.should_receive(:[], "JASMINE_BROWSER").and_return(nil)
|
||||
config = Jasmine::Config.new
|
||||
config.stub!(:start_servers)
|
||||
Jasmine::SeleniumDriver.should_receive(:new).
|
||||
with(anything(), anything(), "*firefox", anything()).
|
||||
and_return(mock(Jasmine::SeleniumDriver, :connect => true))
|
||||
config.start
|
||||
end
|
||||
|
||||
|
||||
it "should provide dir mappings" do
|
||||
@config.mappings.should == {
|
||||
'/__root__' => @config.project_root,
|
||||
'/__spec__' => @config.spec_dir
|
||||
}
|
||||
it "should use ENV['JASMINE_BROWSER'] if set" do
|
||||
ENV.should_receive(:[], "JASMINE_BROWSER").and_return("mosaic")
|
||||
config = Jasmine::Config.new
|
||||
config.stub!(:start_servers)
|
||||
Jasmine::SeleniumDriver.should_receive(:new).
|
||||
with(anything(), anything(), "*mosaic", anything()).
|
||||
and_return(mock(Jasmine::SeleniumDriver, :connect => true))
|
||||
config.start
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue