Class: Opal::RSpec::Locator
- Inherits:
-
Object
- Object
- Opal::RSpec::Locator
- Includes:
- RSpec::Core::RubyProject
- Defined in:
- lib/opal/rspec/locator.rb
Constant Summary collapse
- DEFAULT_GLOB =
'**{,/*/**}/*_spec{.js,}.{rb,opal}'
- DEFAULT_PATTERN =
"spec-opal/#{DEFAULT_GLOB}"
- DEFAULT_DEFAULT_PATH =
'spec-opal'
Instance Attribute Summary collapse
-
#default_path ⇒ Object
Returns the value of attribute default_path.
-
#spec_exclude_pattern ⇒ Object
Returns the value of attribute spec_exclude_pattern.
-
#spec_files ⇒ Object
Returns the value of attribute spec_files.
-
#spec_pattern ⇒ Object
Returns the value of attribute spec_pattern.
Instance Method Summary collapse
- #determine_root ⇒ Object
- #get_opal_spec_requires ⇒ Object
- #get_spec_load_paths ⇒ Object
-
#initialize(pattern: nil, exclude_pattern: nil, files: nil, default_path: nil) ⇒ Locator
constructor
A new instance of Locator.
Constructor Details
#initialize(pattern: nil, exclude_pattern: nil, files: nil, default_path: nil) ⇒ Locator
Returns a new instance of Locator.
18 19 20 21 22 23 |
# 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 |
Instance Attribute Details
#default_path ⇒ Object
Returns the value of attribute default_path.
16 17 18 |
# File 'lib/opal/rspec/locator.rb', line 16 def default_path @default_path end |
#spec_exclude_pattern ⇒ Object
Returns the value of attribute spec_exclude_pattern.
16 17 18 |
# File 'lib/opal/rspec/locator.rb', line 16 def spec_exclude_pattern @spec_exclude_pattern end |
#spec_files ⇒ Object
Returns the value of attribute spec_files.
16 17 18 |
# File 'lib/opal/rspec/locator.rb', line 16 def spec_files @spec_files end |
#spec_pattern ⇒ Object
Returns the value of attribute spec_pattern.
16 17 18 |
# File 'lib/opal/rspec/locator.rb', line 16 def spec_pattern @spec_pattern end |
Instance Method Details
#determine_root ⇒ Object
25 26 27 |
# File 'lib/opal/rspec/locator.rb', line 25 def determine_root find_first_parent_containing(@default_path) || '.' end |
#get_opal_spec_requires ⇒ Object
33 34 35 36 |
# 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. file } end |
#get_spec_load_paths ⇒ Object
29 30 31 |
# File 'lib/opal/rspec/locator.rb', line 29 def get_spec_load_paths [@default_path].map { |dir| File.join(root, dir) } end |