Ruby on rails 3 授权规范不适用于put请求

Ruby on rails 3 授权规范不适用于put请求,ruby-on-rails-3,rspec,capybara,factory-bot,Ruby On Rails 3,Rspec,Capybara,Factory Bot,我是MichaelHartlsRubyonRails教程的CHP9。在myauthentication\u pages\u specs.rb中,“提交到更新操作”导致规范崩溃,错误为“#(NameError)”的未定义局部变量或方法“user” 是什么导致规范崩溃的 谢谢你在块之前放入put部分解决了问题对于初学者来说,只要看看它,你在描述块中有{put user\u path(user)},它应该在它块中。非常感谢你指出这一点!:)。它应该在before块中,而不是它。 require 'sp

我是MichaelHartlsRubyonRails教程的CHP9。在myauthentication\u pages\u specs.rb中,“提交到更新操作”导致规范崩溃,错误为“#(NameError)”的未定义局部变量或方法“user”

是什么导致规范崩溃的


谢谢你

在块之前放入put部分解决了问题

对于初学者来说,只要看看它,你在
描述
块中有
{put user\u path(user)}
,它应该在
块中。非常感谢你指出这一点!:)。它应该在before块中,而不是它。
require 'spec_helper'

describe "Authentication" do
  subject { page }


  describe "authorization" do

    describe "for non signed-in users" do
      let(:user) { FactoryGirl.create(:user) }

      describe "in the users controller" do
        describe "visiting the edit page" do
          before { visit edit_user_path(user)}
          it { should have_selector('title', text: 'Sign in')}
        end

        describe "submitting to the update action" do
          describe { put user_path(user)}  #Error on this line
          specify { response.should redirect_to(signin_path) }
        end
      end
    end

  end

end