2011-09-11 2 views
0

저는 RoR을 처음 사용하고 테스트 중심 개발을 발견하기 전에 몇 가지 사항을 프로그래밍했습니다. 그래서 guard-rspec과 capybara로 몇 가지 테스트를 작성하려고했습니다. 모두 좋았지 만 devise (deprecation warnings for version 1.1.rc02)가있어 최신 버전 (1.4.5)으로 업데이트했습니다. 업데이트 후 작동하지 않는 Devise capybara를 통한 테스트 완료

DEPRECATION WARNING: Using form_for(:name, @resource) is deprecated. Please use form_for(@resource, :as => :name) instead. (called from _app_views_devise_sessions_new_html_erb___942904761_2291541620_0 at /Users/xonic/Documents/work/ror.ror.at/app/views/devise/sessions/new.html.erb:3) 
FDEPRECATION WARNING: Using form_for(:name, @resource) is deprecated. Please use form_for(@resource, :as => :name) instead. (called from _app_views_devise_sessions_new_html_erb___942904761_2291541620_0 at /Users/xonic/Documents/work/ror.ror.at/app/views/devise/sessions/new.html.erb:3) 
.DEPRECATION WARNING: Using form_for(:name, @resource) is deprecated. Please use form_for(@resource, :as => :name) instead. (called from _app_views_devise_registrations_new_html_erb__1735759005_2291086140_0 at /Users/xonic/Documents/work/ror.ror.at/app/views/devise/registrations/new.html.erb:3) 

그래서 내가

<%= form_for(resource, :url => registration_path(resource_name)) do |f| %> 

<%= form_for(resource_name, resource, :url => registration_path(resource_name)) do |f| %> 

를 변경하는 모든 사양을 실행

및 경고 제거있어 :

은 경고했다. 지금까지는 너무 좋았습니다. 테스트를 계속했고 브라우저에서 직접 응용 프로그램을 열려고 시도하지 않았습니다.

은 그때 무슨 일이 있었는지 모르겠지만 모든 브라우저에서 응용 프로그램을 실행하려고 할 때, 나는 다음과 같은 오류 메시지가 얻을 갑자기 : 그래서 분명히

NoMethodError in Slides#index 

Showing /Users/xonic/Documents/work/ror.ror.at/app/views/layouts/application.html.erb where line #27 raised: 

private method `split' called for #<Class:0x10c023278> 
Extracted source (around line #27): 

24: 
25:     <div class="gopro"> 
26: 
27:      <% if user_signed_in? %> 
28:       Signed in as <%= link_to current_user.username, user_path(current_user) %>. Not you? <%#, user_slides_path(current_user.username) %> 
29:       <%= link_to "Sign out", destroy_user_session_path %> 
30:      <% else %> 

을 고안 문제입니다. .. 왜 그런지 모르겠다. 재미있는 점은 응용 프로그램을 테스트하는 동안 save_and_open_page을 호출하면 브라우저 창이 열리고 응용 프로그램이 올바르게 표시되고 오류가 전혀 표시되지 않습니다.

Guard::RSpec is running, with RSpec 2! 
Running all specs 
... 

Finished in 0.95467 seconds 
3 examples, 0 failures 

UPDATE :이 매우 비슷한 질문 Devise: NoMethod Error & user_signed_in을 본 적이하고는 문제가되지 않습니다, 그래서 제대로, 사용자 모델을 설정 한 .

이 나에게 매우 혼란은, 희망 누군가가 거기 crossingFingers

감사합니다, xon1c을 무슨 일이 일어나고 있는지 이해

UPDATE 내가 그것을 고정하지만, 나에게 대답 유래 못하게 내 평판이 부족하여 다음 6 시간 만에 자신의 질문 한숨. 나중에 솔루션을 게시합니다.

+0

서버를 테스트 모드 ('rails server -e testing')로 실행하면 브라우저에서 페이지가 올바르게 열립니 까? – David

+0

제 잘못,'레일즈 서버 -e 테스트'가 필요합니다. 사과 – David

+0

테스트 데이터베이스와 함께 서버를 실행하고 페이지를 열면 다음과 같은 오류가 발생합니다. 내부 서버 오류 # 전용 메소드'split '이 (가) 호출 됨 WEBrick/1.3.1 (Ruby/1.8. 7/2010-01-10) at localhost : 3000 – xon1c

답변

0

좋아요, 제가 고칠 수 있습니다 (완벽에 가깝습니다). 다음은 내가 한 일입니다.

나는 원래 상태로 돌아 왔고 처음부터 시작되었습니다. 이 시간 내가 대신 난 단지 명령은 버전 1.4을 설치

gem 'devise' 

을 넣고

gem install devise 
rails generate devise:install 

을 통해 최신 유증 보석을 설치, 내 Gemfile에 선

gem 'devise', :git => 'git://github.com/plataformatec/devise.git' 

을 사용하지 않은 .5 이전에는 1.4.7이 아니 었습니다. 그런 다음 capybara, guard-rspec, factory_girl_rails 및 launchy와 같은 다른 모든 보석을 설치했습니다.모든 것은 내가 남아있어이 두 가지 경고를 제외하고 지금 잘 작동 :

Running: spec/requests/sign_ups_spec.rb 
DEPRECATION WARNING: :name_prefix was deprecated in the new router syntax. Use :as instead. (called from /Users/xonic/Documents/work/ror.ror.at/config/routes.rb:7) 
DEPRECATION WARNING: :name_prefix was deprecated in the new router syntax. Use :as instead. (called from /Users/xonic/Documents/work/ror.ror.at/config/routes.rb:7) 
. 

Finished in 0.16255 seconds 
1 example, 0 failures 

글쎄, 한 모든 작품, 나는이 경고와 함께 확인 해요하지만 아무도 그들을 제거하는 방법을 알고 있다면, 나에게 알려 주시기 바랍니다 알고있다.

감사합니다.

관련 문제