Class: HomeWorkChecker::ArchiveResult::RubyTestRun
- Inherits:
-
Object
- Object
- HomeWorkChecker::ArchiveResult::RubyTestRun
- Defined in:
- lib/hw_checker/ruby_test_run.rb
Instance Method Summary collapse
-
#initialize(tmp_path, dirname) ⇒ RubyTestRun
constructor
A new instance of RubyTestRun.
- #perform ⇒ Object
Constructor Details
#initialize(tmp_path, dirname) ⇒ RubyTestRun
Returns a new instance of RubyTestRun.
4 5 6 7 8 |
# File 'lib/hw_checker/ruby_test_run.rb', line 4 def initialize(tmp_path, dirname) @work_path = "#{tmp_path}/#{dirname}/test" raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path) @passed = @failed = 0 end |
Instance Method Details
#perform ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/hw_checker/ruby_test_run.rb', line 10 def perform Dir.foreach(@work_path) do |p| next unless File.file?("#{@work_path}/#{p}") && File.extname(p) == '.rb' `rspec #{@work_path}/#{p} > #{@work_path}/#{p}.tmp` count_passed_failed("#{@work_path}/#{p}.tmp") end calc_percent_passed end |