Class: Bozo::TestRunners::Mspec
- Inherits:
-
Object
- Object
- Bozo::TestRunners::Mspec
- Defined in:
- lib/bozo/test_runners/mspec.rb
Overview
A TestRunner for MSpec
Instance Method Summary collapse
- #agents(agents) ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ Mspec
constructor
A new instance of Mspec.
- #platform(platform) ⇒ Object
- #project(path) ⇒ Object
- #report_path(path) ⇒ Object
-
#runner_args ⇒ Object
Returns the arguments required for the runner’s executable.
-
#runner_path ⇒ Object
Returns the path to the runner’s executable.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Mspec
Returns a new instance of Mspec.
6 7 8 |
# File 'lib/bozo/test_runners/mspec.rb', line 6 def initialize @projects = [] end |
Instance Method Details
#agents(agents) ⇒ Object
22 23 24 |
# File 'lib/bozo/test_runners/mspec.rb', line 22 def agents(agents) @agents = agents end |
#execute ⇒ Object
75 76 77 |
# File 'lib/bozo/test_runners/mspec.rb', line 75 def execute execute_command :mspec, [runner_path] << runner_args end |
#platform(platform) ⇒ Object
10 11 12 |
# File 'lib/bozo/test_runners/mspec.rb', line 10 def platform(platform) @platform = platform end |
#project(path) ⇒ Object
14 15 16 |
# File 'lib/bozo/test_runners/mspec.rb', line 14 def project(path) @projects << path end |
#report_path(path) ⇒ Object
18 19 20 |
# File 'lib/bozo/test_runners/mspec.rb', line 18 def report_path(path) @report_path = path end |
#runner_args ⇒ Object
Returns the arguments required for the runner’s executable.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bozo/test_runners/mspec.rb', line 50 def runner_args args = [] @projects.each do |project| ('temp', 'msbuild', project, '**', "#{project}.dll").each do |test_dll| args << "\"#{test_dll}\"" end end # If @agents is defined and not 0 if @agents.to_i > 0 args << "--agents=#{@agents}" end report_path = @report_path report_path = ('temp', 'mspec', "#{Time.now.to_i}-mspec-report.xml") unless report_path # Ensure the directory is there because mspec won't make it FileUtils.mkdir_p File.dirname(report_path) args << "--xml \"#{report_path}\"" args end |
#runner_path ⇒ Object
Returns the path to the runner’s executable.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bozo/test_runners/mspec.rb', line 33 def runner_path exe_name = 'mspec-clr4.exe' mspec_runners = ('packages', 'Machine.Specifications*', 'tools', exe_name) raise mspec_runner_not_found if mspec_runners.empty? raise multiple_runners_found if mspec_runners.size > 1 mspec_runner = mspec_runners.first log_debug "Found runner at #{mspec_runner}" mspec_runner end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/bozo/test_runners/mspec.rb', line 26 def to_s "Run tests with mspec against projects #{@projects}" end |