forked from openSUSE/open-build-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
RSpec.describe MeasurementsJob do | ||
before do | ||
rabbit_mock = Class.new do | ||
attr_reader :metrics | ||
|
||
def initialize | ||
@metrics = {} | ||
end | ||
|
||
def metrics_sent | ||
@metrics | ||
end | ||
|
||
def send_to_bus(category, data) | ||
@metrics[category] = [] unless @metrics[category] | ||
@metrics[category] << data | ||
end | ||
end | ||
stub_const('RabbitMock', rabbit_mock) | ||
end | ||
|
||
describe 'token workflows' do | ||
it 'gathers some intelligence about our token workflow runs' do | ||
allow(RabbitmqBus).to receive(:send_to_bus) | ||
|
||
MeasurementsJob.new.perform({ 'amqp_options' => true }) | ||
|
||
expect(RabbitmqBus).to have_received(:send_to_bus) | ||
.with('metrics', 'token_workflow total_count=0,enabled=0,disabled=0,custom_configuration_path=0,custom_configuration_url=0,user_with_tokens=0,groups_sharing_tokens=0') | ||
.at_least(1).times | ||
end | ||
end | ||
end |