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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Landen Buckley](https://secure.gravatar.com/avatar/694561234c253a14d30998ce1d902a60?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Landen Buckley
9,988 PointsWhy include 'expect(page).to_not have_content("This is what I'm doing today.")' after the refactor?
I don't immediately see the benefit of the last two lines in the following test:
it "displays an error when the todo list has no title" do
create_todo_list(title: "")
expect(page).to have_content("error")
expect(TodoList.count).to eq(0)
visit "/todo_lists"
expect(page).to_not have_content("This is what I'm doing today.")
end
Given our new method, the last line will always return true. We already check that the app returns an error and TodoList.count == 0 ... isn't that enough for the test?
2 Answers
![Brandon Barrette](https://uploads.teamtreehouse.com/production/profile-photos/98134/micro_image_copy.png)
Brandon Barrette
20,485 PointsSo testing is all a matter of personal preference. Here, we are doing feature testing (which is like integration testing, testing everything working together.) We are not just testing the controller, or the model, or the view, but how everything works together.
I agree that the last line is kind of redundant and could be removed since there isn't a case where it wouldn't save to the database and then would show up on the todo_list index page.
![Vinny Harris-Riviello](https://uploads.teamtreehouse.com/production/profile-photos/2469792/micro_Selfie.jpg)
Vinny Harris-Riviello
11,898 PointsIt is just testing that the listing was not created. It is possibly redundant like Brandon mentions, but it is a valid way to verifying the list did not get created. We already checked that the count is 0, but it double checks or to the least. It shows you, you have several options to run the test. So it is worth knowing them for your personal toolbox. ;)