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
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/test/test_helper.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/test/test_helper.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/test/test_helper.rb
jetpacker-0.7.0 test/test_helper.rb
webpacker-5.4.4 test/test_helper.rb
shakapacker-6.5.5 test/test_helper.rb
jetpacker-0.6.0 test/test_helper.rb
shakapacker-6.5.4 test/test_helper.rb
shakapacker-6.5.3 test/test_helper.rb
shakapacker-6.5.2 test/test_helper.rb
shakapacker-6.5.1 test/test_helper.rb
shakapacker-6.5.0 test/test_helper.rb
shakapacker-6.4.1 test/test_helper.rb
shakapacker-6.4.0 test/test_helper.rb
shakapacker-6.3.0 test/test_helper.rb
shakapacker-6.3.0.pre.rc.1 test/test_helper.rb
shakapacker-6.2.1 test/test_helper.rb
shakapacker-6.2.0 test/test_helper.rb
shakapacker-6.1.1 test/test_helper.rb
shakapacker-6.1.0 test/test_helper.rb