File: custom_formatter.feature

package info (click to toggle)
cucumber 1.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,584 kB
  • sloc: ruby: 11,799; python: 28; makefile: 8; tcl: 3
file content (41 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Feature: Custom Formatter

  Scenario: my own formatter
    Given a file named "features/f.feature" with:
      """
      Feature: I'll use my own
        because I'm worth it
        Scenario: just print me
          Given this step works
      """
    And a file named "features/step_definitions/steps.rb" with:
      """
      Given /^this step works$/ do
      end
      """
    And a file named "features/support/ze/formator.rb" with:
      """
      module Ze
        class Formator
          def initialize(step_mother, io, options)
            @step_mother = step_mother
            @io = io
          end

          def before_feature(feature)
            @io.puts feature.short_name.upcase
          end

          def scenario_name(keyword, name, file_colon_line, source_indent)
            @io.puts "  #{name.upcase}"
          end
        end
      end
      """
    When I run cucumber "features/f.feature --format Ze::Formator"
    Then it should pass with exactly:
      """
      I'LL USE MY OWN
        JUST PRINT ME

      """