Skip to content

Commit

Permalink
Added a new scenario using a new step definition that interpolated a …
Browse files Browse the repository at this point in the history
…constant referencing a cucumber transform
  • Loading branch information
Stephen-Kaye committed Jan 6, 2017
1 parent b79a9d3 commit 18bed85
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions example/step_definitions/example.step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
"#{date} #{day} #{time}"
end

#
# Assign a trnasform to a variable to be interpolated later in a step definition
#
SUBSTITUTED_FILE = Transform(/^file '([^']*)'$/) do |filepath|
"Contents loaded from file"
end

Given /^that (#{CUSTOMER}) is a valid customer$/ do |customer|
pending "Customer #{customer} validation"
end
Expand Down Expand Up @@ -100,6 +107,12 @@
pending characters
end

#
# Step using interpolated transform to replace file reference with contents of file
#
Then /^the (#{SUBSTITUTED_FILE}) will be replaced with the file contents$/ do |content|
pending "File contained #{content}"
end

#
# Some details about the helper method that might be picked up in the documentation.
Expand Down
5 changes: 5 additions & 0 deletions example/transform.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ Feature: Step Transforms
Scenario: Step Transform uses a constant
Given this first step
Then I expect that the step, on the step transformer page, will link to the step transform

@third
Scenario: Step Transform uses an interpolated transform
Given this first step
Then the file './somelocation/somefile.input' will be replaced with the file contents

0 comments on commit 18bed85

Please sign in to comment.