rails tutorial을 따르고 5 장을 끝내고 Rails 4 베타 1에서 새로 출시 된 rc2으로 업그레이드하기로 결정했습니다. 그리고 이제 사양은 실패합니다.레일즈 4.0.0.rc2로 업그레이드 한 후 도우미를위한 Rspec이 실패했습니다
... application_helper_spec.rb:3:in `<top (required)>':
uninitialized constant ApplicationHelper (NameError)
나는 닦고 rm
내 첫 번째 문제를 해결 bundle exec rspec --init
으로 spec_helper.rb
파일을 다시했습니다. 두 번째 문제는 내가 정의한 애플리케이션 도우미를 찾지 못하는 것입니다.
전체 오류 출력은 :
[email protected]:~/repo/rails_tutorial_sample_app$ bundle exec rspec
No DRb server is running. Running in local process instead ...
/home/tim/repo/rails_tutorial_sample_app/spec/helpers/application_helper_spec.rb:3:in `<top (required)>': uninitialized constant ApplicationHelper (NameError)
from /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:77:in `rescue in run'
from /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:73:in `run'
from /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
나는 그것을 해결하는 데 충분히 일을로드하는 방법을 이해하지 않습니다. 나는 Rails/RSpec - writing tests for original helper methods을 통해 읽었으며이 모든 것들은 순서대로 보입니다. 여기
두 분명히 관련 파일은 다음과 같습니다사양/도우미/application_helper_spec.rb
require 'spec_helper'
describe ApplicationHelper do
describe "full_title" do
it "should include the page title" do
expect(full_title("foo")).to match(/foo/)
end
it "should include the base title" do
expect(full_title("foo")).to match(/^Ruby on Rails Tutorial Sample App/)
end
it "should not include a bar for the home page" do
expect(full_title("")).not_to match(/\|/)
end
end
end
응용 프로그램
module ApplicationHelper
# full title on per page basis
def full_title(page_title)
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
end
내 전체/헬퍼/application_helper.rb 출처는 https://github.com/timabell/rails_tutorial_sample_app/tree/4b3d93bbfdb0adb36b87b760c90c3bdda87def16
입니다.Halp! 나는 깊은 곳에서 일하는 것을 좋아하지만 단지 익사 한 것 같아요.
'rails g rspec : install' 시도 - 현재 spec_helper가 잘못되었습니다. – muttonlamb
hrmm, 그 명령은 내가 전에받은 오류를 던집니다. '번들 exec 레일즈 rspec : install /home/tim/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application /configuration.rb:144:in \'const_get ': 초기화되지 않은 상수 ActionDispatch :: Session :: EncryptedCookieStore (NameError)'... –
http://stackoverflow.com/a/15849479/10245를 살펴 보겠습니다. 돌아와서, 내가 가진 것과 같은 것처럼 보입니다. –