You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any official generic name for the Given, When, Then, etc. step definition methods? For example, such generic names could be step or define.
# features/step_definitions/showtime_steps.rb
define 'a movie' do
@movie = Movie.create!
end
define "I set the showtime to {string} at {string}" do |date, time|
@movie.update_attribute(:showtime_date, Date.parse(date))
@movie.update_attribute(:showtime_time, time)
end
define "the showtime description should be {string}" do |showtime|
expect(@movie.showtime).to eq(showtime)
end
If such name does not exist, is there an official way to create aliases for the step definition methods? Currently, I do the following.
# features/support/env.rb
require 'cucumber/rails'
class << self
alias_method :step, :register_rb_step_definition
alias_method :define, :register_rb_step_definition
end
# or
# singleton_class.alias_method :step, :register_rb_step_definition
# singleton_class.alias_method :define, :register_rb_step_definition
Is it a good solution, or is there any better way to accomplish the task?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi.
Is there any official generic name for the
Given
,When
,Then
, etc. step definition methods? For example, such generic names could bestep
ordefine
.If such name does not exist, is there an official way to create aliases for the step definition methods? Currently, I do the following.
Is it a good solution, or is there any better way to accomplish the task?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions