Last active
August 29, 2015 13:58
-
-
Save ejlangev/9937830 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
feature "Short Messaging" do | |
let(:member) { create(:member) } | |
let(:admin) { create(:admin) } | |
let(:message) { | |
GrouperShortMessager.custom_message(message, admin, "Hello, World!") | |
} | |
around do |example| | |
previous_value = Resque.inline | |
Resque.inline = true | |
example.run | |
Resque.inline = previous_value | |
end | |
scenario "delivering a message from swordfish to a member" do | |
# Make sure it enqueues a resque job | |
expect(ShortMessages::DeliverJob).to receive(:enqueue).and_call_original | |
# Make sure the resque job works correctly | |
expect { message.deliver }.to change { stubbed_sms.count }.by(1) | |
end | |
scenario "delivering a delayed message to a member" do | |
expect(ShortMessages::DeliverJob).to_not recieve(:enqueue) | |
time_travel_to(Time.now + 11.minutes) | |
expect { | |
SmsMessages::SendQueuedMessagesJob.perform | |
}.to change { stubbed_sms.count }.by (1) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment