Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialcindyk
4,055 PointsTesting the Whole App - tests are hanging/not running
ruby -Itest/integration/custom_routes_test.rb and ruby -Itest/functional/statuses_controller_test.rb are hanging. When I ctrl-c out of them, (after several minutes) i get: ruby: Interrupt. Any suggestions?
3 Answers
Stone Preston
42,016 Pointscan you post the tests?
cindyk
4,055 PointsThe tests are posted below
custom_routes.rb:
require 'test_helper'
class CustomTest < ActionDispatch::IntegrationTest
test "that /login route opens the login page" do
get "/login"
assert_response :success
end
test "that /logout route opens the logout page" do
get "/logout"
assert_response :redirect
assert_redirected_to '/'
end
end
statuses_controller_test.rb:
require 'test_helper'
class StatusesControllerTest < ActionController::TestCase
setup do
@status = statuses(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:statuses)
end
test "should get new" do
get :new
assert_response :redirect
assert_redirected_to login_path
end
test "should create status" do
assert_difference('Status.count') do
post :create, status: { content: @status.content, name: @status.name }
end
assert_redirected_to status_path(assigns(:status))
end
test "should show status" do
get :show, id: @status
assert_response :success
end
test "should get edit" do
get :edit, id: @status
assert_response :success
end
test "should update status" do
put :update, id: @status, status: { content: @status.content}
assert_redirected_to status_path(assigns(:status))
end
test "should destroy status" do
assert_difference('Status.count', -1) do
delete :destroy, id: @status
end
assert_redirected_to statuses_path
end
end
cindyk
4,055 Pointsfor ruby -Itest/integration/custom_routes_test.rb I realized I was trying to call it by the wrong name. So I recreated the test with the correct name and same content, tried to run it, but it's still hanging.