Sha256: 54927752df565ba3d353b2fedfb5852a679a8a3e94f7c398f5870518cc23ebcc
Contents?: true
Size: 1.31 KB
Versions: 5
Compression:
Stored size: 1.31 KB
Contents
require 'spec_helper' describe Rearview::MetricsValidatorService do before do Celluloid.shutdown Celluloid.boot @service = Rearview::MetricsValidatorService.new end context '#startup' do it "can only be started if stopped" do Rearview::MetricsValidatorTask.stubs(:supervise).returns(mock) @service.startup expect { @service.startup }.to raise_error("service already started") end it "should create the supervised task" do Rearview::MetricsValidatorTask.expects(:supervise) @service.startup end end context '#shutdown' do it "can only be shutdown if started" do expect { @service.shutdown }.to raise_error("service not started") end it "should terminate the supervised task" do mock_task = mock mock_task.expects(:terminate).once Rearview::MetricsValidatorTask.stubs(:supervise).returns(stub(:actors => stub(:first => mock_task))) @service.startup @service.shutdown end end context '#started?' do it "should be true if the service is started" do Rearview::MetricsValidatorTask.stubs(:supervise).returns(mock) @service.startup expect(@service.started?).to be_true end it "should be false if the service is not started" do expect(@service.started?).to be_false end end end
Version data entries
5 entries across 5 versions & 1 rubygems