in my Rails application I also try to test my calls to Redis. For example in my User Model I have:
def self.add_to_visibles user #To show in the menu
$redis.lpush("user_visibles", user.to_json(only: [:vorname, :nachname, :id, :created_at]))
end
Now when i run this test, also test data is inserted into the redis store "user_visibles"
. That means when I am on development I also get to see this data.
Thats why I would like to change my method to:
def self.add_to_visibles user #To show in the menu
$redis.lpush($user_visibles, user.to_json(only: [:vorname, :nachname, :id, :created_at]))
end
And store in $user_visibles
:
for test: $user_visibles = "user_visibles_test"
and for production $user_visibles = "user_visibles"
Where do I best store this variable? And how so that it is different for the enviroments?
Thanks!
Aucun commentaire:
Enregistrer un commentaire