Skip to content

Commit

Permalink
airbrake-ruby: fix add_filter block API
Browse files Browse the repository at this point in the history
Fixes #8 (add_filter throwing exception)
  • Loading branch information
kyrylo committed Dec 22, 2015
1 parent 3afa58a commit 79dd070
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
Airbrake Ruby Changelog
=======================

### [v1.0.1][v1.0.1] (December 22, 2015)

* Fixed the `Airbrake.add_filter` block API
([#10](https://github.com/airbrake/airbrake-ruby/pull/10))

### [v1.0.0][v1.0.0] (December 18, 2015)

* Improved backtrace parsing support ([#4](https://github.com/airbrake/airbrake-ruby/pull/4))
* Improved backtrace parsing support
([#4](https://github.com/airbrake/airbrake-ruby/pull/4))

### [v1.0.0.rc.1][v1.0.0.rc.1] (December 11, 2015)

* Initial release

[v1.0.0.rc.1]: https://github.com/airbrake/airbrake-ruby/releases/tag/v1.0.0.rc.1
[v1.0.0]: https://github.com/airbrake/airbrake-ruby/releases/tag/v1.0.0
[v1.0.1]: https://github.com/airbrake/airbrake-ruby/releases/tag/v1.0.1
4 changes: 2 additions & 2 deletions lib/airbrake-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ def create_deploy(deploy_params, notifier = :default)
# Calls +method+ on +notifier+ with provided +args+.
#
# @raise [Airbrake::Error] if none of the notifiers exist
def call_notifier(notifier, method, *args)
def call_notifier(notifier, method, *args, &block)
if @notifiers.key?(notifier)
@notifiers[notifier].__send__(method, *args)
@notifiers[notifier].__send__(method, *args, &block)
else
raise Airbrake::Error,
"the '#{notifier}' notifier isn't configured"
Expand Down
14 changes: 13 additions & 1 deletion spec/airbrake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
end

before do
described_class.configure do |c|
@notifier = described_class.configure do |c|
c.project_id = 113743
c.project_key = 'fd04e13d806a90f96614ad8e529b2822'
end
Expand Down Expand Up @@ -161,6 +161,18 @@

describe ".add_filter" do
include_examples 'error handling', :add_filter

it "adds filters with help of blocks" do
filter_chain = @notifier.instance_variable_get(:@filter_chain)
filters = filter_chain.instance_variable_get(:@filters)

expect(filters.size).to eq(2)

described_class.add_filter {}

expect(filters.size).to eq(3)
expect(filters.last).to be_a(Proc)
end
end

describe ".whitelist_keys" do
Expand Down

0 comments on commit 79dd070

Please sign in to comment.