I want to iterate an array inside a Ruby heredoc.
<<-BLOCK
Feature: User logs in
In order to post content
As an user
I want to log in
<< Here i want to iterate scenarios >>
BLOCK
"scenarios" is an array I want to loop. For each element I want to print out:
Scenario: #{scenario}
Given
When
Then
So for example if "scenarios" contains:
scenarios[0] = "User successfully logs in"
scenarios[1] = "User failed to log in"
I want the heredoc string to be:
<<-BLOCK
Feature: #{feature}
In order to #{in_order_to}
As #{as}
I want #{i_want}
Scenario: User successfully logs in
Given
When
And
Scenarios: User failed to log in
Given
When
And
BLOCK
How do I do iterate inside a Ruby heredoc?