Class: Holidays::Definition::Generator::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/holidays/definition/generator/test.rb

Instance Method Summary collapse

Constructor Details

#initialize(decorator) ⇒ Test

Returns a new instance of Test.



7
8
9
# File 'lib/holidays/definition/generator/test.rb', line 7

def initialize(decorator)
  @decorator = decorator
end

Instance Method Details

#call(module_name, file_names, tests) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/holidays/definition/generator/test.rb', line 11

def call(module_name, file_names, tests)
  validate!(module_name, file_names, tests)

  test_src ="# encoding: utf-8\nrequire File.expand_path(File.dirname(__FILE__)) + '/../test_helper'\n\n# This file is generated by the Ruby Holiday gem.\n#\n# Definitions loaded: \#{file_names.join(', ')}\nclass \#{module_name.to_s.capitalize}DefinitionTests < Test::Unit::TestCase  # :nodoc:\n\n  def test_\#{module_name.to_s.downcase}\#{decorate(tests)}\n  end\nend\n"

test_src
end