Sha256: 6da3ed42fe67f9064cebdae054ef50681eb23d0d5b127fd639c62cde535e9699

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

require 'cantango/config'
require 'fixtures/models'

class User
  include_and_extend SimpleRoles
end

class Admin < User
end

CanTango.configure do |config|
  config.users.register     :user, User
  config.users.register     :admin, Admin
end

require 'spec_helper'
require 'helpers/current_user_accounts'

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

  include_and_extend ::CurrentUsers
end

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

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

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

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

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

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

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


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cantango-api-0.1.3 spec/cantango/api/ability/user_spec.rb
cantango-api-0.1.2 spec/cantango/api/ability/user_spec.rb
cantango-api-0.1.1 spec/cantango/api/ability/user_spec.rb
cantango-api-0.1.0 spec/cantango/api/ability/user_spec.rb