Sha256: 9582ba0703afd891386b3db964a3b5cc4b4ff22f1ab3a4ea6354b8a9a6a0bf42

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

require File.dirname(__FILE__) + '/tree/depth_first_visitor_base'

module TodoNext

  class RspecGeneratorVisitor < TodoNext::Tree::DepthFirstVisitorBase
    def visit(curr_node, level) #nodoc#
      super
    end

    def process_terminal_node(curr_node, level)
      tabs = '  '*(level-1)
      code = %Q|#{tabs}it("#{curr_node.text}", :pending => "#{curr_node.text}"){}|
    end

    def process_non_terminal_node(curr_node, level)
      tabs = '  '*(level-1)
      codes = curr_node.children.collect { |node| visit(node, 1+level) }
      [%Q|#{tabs}describe "#{curr_node.text}" do|] + codes + ["#{tabs}end"]
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
todo_next-0.0.1 lib/todo_next/rspec_generator_visitor.rb