Created
May 8, 2018 09:23
-
-
Save stevo/ea9477218f5765ae16b60c15a1c383b5 to your computer and use it in GitHub Desktop.
An opinionated guide to readable RSpec (part 2 of 2)
This file contains hidden or 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
it 'returns accounts expired in last week' do | |
account_1 = create(:account, expiry_date: 1.day.ago) | |
account_2 = create(:account, expiry_date: 7.days.ago) | |
result = RecentlyExpiredAccountsQuery.call | |
expect(result).to match_array([account_1, account_2]) | |
end | |
it 'does not return accounts expiring in the future' do | |
create(:account, expiry_date: 1.day.from_now) | |
result = RecentlyExpiredAccountsQuery.call | |
expect(result).to be_empty | |
end | |
it 'does not return accounts expiring today' do | |
create(:account, expiry_date: Date.current) | |
result = RecentlyExpiredAccountsQuery.call | |
expect(result).to be_empty | |
end | |
it 'does not return accounts expiring more than one week earlier' do | |
create(:account, expiry_date: 8.days.ago) | |
result = RecentlyExpiredAccountsQuery.call | |
expect(result).to be_empty | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment