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 trialAdam Shields
4,573 PointsError line #4
This is the error I'm receiving when using the code below.
1 example, 1 failure
Failed examples:
rspec ./spec/features/todo_lists/create_spec.rb:4 # Creating todo lists redirects to the todo list indexpage on success
require 'spec_helper'
describe "Creating todo lists" do
it "redirects to the todo list indexpage on success" do
visit "/todo_lists"
click_link "New Todo list"
expect(page).to have_content("New todo_list")
fill_in "Title", with: "My todo list"
fill_in "Description", with: "this is what i'm doing today."
click_button "Create Todo list"
expect(page).to have_content("My Todo list")
end
end
5 Answers
Adam Shields
4,573 PointsMakes perfect sense now, thank you for the help, great explanation of the fix as well, I honestly didn't realize it was case sensitive like that but I now I see, once i changed
<pre><code>fill_in "Title", with: "My todo list"</code></pre>
to
<pre><code>fill_in "Title", with: "My Todo list" </code></pre>
it worked perfect!
Thank you very much!
Maciej Czuchnowski
36,441 PointsAnd nothing more? Perhaps this: "New Todo list" should be "New Todo List" (open the browser and see what the button really says on that page).
Adam Shields
4,573 Pointsthis is what it looks like on the default page, that i setup in the routes.rb file
Listing todo_lists
Title Description
New Todo list
Maciej Czuchnowski
36,441 PointsOK, but your error is probably longer and tells you exactly which expectation fails, what it expected and what it got instead. This would help a lot.
Adam Shields
4,573 Pointsyour right this is the entire error, I somehow must have overlooked the top section
λ rspec spec\features\todo_lists\create_spec.rb F
Failures:
1) Creating todo lists redirects to the todo list indexpage on success Failure/Error: expect(page).to have_content("My Todo list") expected to find text "My Todo list" in "Todo list was successfully created. Title: My todo list Description: this is what i'm doing today. Edit | Back" # ./spec/features/todo_lists/create_spec.rb:14:in `block (2 levels) in <top (required)>'
Deprecation Warnings:
RSpec::Core::ExampleGroup#example is deprecated and will be removed in RSpec 3. There are a few options for what you can use instead:
- rspec-core's DSL methods (
it
,before
,after
,let
,subject
, etc) now yield the example as a block argument, and that is the recommended way to access the current example from those contexts. - The current example is now exposed via
RSpec.current_example
, which is accessible from any context. -
If you can't update the code at this call site (e.g. because it is in an extension gem), you can use this snippet to continue making this method available in RSpec 2.99 and RSpec 3:
RSpec.configure do |c| c.expose_current_running_example_as :example end
(Called from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-2.1.0/lib/capybara/rspec.rb:20:in `block (2 levels) in <top (required)>')
RSpec::Core::ExampleGroup#example is deprecated and will be removed in RSpec 3. There are a few options for what you can use instead:
- rspec-core's DSL methods (
it
,before
,after
,let
,subject
, etc) now yield the example as a block argument, and that is the recommended way to access the current example from those contexts. - The current example is now exposed via
RSpec.current_example
, which is accessible from any context. -
If you can't update the code at this call site (e.g. because it is in an extension gem), you can use this snippet to continue making this method available in RSpec 2.99 and RSpec 3:
RSpec.configure do |c| c.expose_current_running_example_as :example end
(Called from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-2.1.0/lib/capybara/rspec.rb:21:in `block (2 levels) in <top (required)>')
If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
config.raise_errors_for_deprecations!
, and it will turn the
deprecation warnings into errors, giving you the full backtrace.
2 deprecation warnings total
Finished in 0.36902 seconds 1 example, 1 failure
Failed examples:
rspec ./spec/features/todo_lists/create_spec.rb:4 # Creating todo lists redirects to the todo list indexpage on success
Randomized with seed 11050
Maciej Czuchnowski
36,441 PointsOK, so you are doing this:
fill_in "Title", with: "My todo list"
and expecting this:
expect(page).to have_content("My Todo list")
You have to change the letter to capital in the fill_in or make it lower case in the expect.
Adam Shields
4,573 Pointsone more question for you what markdown did you use for showing the above examples? Do you have a link to the source? I have tried the 3 backticks with Ruby () and others just cant find itThanks Very much!
Maciej Czuchnowski
36,441 PointsYou can simply copy them from the Markdown Cheatsheet or use the ones on the left side of the keyboard, above the Tab, before the 1 key. You just write three ticks, the word ruby
without any spacer or parentheses and write the code in the next line. And then close the code in the separate line. You should also have an empty line before the three ticks and ruby and after the closing three ticks.