Module: Protest::Stories::TestCase

Defined in:
lib/protest/stories.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/protest/stories.rb', line 28

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

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

      Protest::Stories.all[self].scenarios << scenario

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