Class: Pione::TestHelper::Transformer::Spec

Inherits:
Object
  • Object
show all
Defined in:
lib/pione/test-helper/transformer-helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(testcases, name, parser_name, option, context) ⇒ Spec

Returns a new instance of Spec.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/pione/test-helper/transformer-helper.rb', line 51

def initialize(testcases, name, parser_name, option, context)
  @testcases = testcases
  @name = name
  @parser_name = parser_name
  @option = Hash.new
  @option[:parser_class] = option[:parser_class] || Pione::Lang::DocumentParser
  @option[:transformer_class] = option[:transformer_class] || Pione::Lang::DocumentTransformer
  @option[:package_name] = option[:package_name] || "Test"
  @option[:filename] = option[:filename] || "Test"
  @context = context
end

Instance Method Details

#declareObject

declare specitification in the context



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/pione/test-helper/transformer-helper.rb', line 64

def declare
  @testcases.each do |tc|
    case tc
    when Naming::Eq, Naming::Block
      test_case(tc)
    when SucceedCase
      succeed_case(tc)
    when FailCase
      fail_case(tc)
    end
  end
end