Sha256: b205cf43b451e4c1acf04737d92506d2502d583a6edcb91b0da9fda78d35d129

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require_relative "../application"
require_relative "case_manager"

# Define filename to be used into our test
# @param filename (String) Filename to be required
def use(filename)
  filename += ".rb"
  app = Application.instance
  rbfiles = File.join(app.project_path, "**", filename)
  files = Dir.glob(rbfiles)
  findfiles = []
  files.sort.each { |f| findfiles << f if f.include?(filename) }
  require_relative findfiles.first
  app.uses << File.basename(findfiles.first)
end

# Define macro. That's a name to predefined target-run-expect evaluation.
# @param name (String) macro name
# @param block (Block) macro code
def define_macro(name, *args, &block)
  Application.instance.macros[name] = {args: args, block: block}
end
alias def_macro define_macro
alias defmacro define_macro

# Define a group of tests
# @param name (String) Group name
# @param block (Block) Tests code
def group(name, &block)
  Application.instance.groups << {name: name, block: block}
end
alias task group

# Start test
# @param block (Block) Extra code executed at the end.
def play(&block)
  CaseManager.instance.play(&block)
end
alias start play

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
teuton-2.3.8 lib/teuton/case_manager/dsl.rb
teuton-2.3.7 lib/teuton/case_manager/dsl.rb