Skip to content

Instantly share code, notes, and snippets.

@ilyakrasnov
Last active November 20, 2017 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyakrasnov/156b2d77677003ac8cf3eb82a276c758 to your computer and use it in GitHub Desktop.
Save ilyakrasnov/156b2d77677003ac8cf3eb82a276c758 to your computer and use it in GitHub Desktop.
FactoryBot.define do
factory :user do
sequence :email do |n|
"sampleEmails#{n}@gmail.com"
end
password "secretPassword"
password_confirmation "secretPassword"
end
factory :game do
association :white_player, factory: :user
association :black_player, factory: :user
end
end
...
it "should return true because it is obstructed" do
game = FactoryBot.create(:game)
piece1 = game.pieces.create(position_x: 7, position_y: 7, game_id: game.id)
piece2 = game.pieces.create(position_x: 7, position_y: 5, game_id: game.id)
variable = piece1.is_obstructed?(game,[7,3])
expect(variable).to eq(true)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment