Class: Zapata::Core::Loader
- Inherits:
-
Object
- Object
- Zapata::Core::Loader
- Defined in:
- lib/zapata/core/loader.rb
Class Method Summary collapse
- .full_helper_path ⇒ Object
- .helper_name ⇒ Object
- .load_spec_helper ⇒ Object
- .rails_helper_path ⇒ Object
- .spec_dir ⇒ Object
- .spec_helper_path ⇒ Object
Class Method Details
.full_helper_path ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/zapata/core/loader.rb', line 27 def full_helper_path paths = { rails_helper: rails_helper_path, spec_helper: spec_helper_path, }.freeze paths[helper_name.to_sym] end |
.helper_name ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/zapata/core/loader.rb', line 17 def helper_name if File.exist?("#{rails_helper_path}.rb") 'rails_helper' elsif File.exist?("#{spec_helper_path}.rb") 'spec_helper' else raise 'Was not able to load nor rails_helper, nor spec_helper' end end |
.load_spec_helper ⇒ Object
36 37 38 39 |
# File 'lib/zapata/core/loader.rb', line 36 def load_spec_helper $LOAD_PATH << spec_dir require "#{helper_name}" end |
.rails_helper_path ⇒ Object
9 10 11 |
# File 'lib/zapata/core/loader.rb', line 9 def rails_helper_path File.("#{spec_dir}/rails_helper", __FILE__) end |
.spec_dir ⇒ Object
5 6 7 |
# File 'lib/zapata/core/loader.rb', line 5 def spec_dir File.join(Dir.pwd, '/spec') end |
.spec_helper_path ⇒ Object
13 14 15 |
# File 'lib/zapata/core/loader.rb', line 13 def spec_helper_path File.("#{spec_dir}/spec_helper", __FILE__) end |