0

我在 Michael Hartls Ruby On Rails 教程的第 9 章。在我的authentication_pages_specs.rb中,“提交更新操作”导致规范崩溃,并出现错误“未定义的局部变量或方法 `user' for # (NameError)”

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

是什么导致规范崩溃?

谢谢你

4

1 回答 1

0

在阻止放置部分之前放入可以解决问题

于 2012-08-24T12:53:42.677 回答