ruby - Why can my functional test not see my methods created using define_method? -


i have in application_controller.rb:

group.all.each |g|   define_method( "is_#{ g.name }?".to_sym )     unless @current_user.in_group?( g.name )       flash[:notice] = "you must in #{ g.name.titleize } group access page"       redirect_to '/'       return false     end   end end 

it uses entries in groups table create methods on fly.

my problem functional tests can't see methods:

  1) error: test_has_an_index(sc::questionscontrollertest): nomethoderror: undefined method `is_admin?' #<sc::questionscontroller:0x000000067749c0> 

what need functional tests can see dynamically created methods?


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -