spec/ci_runner_spec.rb in jasmine-2.3.1 vs spec/ci_runner_spec.rb in jasmine-2.4.0
- old
+ new
@@ -9,11 +9,12 @@
:runner => runner_factory,
:formatters => [],
:host => 'foo.bar.com',
:port => '1234',
:rack_options => 'rack options',
- :stop_spec_on_expectation_failure => false
+ :stop_spec_on_expectation_failure => false,
+ :random => false
)
end
let(:thread_instance) { double(:thread, :abort_on_exception= => nil) }
let(:fake_thread) do
@@ -39,11 +40,12 @@
ci_runner.run
expect(config).to have_received(:port).with(:ci).at_least(:once)
expect(config).not_to have_received(:port).with(:server)
- expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), 'foo.bar.com:1234/?throwFailures=false')
+ expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), /\bthrowFailures=false\b/)
+ expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), /\brandom=false\b/)
expect(application_factory).to have_received(:app).with(config)
expect(server_factory).to have_received(:new).with('1234', 'my fake app', 'rack options')
expect(fake_thread).to have_received(:new)
@@ -90,8 +92,46 @@
ci_runner = Jasmine::CiRunner.new(config, thread: fake_thread, application_factory: application_factory, server_factory: server_factory, outputter: outputter)
ci_runner.run
- expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), 'foo.bar.com:1234/?throwFailures=true')
+ expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), /\bthrowFailures=true\b/)
+ end
+
+ it 'can tell the jasmine page to randomize' do
+ allow(config).to receive(:random) { true }
+
+ ci_runner = Jasmine::CiRunner.new(config, thread: fake_thread, application_factory: application_factory, server_factory: server_factory, outputter: outputter)
+
+ ci_runner.run
+
+ expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), /\brandom=true\b/)
+ end
+
+ it 'allows randomization to be turned on, overriding the config' do
+ allow(config).to receive(:random) { false }
+
+ ci_runner = Jasmine::CiRunner.new(config, random: true, thread: fake_thread, application_factory: application_factory, server_factory: server_factory, outputter: outputter)
+
+ ci_runner.run
+
+ expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), /\brandom=true\b/)
+ end
+
+ it 'allows randomization to be turned off, overriding the config' do
+ allow(config).to receive(:random) { true }
+
+ ci_runner = Jasmine::CiRunner.new(config, random: false, thread: fake_thread, application_factory: application_factory, server_factory: server_factory, outputter: outputter)
+
+ ci_runner.run
+
+ expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), /\brandom=false\b/)
+ end
+
+ it 'allows a randomization seed to be specified' do
+ ci_runner = Jasmine::CiRunner.new(config, seed: '4231', thread: fake_thread, application_factory: application_factory, server_factory: server_factory, outputter: outputter)
+
+ ci_runner.run
+
+ expect(runner_factory).to have_received(:call).with(instance_of(Jasmine::Formatters::Multi), /\bseed=4231\b/)
end
end