Use new RailsHelpers module

This commit is contained in:
Ash McKenzie 2019-08-28 11:53:46 +10:00
parent 834f7861e5
commit d5dc50392d
No known key found for this signature in database
GPG key ID: A1253B4953E8D3E6
2 changed files with 9 additions and 7 deletions

View file

@ -1,14 +1,16 @@
require 'rails_helper'
RSpec.describe Gitlab::Favicon, :request_store do
include RailsHelpers
describe '.main' do
it 'defaults to favicon.png' do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production'))
stub_rails_env('production')
expect(described_class.main).to match_asset_path '/assets/favicon.png'
end
it 'has blue favicon for development', unless: Gitlab.ee? do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development'))
stub_rails_env('development')
expect(described_class.main).to match_asset_path '/assets/favicon-blue.png'
end
@ -24,7 +26,7 @@ RSpec.describe Gitlab::Favicon, :request_store do
context 'asset host' do
before do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production'))
stub_rails_env('production')
end
it 'returns a relative url when the asset host is not configured' do

View file

@ -1,10 +1,10 @@
# frozen_string_literal: true
require 'fast_spec_helper'
require_dependency 'gitlab'
require 'spec_helper'
describe Gitlab do
include RailsHelpers
describe '.root' do
it 'returns the root path of the app' do
expect(described_class.root).to eq(Pathname.new(File.expand_path('../..', __dir__)))
@ -113,7 +113,7 @@ describe Gitlab do
it 'is true when dev env' do
allow(described_class).to receive_messages(com?: false, org?: false)
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development'))
stub_rails_env('development')
expect(described_class.dev_env_org_or_com?).to eq true
end