I am trying to test a Rails app using Michael Hartl's tutorial, but I am getting following error after typing bundle exec rspec spec/requests/static_pages_spec.rb
(I am in the sample app directory)
static_pages_spec.rb:9: syntax error, unexpected ',', expecting ')' (SyntaxError)
...age.should have_selector ('h1', :text => 'Sample App')
... ^
/Users/subalcharla/subal_rails/sample_app/spec/requests/static_pages_spec.rb:9: syntax error, unexpected ')', expecting keyword_end ...r ('h1', :text => 'Sample App')
/Users/subalcharla/subal_rails/sample_app/spec/requests/static_pages_spec.rb:14: syntax error
, unexpected ',', expecting ')'
page.should have_selector ('title',
^
/Users/subalcharla/subal_rails/sample_app/spec/requests/static_pages_spec.rb:15: syntax error, unexpected ')', expecting keyword_end ...ls Tutorial Sample App | Home")
/Users/subalcharla/subal_rails/sample_app/spec/requests/static_pages_spec.rb:49: syntax error, unexpected ')', expecting keyword_end
from /Users/subalcharla/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /Users/subalcharla/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `map'
from /Users/subalcharla/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /Users/subalcharla/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/subalcharla/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
from /Users/subalcharla/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'
My static_pages_spec.rb file is
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
page.should have_selector ('h1', :text => 'Sample App')
end
it "should have the right title" do
visit '/static_pages/home'
page.should have_selector ('title',
:text => "Ruby on Rails Tutorial Sample App | Home")
end
end
describe "Help page" do
it "should have the content 'Help'" do
visit '/static_pages/help'
page.should have_selector('h1', :text => 'Help')
end
it "should have the right title" do
visit '/static_pages/help'
page.should have_selector ('title',
:text => "Ruby on Rails Tutorial Sample App | Help")
end
end
describe "About page" do
it "should have the content 'About Us'" do
visit '/static_pages/about'
page.should have_selector ('h1', :text => 'About Us')
end
it "should have the right title" do
visit '/static_pages/about'
page.should have_selector ('title',
:text => "Ruby on Rails Tutorial Sample App | About Us")
end
end
end
I have checked my test file with the tutorial screencast and it looks identical. What could be causing the RED failing test to work?