-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72b5a7a
commit 77489ae
Showing
3 changed files
with
62 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require_relative '../author' | ||
|
||
describe Author do | ||
let(:author) { Author.new('John', 'Doe') } | ||
|
||
describe '#add_item' do | ||
context 'when the item is a game' do | ||
it 'adds the item to the author' do | ||
author.add_item(game) | ||
expect(author.items).to include(game) | ||
end | ||
it 'sets the author of the game' do | ||
author.add_item(game) | ||
expect(game.author).to eq(author) | ||
end | ||
end | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require_relative '../game' | ||
describe Game do | ||
let(:game) { Game.new(publish_date, archived, multiplayer, last_played_at, author) } | ||
let(:publish_date) { '2012-01-01' } | ||
let(:archived) { false } | ||
let(:multiplayer) { true } | ||
let(:last_played_at) { '2014-01-01' } | ||
let(:author) { Author.new('John', 'Doe') } | ||
describe '#can_be_archived?' do | ||
context 'when the game is archived and last played over two years ago' do | ||
let(:archived) { true } | ||
let(:last_played_at) { '2014-01-01' } | ||
it 'returns true' do | ||
expect(game.can_be_archived?).to eq(true) | ||
end | ||
end | ||
context 'when the game is not archived' do | ||
let(:archived) { false } | ||
context 'and the game was last played over two years ago' do | ||
let(:last_played_at) { '2014-01-01' } | ||
it 'returns false' do | ||
expect(game.can_be_archived?).to eq(true) | ||
end | ||
end | ||
context 'and the game was last played less than two years ago' do | ||
let(:last_played_at) { '2015-01-01' } | ||
it 'returns false' do | ||
expect(game.can_be_archived?).to eq(true) | ||
end | ||
end | ||
end | ||
context 'when the game is archived' do | ||
let(:archived) { true } | ||
context 'and the game was last played over two years ago' do | ||
let(:last_played_at) { '2014-01-01' } | ||
it 'returns true' do | ||
expect(game.can_be_archived?).to eq(true) | ||
end | ||
end | ||
end | ||
end | ||
end |