여기에 나는 this tutorial을 따르고 있으며 모든 것이 지금까지 잘 해결되었습니다.간단한 RSpec 테스트가 실패했습니다.
하지만 지금은 세션을 진행 한 것으로, 간단한 RSpec에 테스트가 실패 : 나는 RSpec을 실행하면
describe SessionsController do
#[...]
describe "GET 'new'" do
it "should have the right title" do
get :new
response.should have_selector("title", :content => "Sign in")
end
end
#[...]
describe "POST 'create'" do
#[...]
it "should have the right title" do
post :create, :session => @attr
response.should have_selector("title", :content => "Sign in")
end
#[...]
end
end
, 나는 항상 얻을 :
1) SessionsController GET 'new' should have the right title Failure/Error: response.should have_selector("title", :content => "Sign in
) expected following output to contain a Sign in tag: w3.org/TR/REC-html40/loose.dtd"> # ./spec/controllers/sessions_controller_spec.rb:14:in `block (3 levels) in '
내가 세션 액세스/새 페이지는 페이지는 다음과 같은 제목 태그 포함, 왜 테스트가 실패 할
<title>Ruby on Rails Tutorial Sample App | Sign in</title>
모든 OTH 동안 비슷한 (= 제목 태그 테스트) 테스트가 잘 작동합니까?
class SessionsController < ApplicationController
def new
@title = 'Sign in'
end
def create
user = User.authenticate(params[:session][:email], params[:session][:password])
if user.nil?
flash.now[:error] = "Invalid email/password combination."
@title = 'Sign in'
render 'new'
else
sign_in user
redirect_to user
end
end
def destroy
sign_out
redirect_to root_path
end
end
내가 잘못 여기서 뭐하는 거지 :
다음은 SessionController입니까? 당신의 도움이
아, 멋지다. 트릭을 했어, thx – DeX3