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 trialCorey Gibbons
5,672 PointsSyntax errors?
Hey everyone, I seemed to be getting along fine but ran into an error while trying to execute this test. I checked all of MY syntax and it was all matching Jason's editor. Could there be a file or something I missed while downloading? Thanks for any help!
(my input to terminal)
treehouse:~/projects/odot (master) $ bin/rspec spec/features/todo_lists/create_spec.rb
(my results)
/home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load': /home/treehouse/projects/odot/spec/features/todo_lists/create_spec.rb:16: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
from /home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each'
from /home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run'
from /home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
from /home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'
4 Answers
Nick Fuller
9,027 PointsIt looks like you're either missing an end
or a closing }
somewhere. Can you post the create_spec.rb
?
Corey Gibbons
5,672 PointsHere it is thank you for getting back to me!
require 'spec_helper'
describe "Creating todo lists" do
it "redirects to the todo list index page on success" do
visit "/todo_lists" do
click_link "New Todo list" do
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```
Nick Fuller
9,027 Pointsthe do
that follows the visit "/todos_lists"
needs to be removed
the do
that follows the click_link "New Todo list"
needs to be removed
Corey Gibbons
5,672 PointsHey thanks for that It seemed to solve that problem but I am left with another! Any ideas? I have tried for hours to pick this apart but I do not understand the terminal code well enough...It seems to me the the purpose was to execute the My todo list text upon success of creating a new list but I do not see why that isn't happening. Thanks again for any tips!
(terminal)
treehouse:~/projects/odot (master) $ bin/rspec spec/features/todo_lists/create_spec.rb
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
F
Failures:
1) Creating todo lists redirects to the todo list index page 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:13:in `block (2 levels) in <top (required)>'
Finished in 0.76043 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/features/todo_lists/create_spec.rb:4 # Creating todo lists redirects to the todo list index page on success
Randomized with seed 1072```
(create_spec.rb)
``` ruby
require 'spec_helper'
describe "Creating todo lists" do
it "redirects to the todo list index page 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```
hiroshi
13,701 PointsI'm having the same issue. Can't figure it out :(
The code works, its just the test isn't working.
Scratch that, I had click_link "New Todo List"
instead of list
lower case... RSpec is picky as hell