Sha256: f8cde7308b66225c7eddf5c94323ad15434f12c88fff75fb52519aa4101316ca

Contents?: true

Size: 1018 Bytes

Versions: 5

Compression:

Stored size: 1018 Bytes

Contents

require 'spec_helper'

describe WithoutCancan do

  let(:wc1) { FactoryGirl.build(:wc1) }
  let(:wc2) { FactoryGirl.build(:wc2) }

  it 'should return nil on next if no objects exists' do
    wc1.next.should be_nil
  end

  it 'should return nil on previous if no objects exists' do
    wc1.previous.should be_nil
  end

  it 'should return self on next if one object exists' do
    wc1.save
    wc1.next.should eq(wc1)
  end

  it 'should return self on previous if one object exists' do
    wc1.save
    wc1.previous.should eq(wc1)
  end

  it 'should return valid next object ' do
    wc1.save
    wc2.save
    wc1.next.should eq(wc2)
  end

  it 'should return valid previous object' do
    wc1.save
    wc2.save
    wc2.previous.should eq(wc1)
  end

  it 'should return self if next is called on previous' do
    wc1.save
    wc2.save
    wc1.previous.next.should eq(wc1)
  end

  it 'should return self if previous is called on next' do
    wc1.save
    wc2.save
    wc1.next.previous.should eq(wc1)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acts_as_previous_next-0.0.5 spec/models/without_cancan_spec.rb
acts_as_previous_next-0.0.4 spec/models/without_cancan_spec.rb
acts_as_previous_next-0.0.3 spec/models/without_cancan_spec.rb
acts_as_previous_next-0.0.2 spec/models/without_cancan_spec.rb
acts_as_previous_next-0.0.1 spec/models/without_cancan_spec.rb