Class: Test::Unit::TestCase
- Defined in:
- lib/spec/test_to_spec/test_case_ext.rb
Class Method Summary collapse
-
.to_rspec ⇒ Object
Returns a String representing the RSpec translation of this class.
Class Method Details
.to_rspec ⇒ Object
Returns a String representing the RSpec translation of this class
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/spec/test_to_spec/test_case_ext.rb', line 10 def self.to_rspec tree = ParseTree.new.parse_tree(self).first rspec_tree = Spec::TestToSpec::SexpTransformer.new.process(tree) modules = self.name.split("::")[0..-2] result = "" result += modules.collect{|m| "module #{m}\n"}.join("") result += RubyToRuby.new.process(rspec_tree[0]) result += modules.collect{|m| "\nend"}.join("") result end |