Sha256: c5fddecda8a1418467e13c5bd432fa6a4cc3be23de4035ea8723c5693830a9ef

Contents?: true

Size: 845 Bytes

Versions: 6

Compression:

Stored size: 845 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|
          asset = find_asset(file)
          raise "Unable to find asset for file #{file} within load paths #{paths}. Check your load path/file specification." unless asset
          logical_path = asset.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

6 entries across 6 versions & 2 rubygems

Version Path
opal-rspec-0.6.2 lib/opal/rspec/cached_environment.rb
opal-rspec-0.6.1 lib/opal/rspec/cached_environment.rb
opal-rspec-0.6.0 lib/opal/rspec/cached_environment.rb
opal-rspec-0.6.0.beta1 lib/opal/rspec/cached_environment.rb
opal-connect-rspec-0.5.0 lib/opal/rspec/cached_environment.rb
opal-rspec-0.5.0 lib/opal/rspec/cached_environment.rb