If I have the following module
module UserSession
$user_array = factory_girl_users.values
def factory_girl_users
Hash[:user_1 => FactoryGirl.attributes_for(:automated_user), :user_2 => FactoryGirl.attributes_for(:automated_user_1)]
end
end
World(UserSession)
How do I access the factory_girl_users method, since at the moment I'm getting:
undefined method `factory_girl_users' for UserSession:Module (NoMethodError)
I can't think what is responsible for this.
I think you can define a module method
module UserSession
def self.factory_girl_users
Hash[:user_1 => FactoryGirl.attributes_for(:automated_user), :user_2 => FactoryGirl.attributes_for(:automated_user_1)]
end
def self.user_array
factory_girl_users.values
end
end
To access the user_array
You would do UserSession.user_array
.