On Sun, Sep 14, 2008 at 9:13 AM, Joseph Wilk <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Can you give an example of how you would want the step body of:
>
>> Then /I should see "(.*)"/ do |text|
>
> to be different.
>
> I would aim for this step to be reusable. When I have conflicts I take
> the approach of adding context to such a step.
>
>> Then /I should see "(.*)" in the page/ do |text|

That should raise an AmbiguousStep error if you also have /I should
see "(.*)"/. What I've been doing is stuff like ...

  Then /the list of (.*) should incude "(.*)"/

... in order to differentiate. I'll say that I do allow this to impose
html element IDs:

  Then /the list of (.*) should incude "(.*)"/ do |list_of, text|
    list_id = list_of.downcase.replace(' ','-')
    response.should have_tag("ul##{list_id}") do
      with_tag("li",text)
    end
  end

But this one step covers a lot of cases for me.

Thoughts?

David

> Hence allowing different step bodies. Its up to you whether you bind
> 'the page' and case/switch on this or just have different steps.
>
> HTH,
> --
> Joseph Wilk
> http://www.joesniff.co.uk
>
>
> Damian Jones wrote:
>> I know that cucumber does not allow ambiguous steps to stop duplication
>> of specs, but I ran into the problem of only being a ble to use the
>> following step name once in the whole project
>>
>> Then /I should see "(.*)" do |text|
>>
>> What can I do to get round this?
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to