Skip to content

Commit

Permalink
Merge pull request #458 from airbrake/931-required-options-fix
Browse files Browse the repository at this point in the history
airbrake-ruby: don't raise error when there's no project id/key
  • Loading branch information
kyrylo authored Mar 14, 2019
2 parents ad24eb2 + d859dcc commit 905ea49
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions lib/airbrake-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 0 additions & 14 deletions spec/airbrake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 905ea49

Please sign in to comment.