Skip to content

Commit

Permalink
🔥 Remove copy-pasta from pecs
Browse files Browse the repository at this point in the history
  • Loading branch information
jcroteau committed Aug 17, 2023
1 parent ffec462 commit 2ed9fab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
13 changes: 1 addition & 12 deletions spec/services/deprecation_warnings/development_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,15 @@
module DeprecationWarnings
describe DevelopmentHandler do
context ".call" do
subject(:call) { described_class.call(message, callstack, deprecation_horizon, gem_name) }
subject(:call) { described_class.call(message, callstack = [], deprecation_horizon = "6.0", gem_name = "Rails") }

let(:message) { "dummy deprecation message" }
let(:callstack) { [] }
let(:deprecation_horizon) { "6.0" }
let(:gem_name) { "Rails" }

let(:rails_logger) { Rails.logger }
let(:slack_service) { SlackService.new(url: "dummy-url") }
let(:deploy_env) { ENV["DEPLOY_ENV"] }

before do
allow(Rails).to receive(:logger).and_return(rails_logger)
allow(rails_logger).to receive(:warn)

allow(Raven).to receive(:capture_message)
allow(Raven).to receive(:capture_exception)

allow(SlackService).to receive(:new).with(url: anything).and_return(slack_service)
allow(slack_service).to receive(:send_notification)
end

it "emits a warning to the application logs" do
Expand Down
17 changes: 1 addition & 16 deletions spec/services/deprecation_warnings/test_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,9 @@
module DeprecationWarnings
describe TestHandler do
context ".call" do
subject(:call) { described_class.call(message, callstack, deprecation_horizon, gem_name) }
subject(:call) { described_class.call(message, callstack = [], deprecation_horizon = "6.0", gem_name = "Rails") }

let(:message) { "dummy deprecation message" }
let(:callstack) { [] }
let(:deprecation_horizon) { "6.0" }
let(:gem_name) { "Rails" }

let(:rails_logger) { Rails.logger }
let(:slack_service) { SlackService.new(url: "dummy-url") }
let(:deploy_env) { ENV["DEPLOY_ENV"] }

before do
allow(Raven).to receive(:capture_message)
allow(Raven).to receive(:capture_exception)

allow(SlackService).to receive(:new).with(url: anything).and_return(slack_service)
allow(slack_service).to receive(:send_notification)
end

it "logs message to stderr" do
expect { call }.to output("#{message}\n").to_stderr
Expand Down

0 comments on commit 2ed9fab

Please sign in to comment.