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
# The end of the script (the beginning of the script was just for collecting the variables from user input)

    File.open(File.join("features", "#{filename}.feature"), "w") do |file|
      file.write(
        <<-BLOCK
Feature: #{feature}
  In order to #{in_order_to}
  As #{as}
  I want #{i_want}

#{scenarios.map do |x|
<<-INNERBLOCK
  Scenario: #{x}
    Given
    When
    Then
INNERBLOCK
end}
        BLOCK
      )
    end

# cat features/user_logs_in.feature

Feature: 'User logs in'
  In order to 'read and write content'
  As 'an user'
  I want 'to log in'

["  Scenario: 'User sucessfully logs in'\n    Given\n    When\n    Then\n", "  Scenario: 'User failed to log in'\n    Given\n    When\n    Then\n"]