Permalink
Browse files

test refactoring

  • Loading branch information...
1 parent ec89128 commit e0e03f91e47ab7b42888f6086bff9c7572e5af75 @ruseel committed Nov 21, 2012
View
3 app/controllers/topics_controller.rb
@@ -2,7 +2,8 @@ class TopicsController < ApplicationController
helper_method :depth_mark
def index
- @topics = Topic.all
+ @board = Board.find(params[:board_id])
+ @topics = @board.topics
end
def show
View
3 test/functional/topics_controller_test.rb
@@ -3,10 +3,11 @@
class TopicsControllerTest < ActionController::TestCase
setup do
@topic = topics(:one)
+ @board = boards(:one)
end
test "should get index" do
- get :index
+ get :index, board_id: @board
assert_response :success
assert_not_nil assigns(:topics)
end
View
5 test/integration/board_flow_test.rb
@@ -1,7 +1,8 @@
require 'test_helper'
class BoardFlowTest < ActionDispatch::IntegrationTest
- test "boards/1/topics url" do
- get "/boards/1/topics"
+ test "get url topics of boards(:one) " do
+ get board_topics_path(boards(:one))
+ assert_equal 0, assigns(:topics).size
end
end

0 comments on commit e0e03f9

Please sign in to comment.