From d859dcc95229362bd6da8a96e834c85901ac8a9f Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Thu, 14 Mar 2019 21:14:25 +0200 Subject: [PATCH] airbrake-ruby: don't raise error when there's no project id/key Fixes https://github.com/airbrake/airbrake/issues/931. (`Airbrake::Error: :project_id is required` is thrown for ignored environment) This is technically not a bug since we even test that we raise an error, but an oversight. --- CHANGELOG.md | 3 +++ lib/airbrake-ruby.rb | 7 ------- spec/airbrake_spec.rb | 14 -------------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5773babc..89e75844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ Airbrake Ruby Changelog ### master +* Stopped raising `Airbrake::Error` when configuring Airbrake without a project + id or project key ([#458](https://github.com/airbrake/airbrake-ruby/pull/458)) + ### [v4.2.0][v4.2.0] (March 7, 2019) * Added `Airbrake.notify_performance_breakdown` that sends performance data by diff --git a/lib/airbrake-ruby.rb b/lib/airbrake-ruby.rb index 55e750c4..2ffa277c 100644 --- a/lib/airbrake-ruby.rb +++ b/lib/airbrake-ruby.rb @@ -96,16 +96,9 @@ class << self # @return [void] # @raise [Airbrake::Error] when trying to reconfigure already # existing notifier - # @raise [Airbrake::Error] when either +project_id+ or +project_key+ - # is missing (or both) # @note There's no way to read config values outside of this library def configure yield config = Airbrake::Config.instance - - if (result = config.validate).rejected? - raise Airbrake::Error, result.value['error'] - end - Airbrake::Loggable.instance = config.logger end diff --git a/spec/airbrake_spec.rb b/spec/airbrake_spec.rb index 7cd2412a..121ade1c 100644 --- a/spec/airbrake_spec.rb +++ b/spec/airbrake_spec.rb @@ -22,19 +22,5 @@ expect(Airbrake::Loggable.instance).to eql(logger) end - - context "when user config doesn't contain a project id" do - it "raises error" do - expect { described_class.configure { |c| c.project_key = '1' } } - .to raise_error(Airbrake::Error, ':project_id is required') - end - end - - context "when user config doesn't contain a project key" do - it "raises error" do - expect { described_class.configure { |c| c.project_id = 1 } } - .to raise_error(Airbrake::Error, ':project_key is required') - end - end end end