小编use*_*781的帖子

第9章,Hartl ROR第9.2.2节

我继续得到同样的失败信息,但我似乎无法弄清楚出了什么问题.

失败:

1)访问编辑页面的Users控制器中未登录用户的身份验证授权失败/错误:它{should have_selector('title',text:'登录')}预期的css"title",带有文本"登录"返回#./spec/requests/authentication_pages_spec.rb:69:在'块(6级)中'

2)用户控制器中未登录用户的身份验证授权提交更新操作失败/错误:指定{response.should redirect_to(signin_path)}预期响应为<:redirect>,但<200># ./spec/requests/authentication_pages_spec.rb:74:在'块(6级)中'

完成2.31秒69例,2次失败

失败的例子:

rspec ./spec/requests/authentication_pages_spec.rb:69#访问编辑页面的Users控制器中非登录用户的身份验证授权rspec ./spec/requests/authentication_pages_spec.rb:74#非签名的身份验证授权 - 用户控制器中的用户提交更新操作

这是authentication_pages_spec.rb:require'pec_helper'

描述"身份验证"

subject { page }

describe "signin page" do
    before { visit signin_path }

    it { should have_selector('h1', text: 'Sign in') }
    it { should have_selector('title', text: 'Sign in') }
end

describe "signin" do
    before { visit signin_path }

    describe "with invalid information" do
        before { click_button "Sign in" }

        it { should have_selector('title', text: 'Sign in') }
        it { should have_selector('div.alert.alert-error', text: 'Invalid') } …
Run Code Online (Sandbox Code Playgroud)

rspec ruby-on-rails before-filter ruby-on-rails-3 railstutorial.org

3
推荐指数
1
解决办法
975
查看次数