Sha256: bac01346031e7d32cc77edc3e964d685ba9fc641763c1e4b9eb69382a8eebee1

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

abort "`snapshot_inspector` is only meant to be loaded in the `development` and `test` environments. Your current environment is `#{Rails.env}`. Move the gem into the `group :development, :test` block in your Gemfile." unless Rails.env.development? || Rails.env.test?

require "snapshot_inspector/version"
require "snapshot_inspector/engine"
require "minitest/snapshot_inspector_plugin"
require "importmap-rails"

module SnapshotInspector
  module Test
    autoload :TestUnitHelpers, "snapshot_inspector/test/test_unit_helpers"
    autoload :RSpecHelpers, "snapshot_inspector/test/rspec_helpers"
  end

  STORAGE_DIRECTORY = "tmp/snapshot_inspector"

  class << self
    attr_accessor :configuration
  end

  class Configuration
    attr_accessor :importmap, :snapshot_taking_enabled, :storage_directory, :host, :route_path

    def initialize
      @importmap = Importmap::Map.new
      @snapshot_taking_enabled = ENV.fetch("TAKE_SNAPSHOTS", nil) == "1"
      @storage_directory = nil
      @host = "http://localhost:3000"
      @route_path = "/rails/snapshots"
    end
  end

  def self.initialize_configuration
    self.configuration ||= Configuration.new
  end

  def self.configure
    initialize_configuration
    yield(configuration)
  end
end

SnapshotInspector.initialize_configuration

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
snapshot_inspector-0.1.1 lib/snapshot_inspector.rb