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.

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 ...!!