Sha256: 701a24241f34a7eb2ab6f9d996155bb692778e6cc8c0c997609759a9e90d33f8

Contents?: true

Size: 1.22 KB

Versions: 11

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'
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

11 entries across 11 versions & 1 rubygems

Version Path
cantango-config-0.1.9.2 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.8.1 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.8 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.7 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.6 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.5 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.4 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.3 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.2 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.1 spec/cantango/configuration/guest_spec.rb
cantango-config-0.1.0 spec/cantango/configuration/guest_spec.rb