ruby on rails - Testing nested controllers: NoMethodError: undefined method `empty?' for nil:NilClass -


i have been trying controller test pass... routes.rb

namespace :school   resource :account, :except => [:new, :create, :destroy], :controller => 'account'   resources :classes, :path => ""    resources :discussions     resources :comments   end   resources :materials end end  

my discussioncontroller specs:

describe "post 'create'"  before(:each)   @user = factorygirl.create(:coordinator_user)   login_user(@user)   @klass = factorygirl.build(:klass)   @klass.creator = @user   @klass.save   @parameters = factorygirl.attributes_for(:discussion, :klass_id => @klass, :user_id => @user) end  context "with valid parameters"   "creates new job"     expect { post :create, :class_id => @klass.id, :discussion => @parameters }.to   change(discussion, :count).by(1)   end    "should create new discussion"     post :create, :class_id => @klass.id     response.should be_redirect     response.should redirect_to(school_account_path(assigns(:discussion).id))     assigns(:discussion).should_not be_nil     assigns(:discussion).should_not be_new_record   end  end 

i errors: 1) nomethoderror: undefined method empty?' nil:nilclass # ./lib/slug.rb:3:inslug' cannot understand nil here.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -