Sha256: d844c0c0632e4ec460ef91760f05a0e420abb58bf5b498eeecb7ae250d7d7341
Contents?: true
Size: 695 Bytes
Versions: 7
Compression:
Stored size: 695 Bytes
Contents
require 'spec_helper' describe Ego do before { @egos = { :bob => Ego.create(:name => 'Bob'), :nick => Ego.create(:name => 'Nick'), :sally => Ego.create(:name => 'Sally') } @egos.each { |name, ego| ego.reload ego.update :size_position => 0 ego.save! } @egos.each {|name, ego| ego.reload } } describe "sorting on size alternative primary key" do before { @egos[:nick].update :size_position => 0 @egos[:sally].update :size_position => 2 } subject { Ego.rank(:size).to_a } its(:size) { should == 3 } its(:first) { should == @egos[:nick] } its(:last) { should == @egos[:sally] } end end
Version data entries
7 entries across 7 versions & 1 rubygems