Wow, it has been here a long time, but in my case I did this:
allow(Rails.configuration.your_config) .to receive(:[]) .with(:your_key) .and_return('your desired return')
Passing and configuration values are shaded correctly. =)
Now, one more thing about your implementation, I think it would be better if you defined both methods internally from run or something that you decided to execute. Something like that:
class YourClass extend self def run Rails.application.config[:your_option] == 'value' ? first_method : second_method end def first_method
Hope this helps.
Edit: Oh yes, my bad, I based my answer on this one .
leomilrib
source share