Sha256: 43add4707b154d0f03c835687eaff33ecffa74a93ea691ef3e97e92c75dc8541

Contents?: true

Size: 711 Bytes

Versions: 4

Compression:

Stored size: 711 Bytes

Contents

require 'spec_helper'
require 'fixtures/models'

class CommonContext
  include CanTango::Api::Common
end

class Wheat
end

class Barley
end

describe CanTango::Api::Common do
  before do
    @user = User.new 'kris', 'kris@mail.ru'
  end

  subject { CommonContext.new }

  describe 'create_ability(candidate)' do
    specify do
      subject.create_ability(@user).should be_a CanTango::Ability::Executor
    end
  end

  describe 'category(label)' do
    before do
      CanTango.config.categories.register :grains => ['Wheat', 'Barley']
    end
    
    specify do
      lambda { subject.category('unknown') }.should raise_error
    end
    specify { subject.category('grains').should_not be_empty }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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