Class: Retest::Program
- Inherits:
-
Object
- Object
- Retest::Program
- Defined in:
- lib/retest/program.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#repository ⇒ Object
Returns the value of attribute repository.
-
#runner ⇒ Object
Returns the value of attribute runner.
Instance Method Summary collapse
- #diff(branch) ⇒ Object
-
#initialize(runner: nil, repository: nil, command: nil) ⇒ Program
constructor
A new instance of Program.
- #run(modified, added, removed) ⇒ Object
Constructor Details
#initialize(runner: nil, repository: nil, command: nil) ⇒ Program
Returns a new instance of Program.
4 5 6 7 8 |
# File 'lib/retest/program.rb', line 4 def initialize(runner: nil, repository: nil, command: nil) @runner = runner @repository = repository @command = command end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
3 4 5 |
# File 'lib/retest/program.rb', line 3 def command @command end |
#repository ⇒ Object
Returns the value of attribute repository.
3 4 5 |
# File 'lib/retest/program.rb', line 3 def repository @repository end |
#runner ⇒ Object
Returns the value of attribute runner.
3 4 5 |
# File 'lib/retest/program.rb', line 3 def runner @runner end |
Instance Method Details
#diff(branch) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/retest/program.rb', line 18 def diff(branch) raise "Git not installed" unless VersionControl::Git.installed? test_files = repository.find_tests VersionControl::Git.diff_files(branch) puts "Tests found:" test_files.each { |test_file| puts " - #{test_file}" } puts "Running tests..." runner.run_all_tests command.format_batch(*test_files) end |
#run(modified, added, removed) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/retest/program.rb', line 10 def run(modified, added, removed) repository.sync(added: added, removed: removed) runner.sync(added: added, removed: removed) system('clear 2>/dev/null') || system('cls 2>/dev/null') runner.run (modified + added).first, repository: repository end |