404 on board index when no board configured. #64

This commit is contained in:
Felix Schäfer 2011-02-24 14:19:01 +01:00
parent 9ed2d8ed77
commit 7e99e2714b
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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