Last active
January 4, 2016 09:39
-
-
Save laser/8603665 to your computer and use it in GitHub Desktop.
array combiner
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
# Account = Struct.new(:id, :last_active) | |
describe 'pruning expired accounts' do | |
let(:acc1) { Account.new(1, Date.today) } | |
let(:acc2) { Account.new(2, Date.today) } | |
let(:acc3) { Account.new(3, Date.today) } | |
describe 'when the first account is expired' do | |
let(:acc1) { Account.new(1, Date.today - 45) } | |
describe 'when the second account is expired' do | |
let(:acc2) { Account.new(1, Date.today - 45) } | |
describe 'when the third account is not expired' do | |
it 'returns the third account' do | |
expect(AccountPruner.prune(acc1, acc2, acc3)).to eq([acc3]) | |
end | |
end | |
describe 'when the third account is expired' do | |
let(:acc3) { Account.new(1, Date.today - 45) } | |
it 'returns no accounts' do | |
expect(AccountPruner.prune(acc1, acc2, acc3)).to eq([]) | |
end | |
end | |
end | |
# ...continue for all combinations we want to test | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment