Why is Rspec saying “Failure/Error: Unable to find matching line from backtrace”?

后端 未结 11 1035
春和景丽
春和景丽 2020-12-03 02:35

I\'m following the rails tutorial here: http://railstutorial.org/chapters/filling-in-the-layout#top

When I run \"rspec spec/\", I get a bunch of errors that look lik

相关标签:
11条回答
  • 2020-12-03 03:12

    This doesn't seem to be an issue as of rspec 2.2.0

    0 讨论(0)
  • 2020-12-03 03:12

    I GOT IT WORKING

    W__A__Y__! more information than what you need, but for what it's worth, this Gemfile ...

    source 'http://rubygems.org'
    
    gem 'rails', '3.0.3'
    
    # Bundle edge Rails instead: <br/>
    # gem 'rails', :git => 'git://github.com/rails/rails.git'
    
    gem 'sqlite3-ruby', :require => 'sqlite3'
    
    # Use unicorn as the web server<br/>
    # gem 'unicorn'
    
    # Deploy with Capistrano<br/>
    # gem 'capistrano'
    
    # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)<br/>
    # gem 'ruby-debug'<br/>
    # gem 'ruby-debug19'
    
    # Bundle the extra gems:<br/>
    # gem 'bj'<br/>
    # gem 'nokogiri'<br/>
    # gem 'sqlite3-ruby', :require => 'sqlite3'<br/>
    # gem 'aws-s3', :require => 'aws/s3'<br/>
    
    # Bundle gems for the local environment. Make sure to<br/>
    # put test-only gems in this group so their generators<br/>
    # and rake tasks are available in development mode:<br/>
    # group :development, :test do<br/>
    #   gem 'webrat'<br/>
    # end<br/>
    group :test, :development do<br/>
    gem 'rspec-rails', '2.0.0.beta.18'<br/>
    # gem 'capybara'<br/>
    gem 'webrat', '0.7.1'<br/>
    gem 'database_cleaner'<br/>
    gem 'cucumber-rails'<br/>
    gem 'cucumber'<br/>
    gem 'spork'<br/>
    gem 'launchy'<br/>
    end
    

    ... after I run ...

    $ bundle install
    

    ... and ...

    $ bundle update webrat
    

    ... results in this ... bundle ...

    Using rake (0.8.7) <br/>
    Using abstract (1.0.0) <br/>
    Using activesupport (3.0.3) <br/>
    Using builder (2.1.2) <br/>
    Using i18n (0.5.0) <br/>
    Using activemodel (3.0.3) <br/>
    Using erubis (2.6.6) <br/>
    Using rack (1.2.1) <br/>
    Using rack-mount (0.6.13) <br/>
    Using rack-test (0.5.7) <br/>
    Using tzinfo (0.3.23) <br/>
    Using actionpack (3.0.3) <br/>
    Using mime-types (1.16) <br/>
    Using polyglot (0.3.1) <br/>
    Using treetop (1.4.9) <br/>
    Using mail (2.2.14) <br/>
    Using actionmailer (3.0.3) <br/>
    Using arel (2.0.7) <br/>
    Using activerecord (3.0.3) <br/>
    Using activeresource (3.0.3) <br/>
    Using bundler (1.0.7) <br/>
    Using configuration (1.2.0) <br/>
    Using diff-lcs (1.1.2) <br/>
    Using json (1.4.6) <br/>
    Using gherkin (2.3.3) <br/>
    Using term-ansicolor (1.0.5) <br/>
    Using cucumber (0.10.0) <br/>
    Using cucumber-rails (0.3.2) <br/>
    Using database_cleaner (0.6.0) <br/>
    Using launchy (0.3.7) <br/>
    Using nokogiri (1.4.4) <br/>
    Using thor (0.14.6) <br/>
    Using railties (3.0.3) <br/>
    Using rails (3.0.3) <br/>
    Using rspec-core (2.4.0) <br/>
    Using rspec-expectations (2.4.0) <br/>
    Using rspec-mocks (2.4.0) <br/>
    Using rspec (2.4.0) <br/>
    Using webrat (0.7.1) <br/>
    Using rspec-rails (2.0.0.beta.18) <br/>
    Using spork (0.8.4) <br/>
    Using sqlite3-ruby (1.3.2)
    

    ... which got all of the sample application tests (through the end of Chapter 5) to run again.

    0 讨论(0)
  • 2020-12-03 03:15

    This is due to a bug in RSpec 2.0.0.beta.19. If you use 2.0.0.beta.18 as the tutorial suggests, it will work fine. Just change whatever version you have in your Gemfile to beta 18, bundle install and run the tests again.

    Here's the relevant parts from my Gemfile.

    group :development do
      gem 'rspec-rails', '2.0.0.beta.18'
    end
    
    group :test do
      gem 'rspec-rails', '2.0.0.beta.18'
      gem 'spork', '0.8.4'
    end
    

    Also note that Spork can also cause problems like this from time to time. If you get inexplicable test failures, especially if you just added new controllers or actions, go give spork a kick. Hit Ctrl-C and run the spork server again.

    0 讨论(0)
  • 2020-12-03 03:18

    haha, restarting spork and autotest did the trick. it does need a nice kick every now and then. i'm running rspec-rails 2.6.1 btw...

    0 讨论(0)
  • 2020-12-03 03:20

    I can confirm that the following Gemfile works correctly...

    group :test do
      gem 'rspec', '2.0.0.beta.18'
      gem 'spork', '0.8.4'
      gem 'webrat', '0.7.1'
    end
    
    0 讨论(0)
  • 2020-12-03 03:24

    "Kicked" Spork and fixed the problem for me.

    0 讨论(0)
提交回复
热议问题