Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queue: add #route for API compatibility #539

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

* Added `Airbrake::Queue#route` for filter API compatibility. It always returns
an empty string ([#539](https://github.com/airbrake/airbrake-ruby/pull/539))

### [v4.12.0][v4.12.0] (January 7, 2020)

* Added a new option called `job_stats`, which controls whether the library
Expand Down
9 changes: 9 additions & 0 deletions lib/airbrake-ruby/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ def hash
def merge(other)
self.error_count += other.error_count
end

# Queues don't have routes, but we want to define this to make sure our
# filter API is consistent (other models define this property)
#
# @return [String] empty route
# @see https://github.com/airbrake/airbrake-ruby/pull/537
def route
''
end
end
# rubocop:enable Metrics/BlockLength, Metrics/ParameterLists
end
9 changes: 9 additions & 0 deletions spec/queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@
expect(queue.end_time).to eq(time + 1)
end
end

describe "#route" do
it "always returns an empty route" do
queue = described_class.new(
queue: 'a', error_count: 0, start_time: Time.now,
)
expect(queue.route).to be_empty
end
end
end