Cucumber: Automatic step file creation?
Cucumber doesn't offer this feature. Probably because you would have to tell it where to put the step definitions file, and what to name it.
Cucumber step definitions: Is there a way to automate creating them?
With a very little effort I guess it can be achieved. e.g. This is my feature file.
Feature: dummy
Scenario: First
Given I set sessions to "10"
Then it should have "10"
then in irb
s = `cucumber features/adding.feature -d` #=> "Feature: dummy\n\n Scenario: First...
f = File.new("features/steps.rb","w") #=> create steps.rb file
f.puts s.scan(/(?<=snippets\:).*/m) #=> scan for step definitions and write to steps.rb
f.close
Your steps.rb now has
Given(/^I set sessions to "(.*?)"$/) do |arg1|
pending # express the regexp above with the code you wish you had
end
Then(/^it should have "(.*?)"$/) do |arg1|
pending # express the regexp above with the code you wish you had
end
You can convert this into a command line utility that accepts parameter for filename etc.
Related Topics
Ruby Getting Deeply Nested JSON API Data
Wicked_Pdf Is Not Rendering Header
Iterate Through Array of Hashes in Ruby
How to Set the Mechanize Page Encoding
Can Anyone Explain This Array Declaration to Me
Spring Doesn't Work. [ Uninitialized Constant Spring::Sid::Dl ]
Why Is the Timezone Off in Delayed_Job
How to Sort an Alphanumeric Array in Ruby
How to Find the Most Recently Modified Folder in a Directory Using Ruby
Rails 3: Belongs_To, Has_One and Migrations
New Way of Creating Hashes in Ruby 2.2.0
Bundler: Not Executable: Script/Delayed_Job
Why Rails Can Use 'If' as Hash Key But Not in Ruby
Ruby on Rails: Fully Functional Tableless Model
Can't Dup Nilclass on Association Methods
Idiomatically Mock Openuri.Open_Uri with Minitest
How to Stop Chromedriver from Opening Settings Tab Automatically