Class: Opal::RSpec::PreRackLocator

Inherits:
Object
  • Object
show all
Includes:
RSpec::Core::RubyProject
Defined in:
lib/opal/rspec/pre_rack_locator.rb

Constant Summary collapse

DEFAULT_PATTERN =
'spec/**/*_spec.{rb,opal}'
DEFAULT_DEFAULT_PATH =
'spec'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec_pattern = nil, spec_exclude_pattern = nil, spec_files = nil, default_path = nil) ⇒ PreRackLocator

Returns a new instance of PreRackLocator.



16
17
18
19
20
21
# File 'lib/opal/rspec/pre_rack_locator.rb', line 16

def initialize(spec_pattern=nil, spec_exclude_pattern=nil, spec_files=nil, default_path=nil)
  @spec_pattern = spec_pattern || DEFAULT_PATTERN
  @spec_exclude_pattern = spec_exclude_pattern
  @spec_files = spec_files
  @default_path = default_path || DEFAULT_DEFAULT_PATH
end

Instance Attribute Details

#default_pathObject

Returns the value of attribute default_path.



14
15
16
# File 'lib/opal/rspec/pre_rack_locator.rb', line 14

def default_path
  @default_path
end

#spec_exclude_patternObject

Returns the value of attribute spec_exclude_pattern.



14
15
16
# File 'lib/opal/rspec/pre_rack_locator.rb', line 14

def spec_exclude_pattern
  @spec_exclude_pattern
end

#spec_filesObject

Returns the value of attribute spec_files.



14
15
16
# File 'lib/opal/rspec/pre_rack_locator.rb', line 14

def spec_files
  @spec_files
end

#spec_patternObject

Returns the value of attribute spec_pattern.



14
15
16
# File 'lib/opal/rspec/pre_rack_locator.rb', line 14

def spec_pattern
  @spec_pattern
end

Instance Method Details

#determine_rootObject



23
24
25
# File 'lib/opal/rspec/pre_rack_locator.rb', line 23

def determine_root
  find_first_parent_containing(@default_path) || '.'
end

#get_spec_load_pathsObject



27
28
29
# File 'lib/opal/rspec/pre_rack_locator.rb', line 27

def get_spec_load_paths
  [@default_path].map { |dir| File.join(root, dir) }
end