rspec 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGES +9 -0
  2. data/Rakefile +7 -10
  3. data/bin/spec +1 -1
  4. data/bin/test2spec +93 -0
  5. data/doc/src/default.template +1 -1
  6. data/doc/src/documentation/index.page +37 -37
  7. data/doc/src/documentation/mocks.page +88 -60
  8. data/doc/src/tools/index.page +2 -2
  9. data/doc/src/tools/meta.info +1 -1
  10. data/doc/src/tools/test2spec.page +73 -0
  11. data/doc/src/tutorials/notes.txt +1 -1
  12. data/doc/src/tutorials/stack_01.page +4 -4
  13. data/doc/src/tutorials/stack_02.page +6 -6
  14. data/doc/src/tutorials/stack_03.page +8 -8
  15. data/doc/src/tutorials/stack_04.page +2 -2
  16. data/doc/src/tutorials/stack_05.page +1 -1
  17. data/lib/spec/api/sugar.rb +3 -3
  18. data/lib/spec/runner/base_text_formatter.rb +11 -5
  19. data/lib/spec/runner/option_parser.rb +1 -1
  20. data/lib/spec/runner/progress_bar_formatter.rb +1 -1
  21. data/lib/spec/runner/rdoc_formatter.rb +1 -1
  22. data/lib/spec/runner/reporter.rb +6 -3
  23. data/lib/spec/runner/specdoc_formatter.rb +1 -1
  24. data/lib/spec/runner/specification.rb +1 -0
  25. data/lib/spec/tool/ruby2ruby.rb +485 -0
  26. data/lib/spec/tool/test_unit_translator.rb +114 -83
  27. data/lib/spec/tool/translation_test_runner.rb +118 -0
  28. data/lib/spec/version.rb +1 -1
  29. data/test/spec/runner/context_test.rb +4 -0
  30. data/test/spec/runner/progress_bar_formatter_test.rb +1 -1
  31. data/test/spec/runner/rdoc_formatter_test.rb +1 -1
  32. data/test/spec/runner/reporter_test.rb +24 -7
  33. data/test/spec/runner/specdoc_formatter_test.rb +1 -1
  34. data/test/spec/runner/specification_test.rb +8 -0
  35. data/test/spec/tool/ruby_to_ruby_test.rb +79 -0
  36. data/test/spec/tool/test_unit_api_spec.rb +45 -31
  37. data/test/spec/tool/test_unit_api_test.rb +13 -6
  38. data/test/spec/tool/test_unit_translator_test.rb +6 -1
  39. metadata +11 -10
  40. data/bin/test2rspec +0 -35
  41. data/doc/src/tools/test2rspec.page +0 -13
  42. data/lib/spec/tool/command_line.rb +0 -39
  43. 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