class Opal::RSpec::Locator

Constants

DEFAULT_DEFAULT_PATH
DEFAULT_GLOB
DEFAULT_PATTERN

Attributes

default_path[RW]
spec_exclude_pattern[RW]
spec_files[RW]
spec_pattern[RW]

Public Class Methods

new(pattern: nil, exclude_pattern: nil, files: nil, default_path: nil) click to toggle source
# File lib/opal/rspec/locator.rb, line 18
def initialize(pattern: nil, exclude_pattern: nil, files: nil, default_path: nil)
  @spec_pattern         = pattern || DEFAULT_PATTERN
  @spec_exclude_pattern = exclude_pattern
  @spec_files           = files
  @default_path         = default_path || DEFAULT_DEFAULT_PATH
end

Public Instance Methods

determine_root() click to toggle source
# File lib/opal/rspec/locator.rb, line 25
def determine_root
  find_first_parent_containing(@default_path) || '.'
end
get_opal_spec_requires() click to toggle source
# File lib/opal/rspec/locator.rb, line 33
def get_opal_spec_requires
  files = @spec_files || FileList[*@spec_pattern].exclude(*@spec_exclude_pattern)
  files.uniq.map { |file| File.expand_path file }
end
get_spec_load_paths() click to toggle source
# File lib/opal/rspec/locator.rb, line 29
def get_spec_load_paths
  [@default_path].map { |dir| File.join(root, dir) }
end