Sha256: 11b260f716ecfcd4c1575bb7cdea71eb9863712122c219f5925d47216ee03b63

Contents?: true

Size: 1.23 KB

Versions: 22

Compression:

Stored size: 1.23 KB

Contents

require 'rspec'
require 'cantango'
require 'fixtures/models'

describe CanTango::Configuration::Guest do
  before do
    CanTango.config.user.base_class = User
    CanTango.config.user_account.base_class = UserAccount
  end

  subject { CanTango.config.guest }

  describe 'default settings' do
    it 'should not have defined UserAccount.guest' do
      UserAccount.should_not respond_to(:guest)
    end

    it 'should not have defined User.guest' do
      User.should_not respond_to(:guest)
    end

    its(:account) { should be_nil } # should be set to UserAccount.guest if defined
    its(:user)    { should be_nil } # should set to User.guest if defined ?
  end

  describe 'set user' do
    describe 'with obj arg' do
      before :each do
        subject.user = '2'
      end

      its(:user) { should == '2' }
    end

    describe 'with block arg' do
      before :each do
        subject.user { 2 }
      end

      its(:user) { should == 2 }
    end

    describe 'with Proc arg' do
      before :each do
        subject.user Proc.new { 2 }
      end

      its(:user) { should be_a Proc }
    end
  end

  describe 'set user account' do
    before :each do
      subject.account = '2'
    end

    its(:account) { should == '2' }
  end
end



Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
cantango-0.9.4.7 spec/cantango/configuration/guest_spec.rb
cantango-0.9.4.6 spec/cantango/configuration/guest_spec.rb
cantango-0.9.4.5 spec/cantango/configuration/guest_spec.rb
cantango-0.9.4.3 spec/cantango/configuration/guest_spec.rb
cantango-0.9.4.2 spec/cantango/configuration/guest_spec.rb
cantango-0.9.4.1 spec/cantango/configuration/guest_spec.rb
cantango-0.9.4 spec/cantango/configuration/guest_spec.rb
cantango-0.9.3.2 spec/cantango/configuration/guest_spec.rb
cantango-0.8.9.5 spec/cantango/configuration/guest_spec.rb
cantango-0.8.9.4 spec/cantango/configuration/guest_spec.rb
cantango-0.8.9.3 spec/cantango/configuration/guest_spec.rb
cantango-0.8.9.2 spec/cantango/configuration/guest_spec.rb
cantango-0.8.9.1 spec/cantango/configuration/guest_spec.rb
cantango-0.8.9 spec/cantango/configuration/guest_spec.rb
cantango-0.8.8.1 spec/cantango/configuration/guest_spec.rb
cantango-0.8.8 spec/cantango/configuration/guest_spec.rb
cantango-0.8.7 spec/cantango/configuration/guest_spec.rb
cantango-0.8.6.2 spec/cantango/configuration/guest_spec.rb
cantango-0.8.6.1 spec/cantango/configuration/guest_spec.rb
cantango-0.8.6 spec/cantango/configuration/guest_spec.rb