Mocking global variables in rspec

What’s the best way to mock global variables in rspec?

For the model group I would like database interaction.

For the controller group I would like to mock the behavior.

However it’s failing in the ExampleGroup and defining a before(:all)
is overkill since I only require db transaction for the model test.

Any ideas?

Thanks in avance :slight_smile: