I get that there's not existing support for variables in Cucumber
Feature: Do something
When I have the secret password <%= ENV["PASSWORD"] %>
Then my credentials are valid
Dir.glob("./*.feature.erb").each do |path|
erb = File.read path
result = ERB.new(erb).result(binding)
new_path = path.gsub(".feature.erb", ".feature")
File.open(new_path, 'w') do |f|
Why on earth would you do this when you can just write
When 'I use the secret password'
and have your step definition call code to get the password. By adding an extra pre-processing step you are making your whole test suite much more complex and fragile.
There is never any need for the language of scenarios to get information about how to do something from external sources. You can always push that requirement down into step definitions and supporting code.