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

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Validating Length

Not understanding tests pass / fail process...

I may have missed something? Why does our test code in create_spec.rb pass with only "Hi" a 2 character set when we clearly put 3 minimum in our model validations?? shouldn't this fail the test?

Feel like I missed something but don't know what or where to review.... any advice would help thanks

1 Answer

J Scott Erickson
J Scott Erickson
11,883 Points

So basically ( without seeing your code, I must assume ), your test is actually saying something like:

it "Should fail when trying to save with less than three letters" do

  # Set some model attribute to be three letters
  # Expect that it is invalid
end

You're actually testing that it is invalid when you save. So being invalid, is considered a passing test.

ah, kind of figured ... so we're actually testing that the test will catch errors (there for it passes) ..?

Thank you