ruby on rails - Why undefined method in RSPEC for a call to method in an included module? -


in our rails 3.2.12 app, model project needs use method find_config_const in module authentify_utility.rb in authentify engine. in model project, there

include authentify::authentifyutility  

the method find_config_const called in model project as:

validates :sales_id, :presence => true,                        :numericality => {:greater_than => 0} if find_config_const('project_has_sales', 'projectx') == 'true' 

here error in rspec:

project.rb:51:in `<class:project>': undefined method `find_config_const' authentify::authentifyutility:module (nomethoderror) 

in module authentify_utility, after method definition, there module function declaration method find_config_const (to make method available others):

module_function :find_config_const 

there no error when execution of code except rspec error. how fix error rspec? bug in rspec? help.

update:

definition of method

def find_config_const(param_name, engine=nil, version=nil)       const_value = nil       engineconfig = authentify::engineconfig.where(:engine_name => engine, :engine_version => version, :argument_name => param_name).first() if engine.present? && version.present?       engineconfig = authentify::engineconfig.where(:engine_name => engine, :argument_name => param_name).first() if engine.present? && version.blank?       engineconfig = authentify::engineconfig.where(:argument_name => param_name).first() if engine.blank? && version.blank?       const_value = engineconfig.argument_value unless  engineconfig.nil?       const_value end 

could show definition of find_config_const?

without seeing it, best guess should not call method module name, since #include'd in model.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -