Sha256: a796daf29a9f4e30f0caedb4661f2139c228438c17ec0362eeac93fe724071ff

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

require 'rspec'
require 'cantango'
require 'fixtures/models'
require 'cantango/api/current_users'
require 'cantango/configuration/engines/store_engine_shared'

CanTango.config.users.register :user, :admin

class Context
  include CanTango::Api::User::Ability

  include CurrentUsers
  extend ::CurrentUsers
end

describe CanTango::Api::User::Ability do
  subject { Context.new }

  describe 'user_ability user' do
    specify { subject.user_ability(subject.current_user).should be_a CanTango::Ability }
  end

  describe 'user_ability admin' do
    specify { subject.user_ability(subject.current_admin).should be_a CanTango::Ability }
  end

  describe 'current_ability :user' do
    specify { subject.current_ability(:user).should be_a CanTango::Ability }

    it 'should set the :user user correctly on ability' do
      subject.current_ability(:user).user.should == subject.current_user
    end
  end

  describe 'current_ability :admin' do
    specify { subject.current_ability(:admin).should be_a CanTango::Ability }

    it 'should set the :admin user correctly on ability' do
      subject.current_ability(:admin).user.should == subject.current_admin
    end
  end
end


Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cantango-0.8.9.5 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.9.4 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.9.3 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.9.2 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.9.1 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.9 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.8.1 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.8 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.7 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.6.2 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.6.1 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.6 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.5.1 spec/cantango/api/user/ability_api_spec.rb
cantango-0.8.0 spec/cantango/api/user/ability_api_spec.rb