spec/punchblock/component/component_node_spec.rb in punchblock-1.6.1 vs spec/punchblock/component/component_node_spec.rb in punchblock-1.7.0
- old
+ new
@@ -26,11 +26,11 @@
add_event
subject.complete_event(0.5).should be == event
end
it "should call #complete!" do
- subject.expects(:complete!).once
+ subject.should_receive(:complete!).once
add_event
end
end
describe "with another event" do
@@ -53,11 +53,11 @@
describe "with an event handler set" do
let(:handler) { mock 'Response' }
before do
- handler.expects(:call).once.with(event)
+ handler.should_receive(:call).once.with(event)
subject.register_event_handler { |event| handler.call event }
end
it "should trigger the callback" do
subject.trigger_event_handler event
@@ -87,11 +87,13 @@
end
describe "#complete_event=" do
before do
subject.request!
- subject.execute!
+ subject.client = Client.new
+ subject.response = Ref.new id: 'abc'
+ subject.client.find_component_by_id('abc').should be subject
end
it "should set the command to executing status" do
subject.complete_event = :foo
subject.should be_complete
@@ -99,9 +101,14 @@
it "should be a no-op if the response has already been set" do
subject.complete_event = :foo
lambda { subject.complete_event = :bar }.should_not raise_error
subject.complete_event(0.5).should be == :foo
+ end
+
+ it "should remove the component from the registry" do
+ subject.complete_event = :foo
+ subject.client.find_component_by_id('abc').should be_nil
end
end
end # ComponentNode
end # Component
end # Punchblock