404 on board index when no board configured. #64
This commit is contained in:
parent
9ed2d8ed77
commit
7e99e2714b
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue