-
-
Save yorickpeterse/c46ccc370864cbf4751a to your computer and use it in GitHub Desktop.
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
require 'spec_helper' | |
describe Agora::Scheduler::Report do | |
before do | |
@scheduler = described_class.new('foo') | |
end | |
describe '#schedule' do | |
before do | |
@queue = AWS::SQS::Queue.new('foo') | |
@scheduler.stub(:queue).and_return(@queue) | |
end | |
it 'schedules the report' do | |
start_date = Date.new(2015, 4, 1) | |
end_date = Date.new(2015, 4, -1) | |
company_ids = [1, 2] | |
group_ids = [3, 4] | |
json = JSON.dump( | |
:start_date => start_date, | |
:end_date => end_date, | |
:company_ids => company_ids, | |
:group_ids => group_ids, | |
:identifier => 'foo', | |
:report_request_id => 123 | |
) | |
@queue.should_receive(:send_message).with(json) | |
@scheduler.schedule(123, start_date, end_date, company_ids, group_ids) | |
end | |
end | |
describe '#queue_name' do | |
it 'returns the name of the queue' do | |
@scheduler.queue_name.should be_an_instance_of(String) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment