Created
January 2, 2015 19:25
-
-
Save bamchoh/38f8e02f1afb11c0e281 to your computer and use it in GitHub Desktop.
test 用 config ファイル案 (途中)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestCase | |
class << self | |
def set_params(*methods) | |
methods.each do |m| | |
define_method(m, ->(d = nil) { | |
instance_variable_set("@#{m}".to_sym, d) if d | |
instance_variable_get("@#{m}".to_sym) | |
}) | |
end | |
end | |
end | |
set_params :id, :title, :template, :pattern | |
def initialize(title) | |
title(title) | |
end | |
def show | |
puts id | |
puts title | |
puts template | |
puts pattern | |
end | |
end | |
def test(title, &blk) | |
@test = TestCase.new(title) | |
@test.instance_eval(&blk) | |
@test.show | |
end | |
test "Hoge Test" do | |
id "Test-001" | |
template "xxxx.xml" | |
pattern "yyyy.ptn" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment