spec/runner_config_spec.rb in jasmine-1.2.1 vs spec/runner_config_spec.rb in jasmine-1.3.0

- old
+ new

@@ -92,40 +92,45 @@ ENV.stub(:[], "JASMINE_BROWSER").and_return("foo") Jasmine::RunnerConfig.new.browser.should == 'foo' end end - describe "jasmine_host" do - it "should default to localhost" do - Jasmine::RunnerConfig.new.jasmine_host.should == 'http://localhost' + + describe "src_mapper" do + it "should update the src_mapper in the user_config" do + config = Jasmine::RunnerConfig.new(user_config = Jasmine::Config.new) + mapper = double("mapper") + config.src_mapper = mapper + config.src_mapper.should == mapper + user_config.src_mapper.should == mapper end + end - it "should use ENV['JASMINE_HOST'] if it exists" do - ENV.stub(:[], "JASMINE_HOST").and_return("foo") - Jasmine::RunnerConfig.new.jasmine_host.should == 'foo' + describe "jasmine_server_url" do + it "should return the correct server url" do + host = "the host" + port = "484" + user_config = double('config', :jasmine_host => host, :port => port) + Jasmine::RunnerConfig.new(user_config).jasmine_server_url.should == "#{host}:#{port}/" end end describe "port" do - it "should find an unused port" do - Jasmine.should_receive(:find_unused_port).and_return('1234') - Jasmine::RunnerConfig.new.port.should == '1234' + it "should return the port from the config" do + user_config = double('config', :port => 80) + Jasmine::RunnerConfig.new(user_config).port.should == 80 end + end + describe "result batch size" do + subject { Jasmine::RunnerConfig.new.result_batch_size } - it "should use ENV['JASMINE_PORT'] if it exists" do - ENV.stub(:[], "JASMINE_PORT").and_return("foo") - Jasmine::RunnerConfig.new.port.should == 'foo' + context "when not specified" do + it("should use default") { should == 50 } end - it "should cache port" do - config = Jasmine::RunnerConfig.new - Jasmine.stub(:find_unused_port).and_return('1234') - config.port.should == '1234' - Jasmine.stub(:find_unused_port).and_return('4321') - config.port.should == '1234' + context "when overridden" do + before { ENV.stub(:[], "JASMINE_RESULT_BATCH_SIZE").and_return("500") } + it { should be(500) } end - - end - end