Skip to content

Instantly share code, notes, and snippets.

@bamchoh
Created January 2, 2015 19:25
Show Gist options
  • Save bamchoh/38f8e02f1afb11c0e281 to your computer and use it in GitHub Desktop.
Save bamchoh/38f8e02f1afb11c0e281 to your computer and use it in GitHub Desktop.
test 用 config ファイル案 (途中)
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