Skip to content

Commit

Permalink
Address CI failure in Ruby 3.0+
Browse files Browse the repository at this point in the history
Since rspec-mocks v3.10.3, `with` now distinguishes between keyword args and hash in Ruby 3.
See rspec/rspec-mocks#1394 for details.
  • Loading branch information
mishina2228 committed Mar 22, 2022
1 parent 3786693 commit 14b0576
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion spec/uniform_notifier/airbrake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Airbrake
end

it 'should notify airbrake' do
expect(Airbrake).to receive(:notify).with(UniformNotifier::Exception.new('notify airbrake'), foo: :bar)
expect(Airbrake).to receive(:notify).with(UniformNotifier::Exception.new('notify airbrake'), { foo: :bar })

UniformNotifier.airbrake = { foo: :bar }
UniformNotifier::AirbrakeNotifier.out_of_channel_notify('notify airbrake')
Expand Down
4 changes: 2 additions & 2 deletions spec/uniform_notifier/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
context '#inline_channel_notify' do
before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
it 'should keep the compatibility' do
expect(UniformNotifier::Base).to receive(:_inline_notify).once.with(title: 'something')
expect(UniformNotifier::Base).to receive(:_inline_notify).once.with({ title: 'something' })
UniformNotifier::Base.inline_notify('something')
end
end
context '#out_of_channel_notify' do
before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
it 'should keep the compatibility' do
expect(UniformNotifier::Base).to receive(:_out_of_channel_notify).once.with(title: 'something')
expect(UniformNotifier::Base).to receive(:_out_of_channel_notify).once.with({ title: 'something' })
UniformNotifier::Base.out_of_channel_notify('something')
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/uniform_notifier/bugsnag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Bugsnag
UniformNotifier::Exception.new(notification_data)
).and_yield(report)
expect(report).to receive(:severity=).with('warning')
expect(report).to receive(:add_tab).with(:bullet, title: notification_data)
expect(report).to receive(:add_tab).with(:bullet, { title: notification_data })
expect(report).to receive(:grouping_hash=).with(notification_data)

UniformNotifier.bugsnag = true
Expand All @@ -37,7 +37,7 @@ class Bugsnag
expect(Bugsnag).to receive(:notify).with(
UniformNotifier::Exception.new(notification_data)
).and_yield(report)
expect(report).to receive(:meta_data=).with(foo: :bar)
expect(report).to receive(:meta_data=).with({ foo: :bar })

UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
Expand All @@ -62,7 +62,7 @@ class Bugsnag
expect(Bugsnag).to receive(:notify).with(
UniformNotifier::Exception.new(notification_data[:title])
).and_yield(report)
expect(report).to receive(:meta_data=).with(foo: :bar)
expect(report).to receive(:meta_data=).with({ foo: :bar })

UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
Expand Down
2 changes: 1 addition & 1 deletion spec/uniform_notifier/honeybadger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Honeybadger
end

it 'should notify honeybadger' do
expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), foo: :bar)
expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), { foo: :bar })

UniformNotifier.honeybadger = { foo: :bar }
UniformNotifier::HoneybadgerNotifier.out_of_channel_notify('notify honeybadger')
Expand Down
2 changes: 1 addition & 1 deletion spec/uniform_notifier/slack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

it 'should allow username and channel config options' do
expect(Slack::Notifier).to receive(:new)
.with('http://some.slack.url', username: 'The Dude', channel: '#carpets')
.with('http://some.slack.url', { username: 'The Dude', channel: '#carpets' })
.and_return(true)
UniformNotifier.slack = { webhook_url: 'http://some.slack.url', username: 'The Dude', channel: '#carpets' }
expect(UniformNotifier::Slack.active?).to eq true
Expand Down

0 comments on commit 14b0576

Please sign in to comment.