I agree with Paul and David. I would use strategy (2) with Machinist'd data or stubs.
1. Set up two items, out of order. 2. Assert ordered(items) swaps them. If you are concerned about further cases such as numerical sorting versus string sorting, or edge cases, then put those in too, but David's code looks good to me, as a minimum check. My only addition is that sometimes I stick a .map(&:name) on the end of my subject to make the output nicer. describe OrderedFooList let(:shorts) { stub(:name => "Shorts") } let(:socks) { stub(:name => "socks") } describe '#ordered' do subject { OrderedFooList.new(input).ordered.map(&:name) } context 'when given socks and Shorts in that order' do let(:input) { [socks, shorts] } it { should == ['Shorts', 'socks'] } end end end -Greg -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to rails-oceania@googlegroups.com. To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.