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 trialjay niceness
7,406 PointsNot 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
11,883 PointsSo 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.
jay niceness
7,406 Pointsah, kind of figured ... so we're actually testing that the test will catch errors (there for it passes) ..?
Alex Cevallos
16,551 PointsThank you
John Simoneau
Courses Plus Student 8,105 PointsJohn Simoneau
Courses Plus Student 8,105 PointsThank you for asking this! Making more sense now :)