Sha256: 400d1a9e4a0436873b34fa783c50ae2a09abe943f8c94f85e1d76480e20f637e

Contents?: true

Size: 846 Bytes

Versions: 13

Compression:

Stored size: 846 Bytes

Contents

require 'sprockets'

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

      def initialize(env, locator)
        super env
        @locator = locator
      end

      def get_opal_spec_requires
        @locator.get_opal_spec_requires.map do |file|
          asset = find_asset(file)
          unless asset
            raise "Unable to find asset for file #{file} within load paths. Check your load path/file specification.\n"+
                  "Searched paths:\n- #{paths.join("\n- ")}\n"

          end
          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

13 entries across 13 versions & 1 rubygems

Version Path
opal-rspec-1.1.0.alpha3 lib/opal/rspec/cached_environment.rb
opal-rspec-1.1.0.alpha2 lib/opal/rspec/cached_environment.rb
opal-rspec-1.1.0.alpha1 lib/opal/rspec/cached_environment.rb
opal-rspec-1.0.0 lib/opal/rspec/cached_environment.rb
opal-rspec-1.0.0.alpha1 lib/opal/rspec/cached_environment.rb
opal-rspec-0.8.0 lib/opal/rspec/cached_environment.rb
opal-rspec-0.8.0.alpha3 lib/opal/rspec/cached_environment.rb
opal-rspec-0.8.0.alpha2 lib/opal/rspec/cached_environment.rb
opal-rspec-0.8.0.alpha1 lib/opal/rspec/cached_environment.rb
opal-rspec-0.7.1 lib/opal/rspec/cached_environment.rb
opal-rspec-0.7.0 lib/opal/rspec/cached_environment.rb
opal-rspec-0.7.0.rc.2 lib/opal/rspec/cached_environment.rb
opal-rspec-0.7.0.rc.1 lib/opal/rspec/cached_environment.rb