You should stub in it
, let
, before
blocks. Move your code there and it will work
And this code works in my tests (maybe your variant can work as well)
Rails.env.stub(:development? => true)
for example
describe "in dev mode" do
let(:mail) { Notifier.welcome_signup user }
before { Rails.env.stub(:development? => true) }
it "send an email to" do
expect(mail.to).to eq([GlobalConstants::DEV_EMAIL_ADDRESS])
end
end