Module: Gemmy::Tests::ComponentTests::DynamicStepsTests

Defined in:
lib/gemmy/patches_loaded/tests/component_tests/dynamic_steps_tests.rb

Class Method Summary collapse

Class Method Details

.runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gemmy/patches_loaded/tests/component_tests/dynamic_steps_tests.rb', line 5

def self.run
  runner_class = Class.new
  runner_class.include Gemmy::Components::DynamicSteps
  runner = runner_class.new
  runner.define_step(/(.+) case (.+)/) do |a,b|
    error("failed") unless (a=='test') && (b=='pass')
  end
  puts "  define_step".blue
  runner.step "test case pass"
  begin
    runner.step "test case fail"
  rescue RuntimeError => e
    error("unexpected fail") unless e.message==("failed")
    puts "  step".blue
  end
end