-
Notifications
You must be signed in to change notification settings - Fork 749
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix medication refill bug for Google Calendar upload (#1278)
* Fix medication refill bug for Google Calendar upload * Add more tests
- Loading branch information
1 parent
7d2fdbe
commit 5650089
Showing
3 changed files
with
28 additions
and
13 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
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 |
---|---|---|
@@ -1,19 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
describe CalendarUploader do | ||
it 'uploads an event to Google Calendar' do | ||
service = double | ||
let(:service) { double } | ||
|
||
before(:each) do | ||
allow(service).to receive_message_chain(:insert_event) | ||
allow(service).to receive_message_chain(:authorization=, :access_token=) | ||
end | ||
|
||
uploader = CalendarUploader.new(summary: 'an exciting event', | ||
date: '2015/02/14', | ||
access_token: 'a token', | ||
email: 'an email', | ||
service: service) | ||
context 'date is a string' do | ||
it 'uploads an event to Google Calendar' do | ||
uploader = CalendarUploader.new(summary: 'an exciting event', | ||
date: '2015/02/14', | ||
access_token: 'a token', | ||
email: 'an email', | ||
service: service) | ||
|
||
expect(service).to receive(:insert_event) | ||
uploader.upload_event | ||
end | ||
end | ||
|
||
expect(service).to receive(:insert_event) | ||
context 'date is a DateTime object' do | ||
it 'uploads an event to Google Calendar' do | ||
uploader = CalendarUploader.new(summary: 'an exciting event', | ||
date: DateTime.now, | ||
access_token: 'a token', | ||
email: 'an email', | ||
service: service) | ||
|
||
uploader.upload_event | ||
expect(service).to receive(:insert_event) | ||
uploader.upload_event | ||
end | ||
end | ||
end |