[rspec-users] Step matchers

David Chelimsky dchelimsky at gmail.com
Mon Oct 15 21:55:29 EDT 2007


On 10/15/07, Zach Dennis <zach.dennis at gmail.com> wrote:
> What are your thoughts about using symbol identifiers rather then
> question marks? I think this increases readability and gets rid of
> ambiguity at least for me.
>
> step "a user named :username" do |username|
>    ....
> end

I think that I'm leaning towards this one, which is similar.

define_given "a $account_type account with $amount dollars" do
|account_type, amount|
  ...
end

Reasoning:

define_given expresses the fact that we're defining a step better than
'given' does. It also defines a specific type of step, which I think
will help to clarify intent, as well as organize steps in larger
groups.

"I prefer the $dollar_sign_prefix" because it feels more like a token
to me than "a :symbol embedded in a string does"


More information about the rspec-users mailing list