spec/punchblock/event/complete_spec.rb in punchblock-2.5.2 vs spec/punchblock/event/complete_spec.rb in punchblock-2.5.3
- old
+ new
@@ -4,21 +4,22 @@
module Punchblock
class Event
describe Complete do
it 'registers itself' do
- RayoNode.class_from_registration(:complete, 'urn:xmpp:rayo:ext:1').should be == described_class
+ expect(RayoNode.class_from_registration(:complete, 'urn:xmpp:rayo:ext:1')).to eq(described_class)
end
describe "setting a reason" do
let(:reason) { Complete::Stop.new }
- subject { described_class.new }
-
- before { subject.reason = reason }
-
- its(:reason) { should == reason }
+ describe '#reason' do
+ it "should set the reason" do
+ subject.reason = reason
+ subject.reason.should == reason
+ end
+ end
end
describe "comparing for equality" do
subject do
described_class.new reason: Complete::Stop.new,
@@ -36,41 +37,41 @@
let(:reason) { Complete::Stop.new }
let(:call_id) { '1234' }
let(:component_id) { 'abcd' }
it "should be equal" do
- subject.should be == other_complete
+ expect(subject).to eq(other_complete)
end
end
context 'with a different reason' do
let(:reason) { Complete::Hangup.new }
let(:call_id) { '1234' }
let(:component_id) { 'abcd' }
it "should not be equal" do
- subject.should_not be == other_complete
+ expect(subject).not_to eq(other_complete)
end
end
context 'with a different call id' do
let(:reason) { Complete::Stop.new }
let(:call_id) { '5678' }
let(:component_id) { 'abcd' }
it "should not be equal" do
- subject.should_not be == other_complete
+ expect(subject).not_to eq(other_complete)
end
end
context 'with a different component id' do
let(:reason) { Complete::Stop.new }
let(:call_id) { '1234' }
let(:component_id) { 'efgh' }
it "should not be equal" do
- subject.should_not be == other_complete
+ expect(subject).not_to eq(other_complete)
end
end
end
describe "from a stanza" do
@@ -86,11 +87,14 @@
it { should be_instance_of described_class }
it_should_behave_like 'event'
- its(:reason) { should be_instance_of Complete::Stop }
+ describe '#reason' do
+ subject { super().reason }
+ it { should be_instance_of Complete::Stop }
+ end
end
end
describe Complete::Stop do
let :stanza do
@@ -103,11 +107,14 @@
subject { RayoNode.from_xml(parse_stanza(stanza).root).reason }
it { should be_instance_of Complete::Stop }
- its(:name) { should be == :stop }
+ describe '#name' do
+ subject { super().name }
+ it { should be == :stop }
+ end
end
describe Complete::Hangup do
let :stanza do
<<-MESSAGE
@@ -119,11 +126,14 @@
subject { RayoNode.from_xml(parse_stanza(stanza).root).reason }
it { should be_instance_of Complete::Hangup }
- its(:name) { should be == :hangup }
+ describe '#name' do
+ subject { super().name }
+ it { should be == :hangup }
+ end
end
describe Complete::Error do
let :stanza do
<<-MESSAGE
@@ -137,18 +147,28 @@
subject { RayoNode.from_xml(parse_stanza(stanza).root).reason }
it { should be_instance_of Complete::Error }
- its(:name) { should be == :error }
- its(:details) { should be == "Something really bad happened" }
+ describe '#name' do
+ subject { super().name }
+ it { should be == :error }
+ end
+ describe '#details' do
+ subject { super().details }
+ it { should be == "Something really bad happened" }
+ end
+
describe "when setting options in initializer" do
subject do
Complete::Error.new :details => 'Ooops'
end
- its(:details) { should be == 'Ooops' }
+ describe '#details' do
+ subject { super().details }
+ it { should be == 'Ooops' }
+ end
end
end
describe Complete::Reason do
subject { Complete::Reason.new name: "Foo" }