Sha256: f1a00cc9f67123a8a1a205ee879a11c7a6209d4a6cd8fbc209c8aaf4768515b7

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require 'sprockets'
require 'pathname'
require 'opal/rspec/cached_environment'
require 'opal/rspec/pre_rack_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 = RSpec::PreRackLocator.new spec_pattern, spec_exclude_pattern, spec_files, default_path
        super()
      end

      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

6 entries across 6 versions & 2 rubygems

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