Sha256: 86436f72f4a88bafd13bddc9e39d31f76016662330317439f40af48dad2294d7

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

require 'sprockets'
require 'pathname'
require 'opal/rspec/cached_environment'
require 'opal/rspec/locator'
require 'forwardable'

module Opal
  module RSpec
    class SprocketsEnvironment < ::Sprockets::Environment
      extend Forwardable
      # this class accessible from config.ru and the rask task initializer

      def_delegators :@locator,
                     :spec_pattern=,
                     :spec_pattern,
                     :spec_exclude_pattern=,
                     :spec_exclude_pattern,
                     :spec_files=,
                     :spec_files,
                     :default_path=,
                     :default_path

      def initialize(spec_pattern=nil, spec_exclude_pattern=nil, spec_files=nil, default_path=nil)
        @locator = Opal::RSpec::Locator.new(pattern: spec_pattern, exclude_pattern: spec_exclude_pattern, files: spec_files, default_path: default_path)
        super()
      end

      attr_reader :locator

      def add_spec_paths_to_sprockets
        locator.get_spec_load_paths.each { |p| append_path p }
      end

      def cached
        CachedEnvironment.new(self, @locator)
      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/sprockets_environment.rb
opal-rspec-1.1.0.alpha2 lib/opal/rspec/sprockets_environment.rb
opal-rspec-1.1.0.alpha1 lib/opal/rspec/sprockets_environment.rb
opal-rspec-1.0.0 lib/opal/rspec/sprockets_environment.rb
opal-rspec-1.0.0.alpha1 lib/opal/rspec/sprockets_environment.rb
opal-rspec-0.8.0 lib/opal/rspec/sprockets_environment.rb
opal-rspec-0.8.0.alpha3 lib/opal/rspec/sprockets_environment.rb
opal-rspec-0.8.0.alpha2 lib/opal/rspec/sprockets_environment.rb
opal-rspec-0.8.0.alpha1 lib/opal/rspec/sprockets_environment.rb
opal-rspec-0.7.1 lib/opal/rspec/sprockets_environment.rb
opal-rspec-0.7.0 lib/opal/rspec/sprockets_environment.rb
opal-rspec-0.7.0.rc.2 lib/opal/rspec/sprockets_environment.rb
opal-rspec-0.7.0.rc.1 lib/opal/rspec/sprockets_environment.rb