Skip to content

Instantly share code, notes, and snippets.

@henrik
Created February 2, 2012 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik/1725404 to your computer and use it in GitHub Desktop.
Save henrik/1725404 to your computer and use it in GitHub Desktop.
Stubbing Rails environment in tests.
Rails.stub!(:env).and_return(ActiveSupport::StringInquirer.new("production"))
@camertron
Copy link

camertron commented Feb 8, 2023

For anyone else who stumbles on this via Google search, here's a less verbose way:

Rails.stub(:env, "production".inquiry)

@henrik
Copy link
Author

henrik commented Feb 8, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment