On Wed, Nov 12, 2008 at 7:55 AM, Matt Wynne <[EMAIL PROTECTED]> wrote:
> How about something more like
>
> Given there are two items in a list: "Zulu and Abba"
> And I have sorted the list alphabetically
> Then "Abba" should appear before "Zulu"
>
> Then /"(.*)" should appear before "(.*)"/ do |first_example,
> second_example|
> response.body.should =~ /#{first_example}.*#{second_example}/
> end
The trouble with that is that you still have a 50-50 chance that your code
is broken. :) Testing sorting is always problematic. Given a particular data
set, other factors may be producing the "right" order (sorting on a
different attribute, randomization). I usually use three items, and realize
that it's not definitive.
///ark
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users