Richard
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com (mailto:cu...@googlegroups.com).
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com (mailto:cukes+un...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
Jeff,
Are you familiar with the Ruby keyword `return` and its cousin `next`? They stop executing the current method or block in the same way as reaching the end. A safety check at the top of a method is called a "guard clause".
I like to keep my step definitions very thin indeed -- simply a translation layer from a line of English to a line of code wherever possible.
Thus, I might write something like the following:
Given 'the default customer' do
ensure_customer_exists(default_name)
end
def ensure_customer_exists(name)
return if customer_exists?(name)
create_customer(name)
end
--
Rob Hunter
(typed with my thumbs)
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.