Sha256: a2de71d9bc86df017cc7da4a7219e01e9a982d6cd7aa33f269a7c005011cf1d3

Contents?: true

Size: 735 Bytes

Versions: 9

Compression:

Stored size: 735 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'

ViteRails.instance = ::ViteRails.new

class ViteRails::Test < Minitest::Test
private

  def reloaded_config
    ViteRails.instance.instance_variable_set(:@config, nil)
    ViteRails.instance.instance_variable_set(:@dev_server, nil)
    ViteRails.env = {}
    ViteRails.config
    ViteRails.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

9 entries across 9 versions & 1 rubygems

Version Path
vite_rails-1.0.8 test/test_helper.rb
vite_rails-1.0.7 test/test_helper.rb
vite_rails-1.0.6 test/test_helper.rb
vite_rails-1.0.5 test/test_helper.rb
vite_rails-1.0.4 test/test_helper.rb
vite_rails-1.0.3 test/test_helper.rb
vite_rails-1.0.2 test/test_helper.rb
vite_rails-1.0.1 test/test_helper.rb
vite_rails-1.0.0 test/test_helper.rb