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
shakapacker-6.1.0.beta.0 test/test_helper.rb
shakapacker-6.0.2 test/test_helper.rb
shakapacker-6.0.1 test/test_helper.rb
shakapacker-6.0.0 test/test_helper.rb
shakapacker-6.0.0.rc.14 test/test_helper.rb
shakapacker-6.0.0.rc.13 test/test_helper.rb
shakapacker-6.0.0.rc.12 test/test_helper.rb
shakapacker-6.0.0.rc.6 test/test_helper.rb
webpacker-6.0.0.rc.6 test/test_helper.rb
webpacker-5.4.3 test/test_helper.rb
webpacker-6.0.0.rc.5 test/test_helper.rb
webpacker-6.0.0.rc.4 test/test_helper.rb
webpacker-6.0.0.rc.3 test/test_helper.rb
webpacker-6.0.0.rc.2 test/test_helper.rb
webpacker-5.4.2 test/test_helper.rb
webpacker-5.4.1 test/test_helper.rb
webpacker-6.0.0.rc.1 test/test_helper.rb
webpacker-5.4.0 test/test_helper.rb
webpacker-5.3.0 test/test_helper.rb
webpacker-5.2.2 test/test_helper.rb