spec/punchblock/component/component_node_spec.rb in punchblock-2.5.2 vs spec/punchblock/component/component_node_spec.rb in punchblock-2.5.3
- old
+ new
@@ -22,25 +22,25 @@
let(:add_event) { subject.add_event event }
describe "with a complete event" do
it "should set the complete event resource" do
add_event
- subject.complete_event(0.5).should be == event
+ expect(subject.complete_event(0.5)).to eq(event)
end
it "should call #complete!" do
- subject.should_receive(:complete!).once
+ expect(subject).to receive(:complete!).once
add_event
end
end
describe "with another event" do
let(:event) { Event::Answered.new }
it "should not set the complete event resource" do
add_event
- subject.should_not be_complete
+ expect(subject).not_to be_complete
end
end
end # #add_event
describe "#trigger_event_handler" do
@@ -53,11 +53,11 @@
describe "with an event handler set" do
let(:handler) { double 'Response' }
before do
- handler.should_receive(:call).once.with(event)
+ expect(handler).to 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
@@ -77,37 +77,37 @@
Ref.new uri: uri
end
it "should set the component ID from the ref" do
subject.response = ref
- subject.component_id.should be == 'abc123'
- subject.source_uri.should be == uri
- subject.client.find_component_by_uri(uri).should be subject
+ expect(subject.component_id).to eq('abc123')
+ expect(subject.source_uri).to eq(uri)
+ expect(subject.client.find_component_by_uri(uri)).to be subject
end
end
describe "#complete_event=" do
before do
subject.request!
subject.client = Client.new
subject.response = Ref.new uri: 'abc'
- subject.client.find_component_by_uri('abc').should be subject
+ expect(subject.client.find_component_by_uri('abc')).to be subject
end
it "should set the command to executing status" do
subject.complete_event = :foo
- subject.should be_complete
+ expect(subject).to be_complete
end
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
+ expect { subject.complete_event = :bar }.not_to raise_error
+ expect(subject.complete_event(0.5)).to eq(:foo)
end
it "should remove the component from the registry" do
subject.complete_event = :foo
- subject.client.find_component_by_uri('abc').should be_nil
+ expect(subject.client.find_component_by_uri('abc')).to be_nil
end
end
end # ComponentNode
end # Component
end # Punchblock