Sha256: 0343b21a5bf6e82a1d440e2a1bb6b97189f0f03048895844305687291a027b2a

Contents?: true

Size: 831 Bytes

Versions: 86

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true
require "minitest/autorun"
require "rails"
require "rails/test_help"
require "byebug"

require_relative "test_app/config/environment"

Rails.env = "production"

Webpacker.instance = ::Webpacker::Instance.new

class Webpacker::Test < Minitest::Test
  private
    def reloaded_config
      Webpacker.instance.instance_variable_set(:@env, nil)
      Webpacker.instance.instance_variable_set(:@config, nil)
      Webpacker.instance.instance_variable_set(:@dev_server, nil)
      Webpacker.env
      Webpacker.config
      Webpacker.dev_server
    end

    def with_rails_env(env)
      original = Rails.env
      Rails.env = ActiveSupport::StringInquirer.new(env)
      reloaded_config
      yield
    ensure
      Rails.env = ActiveSupport::StringInquirer.new(original)
      reloaded_config
    end
end

Version data entries

86 entries across 86 versions & 5 rubygems

Version Path
webpacker-4.0.0.rc.5 test/test_helper.rb
webpacker-4.0.0.rc.4 test/test_helper.rb
webpacker-4.0.0.rc.3 test/test_helper.rb
webpacker-4.0.0.rc.2 test/test_helper.rb
webpacker-4.0.0.rc.1 test/test_helper.rb
webpacker-4.0.0.pre.3 test/test_helper.rb