Ruby Flare

Your awesome Tagline

1 note

Silence warnings

If you find that you need to reset the value of a constant in a spec, use the silence_warnings rails method to keep your output quiet:

silence_warnings { MY_CONSTANT = "hello" }

The times I find I need to modify a constant in a spec is when it is a constant that ought to be modified only for your tests eg a filepath or a pagination value.

(Source: api.rubyonrails.org)

Filed under rails rspec

  1. rubyflare posted this