Commit d2aee809 authored by Rémy Coutable's avatar Rémy Coutable

Introduce spec/fast_spec_helper.rb to run spec files that don't rely on the whole Rails env

Signed-off-by: Rémy Coutable's avatarRémy Coutable <remy@rymai.me>
parent 023d4f6f
require_dependency 'gitlab/popen'
module Gitlab
def self.config
Settings
......
require_dependency 'gitlab/encoding_helper'
module Gitlab
module Git
# The ID of empty tree.
......
module RuboCop
module SpecHelpers
SPEC_HELPERS = %w[spec_helper.rb rails_helper.rb].freeze
SPEC_HELPERS = %w[fast_spec_helper.rb rails_helper.rb spec_helper.rb].freeze
# Returns true if the given node originated from the spec directory.
def in_spec?(node)
......
require 'bundler/setup'
require 'settingslogic'
ENV["RAILS_ENV"] = 'test'
ENV["IN_MEMORY_APPLICATION_SETTINGS"] = 'true'
unless Kernel.respond_to?(:require_dependency)
module Kernel
alias_method :require_dependency, :require
end
end
unless defined?(Rails)
module Rails
def self.root
Pathname.new(File.expand_path(''))
end
# Copied from https://github.com/rails/rails/blob/v4.2.10/railties/lib/rails.rb#L59-L61
def self.env
@_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development")
end
end
end
# Settings is used in config/initializers/2_app.rb
class Settings < Settingslogic
source Rails.root.join('config/gitlab.yml')
namespace Rails.env
end
# Defines Gitlab and Gitlab.config
unless defined?(Gitlab) && Gitlab.respond_to?(:config)
require_relative '../config/initializers/2_app'
end
require_relative 'support/rspec'
require 'rails_helper'
require 'fast_spec_helper'
require_dependency 'gitlab'
describe Gitlab do
describe '.com?' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment