Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Making batch size for fetching spec results configurable

  • Loading branch information...
commit d833cfb2e8c1e65a81177009327e0c5be7bd9c52 1 parent 0241b43
Daren authored
View
2  lib/jasmine/run_specs.rb
@@ -27,7 +27,7 @@
puts "jasmine server started."
results_processor = Jasmine::ResultsProcessor.new(jasmine_runner_config)
-results = Jasmine::Runners::HTTP.new(client, results_processor).run
+results = Jasmine::Runners::HTTP.new(client, results_processor, jasmine_runner_config.result_batch_size).run
formatter = Jasmine::RspecFormatter.new
formatter.format_results(results)
View
4 lib/jasmine/runner_config.rb
@@ -63,5 +63,9 @@ def src_mapper=(context)
def src_mapper
@config.src_mapper
end
+
+ def result_batch_size
+ ENV["JASMINE_RESULT_BATCH_SIZE"] ? ENV["JASMINE_RESULT_BATCH_SIZE"].to_i : 50
+ end
end
end
View
5 lib/jasmine/runners/http.rb
@@ -3,9 +3,10 @@ module Runners
class HTTP
attr_accessor :suites
- def initialize(client, results_processor)
+ def initialize(client, results_processor, result_batch_size)
@client = client
@results_processor = results_processor
+ @result_batch_size = result_batch_size
end
def run
@@ -31,7 +32,7 @@ def load_suite_info
def results_hash
spec_results = {}
- spec_ids.each_slice(50) do |slice|
+ spec_ids.each_slice(@result_batch_size) do |slice|
spec_results.merge!(eval_js("var result = jsApiReporter.resultsForSpecs(#{json_generate(slice)}); if (window.Prototype && Object.toJSON) { return Object.toJSON(result) } else { return JSON.stringify(result) }"))
end
spec_results
View
2  spec/jasmine_self_test_spec.rb
@@ -18,6 +18,6 @@
puts "jasmine server started."
results_processor = Jasmine::ResultsProcessor.new(jasmine_runner_config)
-results = Jasmine::Runners::HTTP.new(client, results_processor).run
+results = Jasmine::Runners::HTTP.new(client, results_processor, jasmine_runner_config.result_batch_size).run
formatter = Jasmine::RspecFormatter.new
formatter.format_results(results)
View
13 spec/runner_config_spec.rb
@@ -134,5 +134,18 @@
user_config.src_mapper.should == mapper
end
end
+
+ describe "result batch size" do
+ subject { Jasmine::RunnerConfig.new }
+
+ context "when not specified" do
+ it("should use default") { subject.result_batch_size.should be(50) }
+ end
+
+ context "when overridden" do
+ before { ENV.stub(:[], "JASMINE_RESULT_BATCH_SIZE").and_return("500") }
+ it { subject.result_batch_size.should be(500) }
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.