Sha256: 9dc042ee80bd1a4e553336395d6020e068aac38fed6e37b8e14fe2698cabe2fb

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

require_relative "spec_helper"

describe TriviaCrack::Game do

  let(:game_id) { 1111 }
  let(:game) { TriviaCrack::Game.new id: game_id, my_turn: my_turn, game_status: game_status }

  describe "#playable?" do

    subject { game.playable? }

    context 'when the game status is active' do
      let(:game_status) { :active }

      context 'and it is the users turn' do
        let(:my_turn) { true }

        it { is_expected.to be true }
      end

      context 'and it is not the users turn' do
        let(:my_turn) { false }

        it { is_expected.to be false }
      end
    end

    context 'when the game status is pending_approval' do
      let(:game_status) { :pending_approval }

      context 'and it is the users turn' do
        let(:my_turn) { true }

        it { is_expected.to be true }
      end

      context 'and it is not the users turn' do
        let(:my_turn) { false }

        it { is_expected.to be false }
      end
    end

    context 'when the game status is ended' do
      let(:game_status) { :ended }

      context 'and it is the users turn' do
        let(:my_turn) { true }

        it { is_expected.to be false }
      end

      context 'and it is not the users turn' do
        let(:my_turn) { false }

        it { is_expected.to be false }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
triviacrack-0.6.0 spec/game_spec.rb
triviacrack-0.5.1 spec/game_spec.rb
triviacrack-0.5.0 spec/game_spec.rb
triviacrack-0.4.0 spec/game_spec.rb
triviacrack-0.3.2 spec/game_spec.rb
triviacrack-0.3.0 spec/game_spec.rb
triviacrack-0.2.0 spec/game_spec.rb
triviacrack-0.1.0 spec/game_spec.rb