[rspec-users] Cucumber feature checking sort order of list
Matt Wynne
matt at mattwynne.net
Wed Nov 12 10:55:36 EST 2008
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
On 12 Nov 2008, at 15:47, Peter Ehrenberg wrote:
> 2008/11/12 Joaquin Rivera Padron <joahking at gmail.com>:
>>> [...]
>> thanks Peter, seems I will give that a try, though I like you do
>> not like
>> very much
>
> This is my code. Maybe it helps:
>
> Then /the title are in alphabetic order/ do
> # FIXME: Ugly
> titles = []
> doc = Hpricot(response.body)
> (doc/"tr/td[1]/*/text()").each do |e|
> titles << e.to_s
> end
> titles.should == titles.sort
> end
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users
mailing list