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 Adding Validations to Todo Items

Rahul Yadav
Rahul Yadav
1,399 Points

Don't know where am i going wrong..!!

Error :

1) Adding todo items displays an error with no content Failure/Error: within("div.flash") do Capybara::ElementNotFound: Unable to find css "div.flash" # ./spec/features/todo_items/create_spec.rb:29:in `block (2 levels) in <top (required)>'

2) Adding todo items displays an error with content less than 2 characters long Failure/Error: within("div.flash") do Capybara::ElementNotFound: Unable to find css "div.flash" # ./spec/features/todo_items/create_spec.rb:40:in `block (2 levels) in <top (required)>'

link for code: https://github.com/Rohit0493/Rubyonrails/commit/90bcb846401ec86e73c34caef0817117dacff338

2 Answers

Hi Rahul, you'll be pleased to know I have submitted a pull request on your repo! :-)

Fixed two of the failing tests. I cloned the repo down and did some debugging, and the key moment was when inspecting the html of the error message in the browser, I saw that the name of the div's class was different to what you have in your test.

Well done for using tests btw - TDD is something Treehouse doesn't teach (and I have no idea why) - probably because it would lead to less 'instant gratification' and therefore less revenue. But unfortunately, if you don't learn TDD, you will find it hard to get a job.

Rahul Yadav
Rahul Yadav
1,399 Points

Thanks Andrew fixed the issue ...!!