diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-04 04:57:25 +0300 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-05 05:54:03 +0300 |
commit | 124bad7bd88e7c329583ec3757eb0ba5fcec66e6 (patch) | |
tree | d6ed77fd8739381bf17ce9b0f7774ec78f3c0561 /spec/helpers/icons_helper_spec.rb | |
parent | 0fca70a40f5067b333ff62e556754b9dd04e26f9 (diff) |
Use stub_rails_env for Rails.env stubbing
RailsHelpers.stub_rails_env takes care of
stubbing Rails.env
Diffstat (limited to 'spec/helpers/icons_helper_spec.rb')
-rw-r--r-- | spec/helpers/icons_helper_spec.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/spec/helpers/icons_helper_spec.rb b/spec/helpers/icons_helper_spec.rb index f92b94a9583..950f951e22e 100644 --- a/spec/helpers/icons_helper_spec.rb +++ b/spec/helpers/icons_helper_spec.rb @@ -60,20 +60,19 @@ describe IconsHelper do non_existing = 'non_existing_icon_sprite' it 'raises in development mode' do - allow(Rails.env).to receive(:development?).and_return(true) + stub_rails_env('development') expect { sprite_icon(non_existing) }.to raise_error(ArgumentError, /is not a known icon/) end it 'raises in test mode' do - allow(Rails.env).to receive(:test?).and_return(true) + stub_rails_env('test') expect { sprite_icon(non_existing) }.to raise_error(ArgumentError, /is not a known icon/) end it 'does not raise in production mode' do - allow(Rails.env).to receive(:test?).and_return(false) - allow(Rails.env).to receive(:development?).and_return(false) + stub_rails_env('production') expect { sprite_icon(non_existing) }.not_to raise_error end |