Sha256: 52777677846b122b0c457a14ef8de6310a512efe8fceb08ad8c270d1ac6d0ef1

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

require 'sprockets'
require 'opal/rspec/post_rack_locator'

module Opal
  module RSpec
    class CachedEnvironment < ::Sprockets::CachedEnvironment
      # this class is accessible from the ERB/runner file

      def initialize(env, pre_run_locator)
        super env
        @locator = RSpec::PostRackLocator.new(pre_run_locator)
      end

      def get_opal_spec_requires
        @locator.get_opal_spec_requires.map do |file|
          logical_path = find_asset(file).logical_path
          # These will go directly into require '...' statements in Opal, so need to trim extensions
          logical_path.sub File.extname(logical_path), ''
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-rspec-0.5.0.beta3 lib/opal/rspec/cached_environment.rb