mock Rails.env.development? using rspec

There is a much better way described here: https://stackoverflow.com/a/24052647/362378

it "should do something specific for production" do 
  allow(Rails).to receive(:env) { "production".inquiry }
  #other assertions
end

This will provide all the functions like Rails.env.test? and also works if you just compare the strings like Rails.env == 'production'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)