hey there,
this here may be a little too general, and maybe is only a though sharing,
but would be nice to hear what you think.

What is your opinion about expectation steps that negates another
expectation step?

for example: let's say I have a step that specs something:

Then /^I should see the people search form$/ do
    response.should have_tag('form#search')
    # this of course could get more complex, like several expectations in a
row or so
end

then I would like to reuse the step but negating it, like:

Then /^I should not see the people search form$/ do
  !(Then "I should see the people search form")
end

this wont work because spectations (or some of them) of the first step will
fail.  A low level implementation of this could be something like:

Then /^I should (.*) see the people search form$/ do |bool|
    post_fix = "_#{bool}" if bool
    # allow the incompleteness of this line, but you get the idea :-)
    # it'll send should or should_not
    response.send("should#{postfix}", have_tag('form#search') )
end

but here there are considerations regarding unreadability of the step, but
anyway the question again:

would this be too bad? too problematic? what do you think about expectation
steps negating another expectation steps?

cheers
joaquin
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to