Skip to content

Commit

Permalink
cleaned up formatting for final submission
Browse files Browse the repository at this point in the history
  • Loading branch information
dcardona23 committed Aug 27, 2024
1 parent 06a380b commit 13ba6c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 40 deletions.
13 changes: 3 additions & 10 deletions spec/deck_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,16 @@
expect(@deck).to be_instance_of(Deck)
end

it 'returns_cards' do
it 'loads cards into the deck' do
expect(@deck.cards).to eq(@cards)
end

it 'counts_cards' do
it 'counts the number of cards in the deck' do
expect(@deck.count).to eq(3)
end

it 'identifies cards in each category' do
it 'identifies all of the cards in each category' do
expect(@deck.cards_in_category(:STEM)).to eq([@card_2, @card_3])
expect(@deck.cards_in_category(:Geography)).to eq([@card_1])
end

it 'can_add_cards' do
card_4 = Card.new("What is Danielle's cat's name", "Furriosa", :Turing_students)

expect(@deck.add_card(card_4)). to eq([@card_1, @card_2, @card_3, card_4])
end

end
33 changes: 16 additions & 17 deletions spec/round_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require './lib/turn'
require './lib/deck'
require './lib/round'
require 'pry'

RSpec.describe Round do

Expand All @@ -21,51 +20,51 @@
expect(@round).to be_instance_of(Round)
end

it 'loads_deck_into_round' do
it 'loads the deck into the round' do
expect(@round.deck).to eq(@deck)
end

it 'starts_turns' do
it 'starts the turn with an empty turns array' do
expect(@round.turns).to eq([])
end

it 'pulls_current_card' do
it 'pulls the current card in the deck' do
expect(@round.current_card).to eq(@card_1)
end

it 'starts_with_empty_turns_array' do
expect(@round.turns).to eq([])
end

it 'logs the new turn into the turns array' do
it 'logs each new turn into the turns array' do
new_turn = @round.take_turn("Juneau")

expect(@round.turns.last).to eq(new_turn)
# require 'pry'; binding.pry
end

it 'add to number correct' do
it 'add correct answers to the number correct counter' do
new_turn = @round.take_turn("Juneau")

expect(@round.number_correct).to eq(1)
end

it 'identifies percent correct' do
it 'identifies the percent of correct answers per round' do
new_turn = @round.take_turn("Juneau")

expect(@round.percent_correct).to eq(100)
end

it 'identifies number of cards correct by category' do
it 'identifies the number of correct answers in the round by category' do
new_turn = @round.take_turn("Juneau")
# require 'pry'; binding.pry

expect(@round.number_correct_by_category(:Geography)).to eq(1)
end

it 'adds to number correct by category' do
it 'calculates the percent of correct answers in the round by category' do
new_turn = @round.take_turn("Juneau")
# require 'pry'; binding.pry

expect(@round.percent_correct_by_category(:Geography)).to eq(100)
end


it 'identifies each unique category in the round' do
new_turn = @round.take_turn("Juneau")

expect(@round.deck.cards.map(&:category).uniq).to eq([:Geography, :STEM])
end
end
25 changes: 12 additions & 13 deletions spec/turn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,43 @@
require './lib/turn'

RSpec.describe Turn do

before(:each) do
@card = Card.new("What is the capital of Alaska?", "Juneau", :Geography)
end

it 'exists' do
card = Card.new("What is the capital of Alaska?", "Juneau", :Geography)
turn = Turn.new("Juneau", card)
turn = Turn.new("Juneau", @card)

expect(turn).to be_instance_of(Turn)
end

it 'is Juneau by default' do
card = Card.new("What is the capital of Alaska?", "Juneau", :Geography)
turn = Turn.new("Juneau", card)
turn = Turn.new("Juneau", @card)

expect(turn.guess).to eq("Juneau")
end

it "does not have to be Juneau" do
card = Card.new("What is the capital of Alaska?", "Juneau", :Geography)
turn = Turn.new("Spain", card)
turn = Turn.new("Spain", @card)

expect(turn.guess).to eq("Spain")
end

it 'returns the Card' do
card = Card.new("What is the capital of Alaska?", "Juneau", :Geography)
turn = Turn.new("Juneau", card)
turn = Turn.new("Juneau", @card)

expect(turn.card).to eq(card)
expect(turn.card).to eq(@card)
end

it 'indicates if the guess matched the answer on the card' do
card = Card.new("What is the capital of Alaska?", "Juneau", :Geography)
turn = Turn.new("Juneau", card)
turn = Turn.new("Juneau", @card)

expect(turn.correct?).to eq(true)
end

it 'provides feedback' do
card = Card.new("What is the capital of Alaska?", "Juneau", :Geography)
turn = Turn.new("Juneau", card)
turn = Turn.new("Juneau", @card)

expect(turn.feedback).to eq("Correct!")
end
Expand Down

0 comments on commit 13ba6c8

Please sign in to comment.