On Thu, Apr 23, 2009 at 12:34 AM, Joaquin Rivera Padron
<joahk...@gmail.com>wrote:

> ok, let's say:
>
> Then /should see "(.+)"/ do |text|
>    # a binary step, easily negable
> end
>
> Then /I deny some steps/ do
>   # really not so readable
>   Not Then "should see \"your are not log in\""
>
>   Then "some other step that holds"
>
>   # another way of saying it bad
>   But Not Then "should receive info for non users"
>
>   # or maybe this bad
>   And Not Then "should receive info for non users"
> end
>
> now comes the mars attack part, I haven't dig into cucumber or rspec code
> that much, only guessing here.
> and Not could do something like receiving the step that comes behind the
> keyword
>
> def Not(step)
>     # we tell the step to assert (I mean the rspec synonym) itself
>     # so that it raises some RSpec exception
>     step.assert!
>     # the step really passed, we should raise an Exception not rescueable
> for the next rescue
>     raise Spec::UncatchableException
>     rescue Spec::Expectations # or something like that
>         # green, nothing, this is what we expected
>     end
> end
>
> is this doable? I have to say I have not come to need this that bad to ask
> the cucumber to provide it
>

Only if you have exactly one thing that can be negated. If you have several
things, this won't work.

Frankly, I don't think I'll ever implement a cute feature in Cucumber that
allows you to have out of the box negation. It would be ugly no matter how
it's done, and it would only save you a line or 2 of code.

Aslak


>
> is really late and this cross my mind :-)
>
> joaquin
>
> _______________________________________________
> 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