From 72e1fd33880381963bb3d9c80909f1b94359f367 Mon Sep 17 00:00:00 2001 From: emestabillo Date: Tue, 18 Jul 2017 21:56:40 -0400 Subject: [PATCH 1/2] Created piece model --- app/models/piece.rb | 2 ++ db/migrate/20170719014442_create_pieces.rb | 15 +++++++++++++++ test/fixtures/pieces.yml | 11 +++++++++++ test/models/piece_test.rb | 7 +++++++ 4 files changed, 35 insertions(+) create mode 100644 app/models/piece.rb create mode 100644 db/migrate/20170719014442_create_pieces.rb create mode 100644 test/fixtures/pieces.yml create mode 100644 test/models/piece_test.rb diff --git a/app/models/piece.rb b/app/models/piece.rb new file mode 100644 index 0000000..f00f4a7 --- /dev/null +++ b/app/models/piece.rb @@ -0,0 +1,2 @@ +class Piece < ApplicationRecord +end diff --git a/db/migrate/20170719014442_create_pieces.rb b/db/migrate/20170719014442_create_pieces.rb new file mode 100644 index 0000000..875f682 --- /dev/null +++ b/db/migrate/20170719014442_create_pieces.rb @@ -0,0 +1,15 @@ +class CreatePieces < ActiveRecord::Migration[5.0] + def change + create_table :pieces do |t| + t.string :type + t.string :color + t.integer :x_position + t.integer :y_position + t.integer :game_id + t.integer :user_id + t.boolean :captured + + t.timestamps + end + end +end diff --git a/test/fixtures/pieces.yml b/test/fixtures/pieces.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/pieces.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/piece_test.rb b/test/models/piece_test.rb new file mode 100644 index 0000000..559c19c --- /dev/null +++ b/test/models/piece_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PieceTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 921e2aa79181ce115a874b06463155c0ce680664 Mon Sep 17 00:00:00 2001 From: emestabillo Date: Tue, 18 Jul 2017 22:21:47 -0400 Subject: [PATCH 2/2] Created model files for bishop, knight, and king --- app/models/bishop.rb | 2 ++ app/models/king.rb | 2 ++ app/models/knight.rb | 2 ++ test/fixtures/bishops.yml | 11 +++++++++++ test/fixtures/kings.yml | 11 +++++++++++ test/fixtures/knights.yml | 11 +++++++++++ test/models/bishop_test.rb | 7 +++++++ test/models/king_test.rb | 7 +++++++ test/models/knight_test.rb | 7 +++++++ 9 files changed, 60 insertions(+) create mode 100644 app/models/bishop.rb create mode 100644 app/models/king.rb create mode 100644 app/models/knight.rb create mode 100644 test/fixtures/bishops.yml create mode 100644 test/fixtures/kings.yml create mode 100644 test/fixtures/knights.yml create mode 100644 test/models/bishop_test.rb create mode 100644 test/models/king_test.rb create mode 100644 test/models/knight_test.rb diff --git a/app/models/bishop.rb b/app/models/bishop.rb new file mode 100644 index 0000000..bbc31a9 --- /dev/null +++ b/app/models/bishop.rb @@ -0,0 +1,2 @@ +class Bishop < Piece +end diff --git a/app/models/king.rb b/app/models/king.rb new file mode 100644 index 0000000..dd0d8a5 --- /dev/null +++ b/app/models/king.rb @@ -0,0 +1,2 @@ +class King < Piece +end diff --git a/app/models/knight.rb b/app/models/knight.rb new file mode 100644 index 0000000..a709835 --- /dev/null +++ b/app/models/knight.rb @@ -0,0 +1,2 @@ +class Knight < Piece +end diff --git a/test/fixtures/bishops.yml b/test/fixtures/bishops.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/bishops.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/kings.yml b/test/fixtures/kings.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/kings.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/knights.yml b/test/fixtures/knights.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/knights.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/bishop_test.rb b/test/models/bishop_test.rb new file mode 100644 index 0000000..da68805 --- /dev/null +++ b/test/models/bishop_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class BishopTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/king_test.rb b/test/models/king_test.rb new file mode 100644 index 0000000..731248e --- /dev/null +++ b/test/models/king_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class KingTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/knight_test.rb b/test/models/knight_test.rb new file mode 100644 index 0000000..fa469e8 --- /dev/null +++ b/test/models/knight_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class KnightTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end