Sha256: f8f2402e2d1d0efab3da954c848ba2f33039c5710059e72a2fd6ae13253a26c9

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

require 'mastermind/interact'
require 'mastermind/player'

RSpec.describe Mastermind::Interact do
  before do
    @interact = Mastermind::Interact.new
  end

  it 'can return a colored string given a string input' do
    colored = @interact.color_guess("R")
    expect(colored).to eql("\e[0;31;49mR\e[0m")
  end

  it 'prints an intro title' do
    expect(@interact.print_title).to include("0;32;49m")
  end

  it 'prints the main menu' do
    expect(@interact.print_intro).to include("(i)")
  end

  it 'prints an invalid command message' do
    invalid_cmd = "XXXX"
    expect(@interact.print_invalid(invalid_cmd)).to include("not a valid")
    expect(@interact.print_invalid(invalid_cmd)).to include(invalid_cmd)
  end

  it 'prints a round over message' do
    expect(@interact.print_round_over).to include("Round over")
  end

  it 'prints an invalid guess message' do
    player = Mastermind::Player.new("Steve")
    expect(@interact.print_invalid_guess(player)).to include("not a valid")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mastermind-nowsiany-1.0.3 spec/interact_spec.rb