Created
March 30, 2016 21:55
-
-
Save pshushereba/69569139ee44516e5326fb608c72c74d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe King, type: :model do | |
describe 'valid_move?' do | |
it 'should allow a vertical-up move' do | |
game = FactoryGirl.create(:game) | |
king = King.new(game: game, current_row_index: 5, current_column_index: 5) | |
expect(king.valid_move?(6,5)).to eq true | |
end | |
it 'should allow a vertical-down move' do | |
game = FactoryGirl.create(:game) | |
king = King.new(game: game, current_row_index: 5, current_column_index: 5) | |
expect(king.valid_move?(6,5)).to eq true | |
end | |
it 'should allow a horizonal-left move' do | |
game = FactoryGirl.create(:game) | |
king = King.new(game: game, current_row_index: 5, current_column_index: 5) | |
expect(king.valid_move?(5,4)).to eq true | |
end | |
it 'should allow a horizonal-right move' do | |
game = FactoryGirl.create(:game) | |
king = King.new(game: game, current_row_index: 5, current_column_index: 5) | |
expect(king.valid_move?(5,6)).to eq true | |
end | |
it 'should allow a diagonal-up-right move' do | |
game = FactoryGirl.create(:game) | |
king = King.new(game: game, current_row_index: 5, current_column_index: 5) | |
expect(king.valid_move?(4,6)).to eq true | |
end | |
it 'should allow a diagonal-up-left move' do | |
game = FactoryGirl.create(:game) | |
king = King.new(game: game, current_row_index: 5, current_column_index: 5) | |
expect(king.valid_move?(5,6)).to eq true | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment