Skip to content

Instantly share code, notes, and snippets.

@nikeshashar
Created December 9, 2016 11:09
Show Gist options
  • Save nikeshashar/796b22bb732d445b07e65b940f08e53c to your computer and use it in GitHub Desktop.
Save nikeshashar/796b22bb732d445b07e65b940f08e53c to your computer and use it in GitHub Desktop.
Failures:
1) AceCard possible_scores returns low and high scores
Failure/Error:
expect(described_class.new(:ace).possible_scores)
.to eq([1, 11])
expected: [1, 11]
got: [1, 10]
(compared using ==)
# ./spec/ace_card_spec.rb:6:in `block (3 levels) in <top (required)>'
2) Game#over? delegates game_over enquiry to blackjack game
Failure/Error: blackjack.game_over
#<Double :blackjack> received unexpected message :game_over with (no args)
# ./lib/blackjack/game.rb:25:in `over?'
# ./spec/game_spec.rb:54:in `block (3 levels) in <top (required)>'
3) Hand#hit adds a random card to the card list
Failure/Error: raise "You're standing" if standing?
RuntimeError:
You're standing
# ./lib/blackjack/hand.rb:14:in `hit'
# ./spec/hand_spec.rb:31:in `block (3 levels) in <top (required)>'
4) Hand#hit raises if hit when bust
Failure/Error: expect { subject.hit }.to raise_error "You're bust"
expected Exception with "You're bust", got #<RuntimeError: You're standing> with backtrace:
# ./lib/blackjack/hand.rb:14:in `hit'
# ./spec/hand_spec.rb:45:in `block (4 levels) in <top (required)>'
# ./spec/hand_spec.rb:45:in `block (3 levels) in <top (required)>'
# ./spec/hand_spec.rb:45:in `block (3 levels) in <top (required)>'
5) Players#name returns the index (name) of the passed hand
Failure/Error: expect(hands).to receive(:find_index).with(hand)
(Double :hands).find_index(#<Double :hand>)
expected: 1 time with arguments: (#<Double :hand>)
received: 0 times
# ./spec/players_spec.rb:16:in `block (3 levels) in <top (required)>'
Finished in 0.05193 seconds (files took 0.22186 seconds to load)
49 examples, 5 failures
Failed examples:
rspec ./spec/ace_card_spec.rb:5 # AceCard possible_scores returns low and high scores
rspec ./spec/game_spec.rb:46 # Game#over? delegates game_over enquiry to blackjack game
rspec ./spec/hand_spec.rb:24 # Hand#hit adds a random card to the card list
rspec ./spec/hand_spec.rb:42 # Hand#hit raises if hit when bust
rspec ./spec/players_spec.rb:15 # Players#name returns the index (name) of the passed hand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment