Class: SmartTest::Project
- Inherits:
-
Object
- Object
- SmartTest::Project
- Defined in:
- lib/smart_test/project.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#test_folder ⇒ Object
readonly
Returns the value of attribute test_folder.
Instance Method Summary collapse
-
#initialize(root, test_folder = "spec") ⇒ Project
constructor
A new instance of Project.
- #test_file?(file) ⇒ Boolean
- #test_files ⇒ Object
- #using_bundle? ⇒ Boolean
- #using_git? ⇒ Boolean
Constructor Details
#initialize(root, test_folder = "spec") ⇒ Project
Returns a new instance of Project.
5 6 7 8 9 |
# File 'lib/smart_test/project.rb', line 5 def initialize(root, test_folder = "spec") @root = root @test_folder = test_folder raise NoTestFolderError unless File.exists? File.join(root, test_folder) end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
3 4 5 |
# File 'lib/smart_test/project.rb', line 3 def root @root end |
#test_folder ⇒ Object (readonly)
Returns the value of attribute test_folder.
3 4 5 |
# File 'lib/smart_test/project.rb', line 3 def test_folder @test_folder end |
Instance Method Details
#test_file?(file) ⇒ Boolean
23 24 25 |
# File 'lib/smart_test/project.rb', line 23 def test_file?(file) file =~ /\A#{test_folder}\/.*#{test_folder}\.rb\Z/i end |
#test_files ⇒ Object
19 20 21 |
# File 'lib/smart_test/project.rb', line 19 def test_files Dir.glob "#{test_folder}/**/*_#{test_folder}.rb" end |
#using_bundle? ⇒ Boolean
11 12 13 |
# File 'lib/smart_test/project.rb', line 11 def using_bundle? @using_bundle ||= File.exists?(File.join root, "Gemfile") end |
#using_git? ⇒ Boolean
15 16 17 |
# File 'lib/smart_test/project.rb', line 15 def using_git? @using_git ||= File.exists?(File.join root, ".git") end |