복붙노트

[RUBY-ON-RAILS] 왜 RSpec에는 "장애 / 오류 : 역 추적에서 일치하는 라인을 찾을 수 없습니다"라는입니까?

RUBY-ON-RAILS

왜 RSpec에는 "장애 / 오류 : 역 추적에서 일치하는 라인을 찾을 수 없습니다"라는입니까?

나는 레일 여기 튜토리얼 다음 해요 : http://railstutorial.org/chapters/filling-in-the-layout#top

내가 실행하면 "RSpec에 사양 /"나는 오류의 무리를 얻을 것을 다음과 같이 :

1) LayoutLinks should have a Home page at '/'
    Failure/Error: Unable to find matching line from backtrace
    stack level too deep
    # C:/Ruby19/lib/ruby/1.9.1/forwardable.rb:185

2) LayoutLinks should have a Contact page at '/contact'
    Failure/Error: Unable to find matching line from backtrace
    stack level too deep
    # C:/Ruby19/lib/ruby/1.9.1/forwardable.rb:185

내가 로컬 호스트에 내 웹 브라우저에서 갈 때 : 3000 /과 로컬 호스트 : 3000 / 접촉, 페이지가 있습니다 올바른 제목이 있습니다. 여기 내 myrailsroot \ 사양 \ 요청 \ layout_links_spec.rb 파일은 다음과 같습니다

require 'spec_helper'

describe "LayoutLinks" do

  it "should have a Home page at '/'" do
    get '/'
    response.should have_selector('title', :content => "Home")
  end

  it "should have a Contact page at '/contact'" do
    get '/contact'
    response.should have_selector('title', :content => "Contact")
  end

  it "should have an About page at '/about'" do
    get '/about'
    response.should have_selector('title', :content => "About")
  end

  it "should have a Help page at '/help'" do
    get '/help'
    response.should have_selector('title', :content => "Help")
  end

  it "should have a signup page at '/signup'" do
    get '/signup'
    response.should have_selector('title', :content => "Sign up")
  end

end

어떤 아이디어가 좋은, 감사 것

해결법

  1. ==============================

    1.이 RSpec에 2.0.0.beta.19의 버그로 인한 것입니다. 튜토리얼에서 알 수 있듯이 당신이 2.0.0.beta.18를 사용하는 경우, 그것을 잘 작동합니다. 그냥 설치하고 다시 테스트를 실행 번들, 베타 (18)에 Gemfile에 당신이 어떤 버전을 변경합니다.

    이 RSpec에 2.0.0.beta.19의 버그로 인한 것입니다. 튜토리얼에서 알 수 있듯이 당신이 2.0.0.beta.18를 사용하는 경우, 그것을 잘 작동합니다. 그냥 설치하고 다시 테스트를 실행 번들, 베타 (18)에 Gemfile에 당신이 어떤 버전을 변경합니다.

    여기 내 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
    

    또한 참고 Spork 수도 있습니다 때때로이 같은 문제의 원인. 당신이 설명 할 수없는 테스트 실패를 얻는 경우에, 당신은 단지 새로운 컨트롤러 나 액션을 추가 특히,주고 spork 킥을 이동합니다. Ctrl-C를 때려 다시 spork 서버를 실행합니다.

  2. ==============================

    2.내 gemfile이처럼 보였다과 작동

    내 gemfile이처럼 보였다과 작동

    group :test do 
        gem 'rspec-rails'
        gem 'webrat', '0.7.1'
    end
    

    여기서 RSpec에 레일 (2.1.0)

    그러나하지 않습니다 다음 :

    group :test do 
        gem 'rspec-rails'
        gem 'webrat', '0.7.2'
    end
    

    내가 생각하는 그래서 최대 재생 webrat입니다.

  3. ==============================

    3.지금 밖으로 beta.20로 업그레이드. 내 gemfile에 webrat을 추가했고, 또 다른 번들 설치합니까. gemfile, 그것은 다음과 같습니다 :

    지금 밖으로 beta.20로 업그레이드. 내 gemfile에 webrat을 추가했고, 또 다른 번들 설치합니까. gemfile, 그것은 다음과 같습니다 :

    group :test do
      gem "webrat"
      gem 'rspec', '2.0.0.beta.20'
    end
    

    건배

  4. ==============================

    4.난 단지 내 타이틀 시험이이 문제를보고하고있다.

    난 단지 내 타이틀 시험이이 문제를보고하고있다.

    다음과 같이 내 gemfile은 ...

    source 'http://rubygems.org'
    
    gem 'rails', '3.0.0'
    gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
    gem 'gravatar_image_tag', '0.1.0'
    gem 'will_paginate', '3.0.pre2'
    
    group :development do
      gem 'rspec-rails', '2.0.0.rc'
      gem 'webrat', '0.7.1'
      gem 'annotate-models', '1.0.4'
      gem 'faker', '0.3.1'
    end
    
    group :test do
      gem 'rspec', '2.0.0.rc'
      gem 'webrat', '0.7.1'
      gem 'spork', '0.8.4'
      gem 'factory_girl_rails', '1.0'
    end
    

    나는 아무 소용뿐만 아니라 RSpec에 레일의 베타 버전을 시도했습니다.

    아직도 날 오류를주는 제목의 두 사람은 다음과 같다 :

    users_controller_spec.rc에서

      it "should have the right title" do
        get :index
        response.should have_selector("title", :content => "All users")
      end
    
      #...
    
        it "should have the right title" do
          post :create, :user => @attr
          response.should have_selector("title", :content => "Sign up")
        end
    

    오류에서 조각을 읽

    Failures:
      1) UsersController GET 'index' for signed-in users should have the right title
         Failure/Error: response.should have_selector("title", :content => "All users")
         expected following output to contain a <title>All users</title> tag:
         <!DOCTYPE html>
         <html>
         <head>
         <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
         <title>Ruby on Rails Tutorial Sample App | All Users</title>
    

    2) UsersController Post 'create' for non-signed in users failure should have the right title
         Failure/Error: response.should have_selector("title", :content => "Sign up")
         expected following output to contain a <title>Sign up</title> tag:
         <!DOCTYPE html>
         <html>
         <head>
         <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
         <title>Ruby on Rails Tutorial Sample App | Sign Up</title>
    

    각기.

    출력, "위로 서명"와 "인덱스"에서 볼 수 있듯이 분명 제목의 오른쪽에 표시됩니다. 이것은 특히한다는 점에서 곤혹되고, 다음 테스트 작업을 수행합니다 :

      it "should have the right title" do
        get :new
        response.should have_selector("title", :content => "Sign up")
      end
    

    같은 페이지이고, 다른 하나 같은 제목을 포함하는 테스트 "가입". 또한 get 메소드는이 테스트에서가 아니라 "인덱스"테스트에서 작동합니다.

    도움?

  5. ==============================

    5.이 RSpec에 2.2.0의 등의 문제가 될 것 같지 않습니다

    이 RSpec에 2.2.0의 등의 문제가 될 것 같지 않습니다

  6. ==============================

    6.나는 다음과 같은 Gemfile가 올바르게 작동하는지 확인할 수 있습니다 ...

    나는 다음과 같은 Gemfile가 올바르게 작동하는지 확인할 수 있습니다 ...

    group :test do
      gem 'rspec', '2.0.0.beta.18'
      gem 'spork', '0.8.4'
      gem 'webrat', '0.7.1'
    end
    
  7. ==============================

    7.I GOT IT WORKING

    I GOT IT WORKING

    방법__! 더 당신이 필요로하는 것보다 정보,하지만 그것의 가치에 대한이 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
    

    ... 내가 실행 한 후 ...

    $ bundle install
    

    ... 그리고 ...

    $ bundle update webrat
    

    ...이 결과는 ... 번들 ...

    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)
    

    ... 샘플 응용 프로그램의 모든 테스트를 가지고 (제 5 장 말까지)을 다시 실행합니다.

  8. ==============================

    8.나는 0.7.1 webrat 지정 될 때까지 나는 아직도이 문제를보고 있었다.

    나는 0.7.1 webrat 지정 될 때까지 나는 아직도이 문제를보고 있었다.

  9. ==============================

    9.다음은 나를 위해 문제를 해결했습니다.

    다음은 나를 위해 문제를 해결했습니다.

    gem install rspec-rails
    sudo apt-get install libxslt-dev libxml2-dev
    bundle install
    rails generate rspec:install
    
  10. ==============================

    10.하하, 다시 시작의 spork 및 자동 측정 트릭을했다. 그것은 지금과 그때마다 멋진 킥을 필요로 않습니다. 내가 BTW 2.6.1 RSpec에이 레일을 실행 해요 ...

    하하, 다시 시작의 spork 및 자동 측정 트릭을했다. 그것은 지금과 그때마다 멋진 킥을 필요로 않습니다. 내가 BTW 2.6.1 RSpec에이 레일을 실행 해요 ...

  11. ==============================

    11.Spork "쫓겨"나를 위해 문제를 해결.

    Spork "쫓겨"나를 위해 문제를 해결.

  12. from https://stackoverflow.com/questions/3517724/why-is-rspec-saying-failure-error-unable-to-find-matching-line-from-backtrace by cc-by-sa and MIT license