Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Build a Simple Ruby on Rails Application

Testing Responses: Challenge 1 of 1

Add an assertion to make sure the response was successful

At first I thought it was:

assert_response :successful

(seems logical, right?)

after much searching on the forum I came across this post:


that had this code:

    should "get new and return success" do
        get :new
        assert_response :success

Hmmmmmm - so I thought maybe:

        get :new

        assert_response :success

but nooooooooooooooo!

Alright, then...maybe just drop the

get :new (don't repeat it twice..because it already has one 'get:new' to start with..

Yes! It passed (whew)

Morale of the story: don't over think this question, but do search the forum for code snippets --there is a lot of good content there :)

Oh, here's the link to the challenge:


1 Answer

Stone Preston
Stone Preston
42,016 Points

can you post a link to the challenge? i cant give you a definite answer without seeing it myself but the Rails Testing Guide lists some of the assertions that come with mini test, one of them being


Asserts that the response comes with a specific status code. You can specify :success to indicate 200-299, :redirect to indicate 300-399, :missing to indicate 404, or :error to match the 500-599 range. You can also pass an explicit status number or its symbolic equivalent.

so to assert that the response was successful you would use:

assert_response :success