Class: Test
- Inherits:
-
Array
- Object
- Array
- Test
- Defined in:
- lib/test.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add(command) ⇒ Object
-
#initialize ⇒ Test
constructor
A new instance of Test.
Constructor Details
#initialize ⇒ Test
Returns a new instance of Test.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/test.rb', line 3 def initialize # rspec tests, 'rspec --pattern="**/*.spec"' if(Dir.glob("**/*spec.rb").length > 0) self.add 'rspec --pattern="**/*.spec"' end # nunit tests, 'nunit-console.exe "C::\\Projects\\MyProjects\\bin\\Release\\MyLib.Test.dll"' if File.exist? Test.nunit_console Dir.glob("*.csproj").each{|p| text = File.read(p) if(text.include?("nunit.framework.dll")) # extract AssemblyName of form: <AssemblyName>MyLibrary.Test</AssemblyName> assemblyName=text[/<AssemblyName>([\w\.]+)</,1] outputPath=text[/Release[.\w\W]+<OutputPath>([\w\.\\]+)</,1] if(!assemblyName.nil? && !outputPath.nil?) nunit_dll = "#{Rake.application.original_dir}\\#{outputPath}\\#{assemblyName}.dll".gsub("\\\\","\\").gsub('/','\\') #puts "nunit_dll: " + nunit_dll self.add "\"#{Test.nunit_console}\" \"#{nunit_dll}\"" end end } end end |
Class Method Details
.nunit_console ⇒ Object
30 31 32 |
# File 'lib/test.rb', line 30 def self.nunit_console "C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe" end |
Instance Method Details
#add(command) ⇒ Object
26 27 28 |
# File 'lib/test.rb', line 26 def add command self << command if(!include?(command)) end |