Skip to content

Commit

Permalink
Fix RSpec deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnugget committed Nov 10, 2015
1 parent 4b2c74d commit 145b00f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions spec/pling/apn/gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
subject { Pling::APN::Gateway.new(valid_configuration) }

it 'should raise an error if no message is given' do
expect { subject.deliver(nil, device) }.to raise_error
expect { subject.deliver(nil, device) }.to raise_error(ArgumentError, /do not implement #to_pling_message/)
end

it 'should raise an error the device is given' do
expect { subject.deliver(message, nil) }.to raise_error
expect { subject.deliver(message, nil) }.to raise_error(ArgumentError, /do not implement #to_pling_device/)
end

it 'should initialize a new APN connection if none is established' do
Expand Down
4 changes: 2 additions & 2 deletions spec/pling/c2dm/gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@
end

it 'should raise an error if no message is given' do
expect { subject.deliver(nil, device) }.to raise_error
expect { subject.deliver(nil, device) }.to raise_error(ArgumentError, /do not implement #to_pling_message/)
end

it 'should raise an error the device is given' do
expect { subject.deliver(message, nil) }.to raise_error
expect { subject.deliver(message, nil) }.to raise_error(ArgumentError, /do not implement #to_pling_device/)
end

it 'should call #to_pling_message on the given message' do
Expand Down
2 changes: 1 addition & 1 deletion spec/pling/device_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

context 'when created with no arguments' do
it 'should not require an argument' do
expect { Pling::Device.new }.to_not raise_error ArgumentError
expect { Pling::Device.new }.to_not raise_error
end

specify { Pling::Device.new.should_not be_valid }
Expand Down
4 changes: 2 additions & 2 deletions spec/pling/gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
end

it 'should not raise an Pling::Errors if an on_exception callback is set' do
gateway = gateway_class.new(:on_exception => lambda {})
gateway = gateway_class.new(:on_exception => lambda {|_| })
gateway.stub(:deliver!).and_raise(Pling::Error)
expect { gateway.deliver(message, device) }.to_not raise_error Pling::Error
expect { gateway.deliver(message, device) }.to_not raise_error
end

it 'should pass the exception to the callback' do
Expand Down
4 changes: 2 additions & 2 deletions spec/pling/gcm/gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
end

it 'should raise an error if no message is given' do
expect { subject.deliver(nil, device) }.to raise_error
expect { subject.deliver(nil, device) }.to raise_error(ArgumentError, /do not implement #to_pling_message/)
end

it 'should raise an error the device is given' do
expect { subject.deliver(message, nil) }.to raise_error
expect { subject.deliver(message, nil) }.to raise_error(ArgumentError, /do not implement #to_pling_device/)
end

it 'should call #to_pling_message on the given message' do
Expand Down
2 changes: 1 addition & 1 deletion spec/pling/message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

context 'when created with no arguments' do
it 'should not require an argument' do
expect { Pling::Message.new() }.to_not raise_error ArgumentError
expect { Pling::Message.new() }.to_not raise_error
end

specify { Pling::Message.new().should_not be_valid }
Expand Down
4 changes: 2 additions & 2 deletions spec/pling_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
end

it 'should raise an error if no message is given' do
expect { Pling.deliver(nil, device) }.to raise_error
expect { Pling.deliver(nil, device) }.to raise_error(ArgumentError, /do not implement #to_pling_message/)
end

it 'should raise an error the device is given' do
expect { Pling.deliver(message, nil) }.to raise_error
expect { Pling.deliver(message, nil) }.to raise_error(ArgumentError, /do not implement #to_pling_device/)
end

it 'should call #to_pling_message on the given message' do
Expand Down
8 changes: 7 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
config.mock_with :rspec
config.mock_with :rspec do |mocks|
mocks.syntax = [:should, :expect]
end

config.expect_with :rspec do |expectations|
expectations.syntax = [:should, :expect]
end
end

0 comments on commit 145b00f

Please sign in to comment.