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 =<<-EndOfTests
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'

# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: #{file_names.join(', ')}
class #{module_name.to_s.capitalize}DefinitionTests < Test::Unit::TestCase  # :nodoc:

  def test_#{module_name.to_s.downcase}#{decorate(tests)}
  end
end
EndOfTests

test_src
end