Sha256: a057372528f508adb9953a78444a397dc6d6c2f210635e11a407cf5e98e0cb28

Contents?: true

Size: 881 Bytes

Versions: 1

Compression:

Stored size: 881 Bytes

Contents

require_relative '../../lib/threesmodel'

Before do
end

Given(/^a new game is started$/) do
   @game_controller = Threesmodel::GameController.new
   @game_state = @game_controller.start_new_game
end

Then(/^an id is attached to the game$/) do
  expect(@game_state[:id]).to_not eq(nil)
end

Then(/^the game is not over$/) do
  expect(@game_state[:game_over]).to eq(false)
end

Then(/^the game board has (\d+) cells filled$/) do |filled_cells|
  c = []
  values = @game_state[:game].row_vectors.each{|row|
    c << row.to_a
  }
  c.flatten!
  d = c.find_all{|item| item > 0}
  expect(d.size).to eq(9)
end

Then(/^the board contains no other but the following numbers:$/) do |table|
  data = table.raw[0]
  c = []
  values = @game_state[:game].row_vectors.each{|row|
    c << row.to_a
  }
  c.flatten!.uniq!
  data.each{|value|
    expect(c.include?(value.to_i)).to eq(true)
  }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
threesmodel-0.0.3 features/steps/game_play_steps.rb