From 7e99e2714b6c77751e044129be263d642676e373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= Date: Thu, 24 Feb 2011 14:19:01 +0100 Subject: [PATCH] 404 on board index when no board configured. #64 --- app/controllers/boards_controller.rb | 1 + test/functional/boards_controller_test.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index fa82218d..ebad847d 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -29,6 +29,7 @@ class BoardsController < ApplicationController def index @boards = @project.boards + render_404 if @boards.empty? # show the board if there is only one if @boards.size == 1 @board = @boards.first diff --git a/test/functional/boards_controller_test.rb b/test/functional/boards_controller_test.rb index 597a3df2..420cf0c1 100644 --- a/test/functional/boards_controller_test.rb +++ b/test/functional/boards_controller_test.rb @@ -96,4 +96,11 @@ class BoardsControllerTest < ActionController::TestCase assert_redirected_to '/projects/ecookbook/settings/boards' assert_nil Board.find_by_id(2) end + + def test_index_should_404_with_no_board + Project.find(1).boards.each(&:destroy) + + get :index, :project_id => 1 + assert_response 404 + end end