rspec 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +9 -0
 - data/Rakefile +7 -10
 - data/bin/spec +1 -1
 - data/bin/test2spec +93 -0
 - data/doc/src/default.template +1 -1
 - data/doc/src/documentation/index.page +37 -37
 - data/doc/src/documentation/mocks.page +88 -60
 - data/doc/src/tools/index.page +2 -2
 - data/doc/src/tools/meta.info +1 -1
 - data/doc/src/tools/test2spec.page +73 -0
 - data/doc/src/tutorials/notes.txt +1 -1
 - data/doc/src/tutorials/stack_01.page +4 -4
 - data/doc/src/tutorials/stack_02.page +6 -6
 - data/doc/src/tutorials/stack_03.page +8 -8
 - data/doc/src/tutorials/stack_04.page +2 -2
 - data/doc/src/tutorials/stack_05.page +1 -1
 - data/lib/spec/api/sugar.rb +3 -3
 - data/lib/spec/runner/base_text_formatter.rb +11 -5
 - data/lib/spec/runner/option_parser.rb +1 -1
 - data/lib/spec/runner/progress_bar_formatter.rb +1 -1
 - data/lib/spec/runner/rdoc_formatter.rb +1 -1
 - data/lib/spec/runner/reporter.rb +6 -3
 - data/lib/spec/runner/specdoc_formatter.rb +1 -1
 - data/lib/spec/runner/specification.rb +1 -0
 - data/lib/spec/tool/ruby2ruby.rb +485 -0
 - data/lib/spec/tool/test_unit_translator.rb +114 -83
 - data/lib/spec/tool/translation_test_runner.rb +118 -0
 - data/lib/spec/version.rb +1 -1
 - data/test/spec/runner/context_test.rb +4 -0
 - data/test/spec/runner/progress_bar_formatter_test.rb +1 -1
 - data/test/spec/runner/rdoc_formatter_test.rb +1 -1
 - data/test/spec/runner/reporter_test.rb +24 -7
 - data/test/spec/runner/specdoc_formatter_test.rb +1 -1
 - data/test/spec/runner/specification_test.rb +8 -0
 - data/test/spec/tool/ruby_to_ruby_test.rb +79 -0
 - data/test/spec/tool/test_unit_api_spec.rb +45 -31
 - data/test/spec/tool/test_unit_api_test.rb +13 -6
 - data/test/spec/tool/test_unit_translator_test.rb +6 -1
 - metadata +11 -10
 - data/bin/test2rspec +0 -35
 - data/doc/src/tools/test2rspec.page +0 -13
 - data/lib/spec/tool/command_line.rb +0 -39
 - data/test/spec/tool/command_line_test.rb +0 -21
 
| 
         @@ -1,39 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'find'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'fileutils'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Spec
         
     | 
| 
       5 
     | 
    
         
            -
              module Tool
         
     | 
| 
       6 
     | 
    
         
            -
                class CommandLine
         
     | 
| 
       7 
     | 
    
         
            -
                  def initialize(filesystem=nil)
         
     | 
| 
       8 
     | 
    
         
            -
                    @filesystem = filesystem.nil? ? self : filesystem
         
     | 
| 
       9 
     | 
    
         
            -
                    @translator = TestUnitTranslator.new
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
       11 
     | 
    
         
            -
                
         
     | 
| 
       12 
     | 
    
         
            -
                  def run(source, dest, out)
         
     | 
| 
       13 
     | 
    
         
            -
                    if FileTest.directory?(source)
         
     | 
| 
       14 
     | 
    
         
            -
                      raise "DEST must be a directory when SOURCE is a directory" if FileTest.file?(dest)
         
     | 
| 
       15 
     | 
    
         
            -
                      Find.find(source) do |path|
         
     | 
| 
       16 
     | 
    
         
            -
                        if FileTest.file?(path) and File.extname(path) == '.rb'
         
     | 
| 
       17 
     | 
    
         
            -
                          relative_path = path[source.length+1..-1]
         
     | 
| 
       18 
     | 
    
         
            -
                          dest_path = File.join dest, relative_path
         
     | 
| 
       19 
     | 
    
         
            -
                          run path, dest_path, out
         
     | 
| 
       20 
     | 
    
         
            -
                        end
         
     | 
| 
       21 
     | 
    
         
            -
                      end
         
     | 
| 
       22 
     | 
    
         
            -
                    else
         
     | 
| 
       23 
     | 
    
         
            -
                      raise "DEST must be a file when SOURCE is a file" if FileTest.directory?(dest)
         
     | 
| 
       24 
     | 
    
         
            -
                      out.puts "Writing: #{dest}"
         
     | 
| 
       25 
     | 
    
         
            -
                      @filesystem.write_translation(source, dest)
         
     | 
| 
       26 
     | 
    
         
            -
                    end
         
     | 
| 
       27 
     | 
    
         
            -
                  end
         
     | 
| 
       28 
     | 
    
         
            -
                  
         
     | 
| 
       29 
     | 
    
         
            -
                  def write_translation(source, dest)
         
     | 
| 
       30 
     | 
    
         
            -
                    dir = File.dirname(dest)
         
     | 
| 
       31 
     | 
    
         
            -
                    FileUtils.mkdir_p(dir) unless File.directory?(dir)
         
     | 
| 
       32 
     | 
    
         
            -
                    File.open(dest, "w") do |io|
         
     | 
| 
       33 
     | 
    
         
            -
                      translation = @translator.translate(source)
         
     | 
| 
       34 
     | 
    
         
            -
                      io.write(translation)
         
     | 
| 
       35 
     | 
    
         
            -
                    end
         
     | 
| 
       36 
     | 
    
         
            -
                  end
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
              end
         
     | 
| 
       39 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,21 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/../../test_helper'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'spec/tool/command_line'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Spec
         
     | 
| 
       5 
     | 
    
         
            -
              module Tool
         
     | 
| 
       6 
     | 
    
         
            -
                class CommandLineTest < Test::Unit::TestCase
         
     | 
| 
       7 
     | 
    
         
            -
                  def test_writes_translated_file
         
     | 
| 
       8 
     | 
    
         
            -
                    translator = Api::Mock.new "translator"
         
     | 
| 
       9 
     | 
    
         
            -
                    filesystem = Api::Mock.new "filesystem"
         
     | 
| 
       10 
     | 
    
         
            -
                    filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_translator_test.rb", "spec/test_unit_translator_test.rb"
         
     | 
| 
       11 
     | 
    
         
            -
                    filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_api_test.rb",        "spec/test_unit_api_test.rb"
         
     | 
| 
       12 
     | 
    
         
            -
                    filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_api_spec.rb",        "spec/test_unit_api_spec.rb"
         
     | 
| 
       13 
     | 
    
         
            -
                    filesystem.should_receive(:write_translation).with "./test/spec/tool/command_line_test.rb",         "spec/command_line_test.rb"
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                    cl = CommandLine.new(filesystem)
         
     | 
| 
       16 
     | 
    
         
            -
                    out = StringIO.new
         
     | 
| 
       17 
     | 
    
         
            -
                    cl.run(File.dirname(__FILE__), "spec", out)
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
                end
         
     | 
| 
       20 
     | 
    
         
            -
              end
         
     | 
| 
       21 
     | 
    
         
            -
            end
         
     |