From 3a7b14f4a51c0fdb8b71720f361a0a8ccf080325 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 27 Feb 2014 16:59:04 -0500 Subject: add game types --- test/controllers/games_controller_test.rb | 49 +++++++++++++++++++++++++++++++ test/fixtures/game_attributes.yml | 11 +++++++ test/fixtures/games.yml | 7 +++++ test/helpers/games_helper_test.rb | 4 +++ test/models/game_attribute_test.rb | 7 +++++ test/models/game_test.rb | 7 +++++ 6 files changed, 85 insertions(+) create mode 100644 test/controllers/games_controller_test.rb create mode 100644 test/fixtures/game_attributes.yml create mode 100644 test/fixtures/games.yml create mode 100644 test/helpers/games_helper_test.rb create mode 100644 test/models/game_attribute_test.rb create mode 100644 test/models/game_test.rb (limited to 'test') diff --git a/test/controllers/games_controller_test.rb b/test/controllers/games_controller_test.rb new file mode 100644 index 0000000..420758e --- /dev/null +++ b/test/controllers/games_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class GamesControllerTest < ActionController::TestCase + setup do + @game = games(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:games) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create game" do + assert_difference('Game.count') do + post :create, game: { name: @game.name } + end + + assert_redirected_to game_path(assigns(:game)) + end + + test "should show game" do + get :show, id: @game + assert_response :success + end + + test "should get edit" do + get :edit, id: @game + assert_response :success + end + + test "should update game" do + patch :update, id: @game, game: { name: @game.name } + assert_redirected_to game_path(assigns(:game)) + end + + test "should destroy game" do + assert_difference('Game.count', -1) do + delete :destroy, id: @game + end + + assert_redirected_to games_path + end +end diff --git a/test/fixtures/game_attributes.yml b/test/fixtures/game_attributes.yml new file mode 100644 index 0000000..eff7212 --- /dev/null +++ b/test/fixtures/game_attributes.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + game_id: + key: MyText + type: 1 + +two: + game_id: + key: MyText + type: 1 diff --git a/test/fixtures/games.yml b/test/fixtures/games.yml new file mode 100644 index 0000000..ce6f466 --- /dev/null +++ b/test/fixtures/games.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyText + +two: + name: MyText diff --git a/test/helpers/games_helper_test.rb b/test/helpers/games_helper_test.rb new file mode 100644 index 0000000..449a85c --- /dev/null +++ b/test/helpers/games_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class GamesHelperTest < ActionView::TestCase +end diff --git a/test/models/game_attribute_test.rb b/test/models/game_attribute_test.rb new file mode 100644 index 0000000..13c6e65 --- /dev/null +++ b/test/models/game_attribute_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GameAttributeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/game_test.rb b/test/models/game_test.rb new file mode 100644 index 0000000..2cab36e --- /dev/null +++ b/test/models/game_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GameTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end -- cgit v1.2.3