spec/runner_spec.rb in mirage-2.4.1 vs spec/runner_spec.rb in mirage-2.4.2
- old
+ new
@@ -11,11 +11,12 @@
Runner.should_receive(:new).and_return(@runner)
end
it 'should start Mirage on port 7001 by default' do
@runner.should_receive(:invoke).with(:start, [], {:port => 7001})
- Mirage.start
+ client = Mirage.start
+ client.should == Mirage::Client.new
end
it 'should start mirage on the given port' do
options = {:port => 9001}
@runner.should_receive(:invoke).with(:start, [], options)
@@ -45,27 +46,34 @@
end
describe Mirage::Runner do
it 'should stop the running instance of Mirage' do
-
+ options = {:port => []}
runner = Mirage::Runner.new
- runner.should_receive(:mirage_process_ids).with([:all]).any_number_of_times.and_return({"7001" => "18901"})
+ runner.options = options
+ runner.should_receive(:mirage_process_ids).with([]).any_number_of_times.and_return({"7001" => "18901"})
+
runner.should_receive(:kill).with("18901") do
runner.rspec_reset
- runner.should_receive(:mirage_process_ids).with([:all]).any_number_of_times.and_return({})
+ runner.should_receive(:mirage_process_ids).with([]).any_number_of_times.and_return({})
end
- runner.stop
+ Mirage::Runner.should_receive(:new).and_return(runner)
+ runner.invoke(:stop, [], options)
end
it 'should not stop any instances when more than one is running' do
+ options = {:port => []}
runner = Mirage::Runner.new
- runner.should_receive(:mirage_process_ids).with([:all]).any_number_of_times.and_return({"7001" => "18901", "7002" => "18902", "7003" => "18903"})
+ runner.options = options
+
+ runner.should_receive(:mirage_process_ids).with([]).any_number_of_times.and_return({"7001" => "18901", "7002" => "18902", "7003" => "18903"})
runner.should_not_receive(:kill)
+ Mirage::Runner.should_receive(:new).and_return(runner)
- lambda { runner.stop }.should raise_error(Mirage::ClientError)
+ lambda { runner.invoke(:stop, [], options) }.should raise_error(Mirage::ClientError)
end
it 'should stop the instance running on the given port' do
options = {:port => [7001]}
\ No newline at end of file