undefined method `assign' for #<RSpec::Core::ExampleGroup::nested_1:0x0000010597f4b8>
尝试按@L_403_0@进行测试时.
这就是我所拥有的:
user_controller_spec.rb
require 'spec_helper'describe "devise/sessions/new.HTML.erb" do let(:user) do stub_model(User).as_new_record end before do assign(:user,user) # Devise provIDes resource and resource_name helpers and # mapPings so stub them here. @vIEw.stub(:resource).and_return(user) @vIEw.stub(:resource_name).and_return('user') @vIEw.stub(:devise_mapPing).and_return(Devise.mapPings[:user]) end it "renders a form to sign the user in" do render rendered.should have_selector("form",:method => "post",:action => user_session_path ) do |form| form.should have_selector("input",:type => "submit") end endend
建议?谢谢
解决方法 Rspec已经改变了一点,它现在正在使用分配.Doc here.
总结以上是内存溢出为你收集整理的ruby-on-rails – 如何在Controller RSpec中测试Devise,错误:未定义方法`assign’for#全部内容,希望文章能够帮你解决ruby-on-rails – 如何在Controller RSpec中测试Devise,错误:未定义方法`assign’for#所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)