Module: Stories::TestCase

Defined in:
lib/stories/runner.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/stories/runner.rb', line 11

def self.included(base)
  class << base
    def story(name, *args, &block)
      context(name, *args) do
        Stories.all[self] = Stories::Story.new(name)
        class_eval(&block) if block_given?
      end
    end

    def scenario(name, *args, &block)
      scenario = Stories::Scenario.new(name)

      Stories.all[self].scenarios << scenario

      test(name) do
        @scenario = scenario
        instance_eval(&block)
      end
    end
  end
end