1
votes

I'm going through the Ruby on Rails 3 Tutorial by Michael Hartl. I have a hard time getting past the testing error. I can test the existence of pages fine but as soon as I want to test the title it fails. I'm sure I followed the text to the T

My auto test also fails because of some gem version miss-match I tried everything I could find online but nothing helped.

Can someone also pint me to the right place for rspec function documentation?

I appreciate any help. Thanks

This is the link to my public repository https://[email protected]/justfarnaz/Sample_app_new.git

I'm running Rails 3.1.1 and the Gemfile bellow.

Both error messages and the Gemfile are bellow.

// Failing message after I run bundle exec rspec spec/

.F...

Failures:

1) PagesController GET 'home' should have the right title Failure/Error: response.should have_selector("title", :content => "Ruby on Rails Tutorial Sample App | Home ") expected following output to contain a Ruby on Rails Tutorial Sample App | Home tag: # ./spec/controllers/pages_controller_spec.rb:12

Finished in 0.05239 seconds 5 examples, 1 failure

Failed examples:

rspec ./spec/controllers/pages_controller_spec.rb:10 # PagesController GET 'home' should have the right title

Autotest error

autotest loading autotest/rails_rspec2 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -rrubygems -S /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/bin/rspec --tty '/Users/justfarnaz/Documents/Ruby/sites/sample_app/spec/controllers/pages_controller_spec.rb' /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in setup': You have already activated rspec-core 2.7.1, but your Gemfile requires rspec-core 2.6.4. Using bundle exec may solve this. (Gem::LoadError) from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:17:insetup' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:110:in setup' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/setup.rb:17 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in require' from /Users/justfarnaz/Documents/Ruby/sites/sample_app/config/boot.rb:6 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:in require' from /Users/justfarnaz/Documents/Ruby/sites/sample_app/config/application.rb:1 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:in require' from /Users/justfarnaz/Documents/Ruby/sites/sample_app/config/environment.rb:2 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:in require' from /Users/justfarnaz/Documents/Ruby/sites/sample_app/spec/spec_helper.rb:50 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:in require' from /Users/justfarnaz/Documents/Ruby/sites/sample_app/spec/controllers/pages_controller_spec.rb:1 from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:inload' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in load_spec_files' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:inmap' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in load_spec_files' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18:inrun' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in run_in_process' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:inrun' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `autorun' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/bin/rspec:4

Gemfile

source 'http://rubygems.org'

gem 'rails', '3.1.1'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

gem 'json'


group :development do
    gem 'rspec-rails', '2.6.1'
end

group :test do
    gem 'rspec-rails', '2.6.1'
    gem 'webrat' , '0.7.1' 
    gem 'spork', '0.9.0.rc8'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.4'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'
1

1 Answers

2
votes

Same problem. Try to edit Gemfile and change version of

gem 'rspec-rails', '2.6.1'

in test and development groups to 2.7.0