Sha256: 2c2410718ae6001c17207704deb46cc15d1d709efb35d94eadd087f9e10b874a
Contents?: true
Size: 1.19 KB
Versions: 9
Compression:
Stored size: 1.19 KB
Contents
require File.expand_path('../../spec_helper', __FILE__) describe Redirect do # this is solely to get through 'Can't find first XXX' shoulda crap #before do #Redirect.create :pattern => 'sdfsdf', :to => 'sdfsffdf' #end it { should validate_presence_of(:pattern) } it { should validate_presence_of(:to) } # commented out since it doesn't work with :allow_blank => true #it { should validate_uniqueness_of(:position) } it 'assigns incremental position on create' do r1 = Redirect.create :pattern => '.*', :to => 'someurl' r1.position.should == 0 r2 = Redirect.create :pattern => '.*', :to => 'someurl' r2.position.should == 1 r2.position = 4 r2.save r3 = Redirect.create :pattern => '.*', :to => 'someurl' r3.position.should == 5 end it 'updates order (with which redirects picked up for matching request)' do r1 = Redirect.create :pattern => '.*', :to => 'somewhere', :position => 0 r2 = Redirect.create :pattern => '.*', :to => 'somewhere', :position => 1 Redirect.update_order([r2.id, r1.id]).should be true r1.reload.position.should == 1 r2.reload.position.should == 0 Redirect.update_order([nil, 34]).should == false end end
Version data entries
9 entries across 9 versions & 1 rubygems