ruby - How to mock Rails::configuration -


I am trying to test a class that uses the rail configuration file. I have the railway railway :: configuration I want to joke.

I have tried things

  Rail: :: singleton_class.expects (: configuration). Return ('Result') Rail :: singleton_class.stubs (: Configuration). Return ('Result')   

How can I go about doing this?

  rail. Estimate (configuration). Return ('Result')   

Please note that there was a typo in your example. Return value returns , return

Also note that, Rails.configuration returns Rails.application.config . If your method does not use the Rails.configuration , it can actually block the call and your expectation will not work.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -