Sha256: bbcb8b6d879595caf80a904997fdc8140529422233ca692e498a035ab5b0ff8c

Contents?: true

Size: 1.4 KB

Versions: 10

Compression:

Stored size: 1.4 KB

Contents

require 'test_helper'
require 'canard'

describe 'Canard::Abilities' do

  subject { Canard::Abilities }
   
  describe "ability_paths" do
     
    it "defaults to app/abilities" do
      subject.definition_paths.must_include 'app/abilities'
    end
     
    it "appends paths" do
      subject.definition_paths << 'other_abilities'
      subject.definition_paths.must_include 'other_abilities'
    end

    it "can be overwritten" do
      subject.definition_paths = ['other_abilities']
      
      subject.definition_paths.must_equal ['other_abilities']
    end

  end
  
  describe "default_path" do
    
    it "defaults to app/abilities" do
      subject.default_path.must_equal 'app/abilities'
    end

    it "can be changhed" do
      subject.default_path = 'other_abilities'
      
      subject.default_path.must_equal 'other_abilities'
    end

    
  end
  
  describe "for" do
    
    it "adds the block to the definitions" do
      block = lambda { puts 'some block' }
      
      subject.for(:definition, &block)

      assert_equal block, subject.definitions[:definition]
    end
    
    it "normalises the key to a symbol" do
      subject.for('definition') { puts 'a block' }
      
      subject.definitions.keys.must_include :definition
    end
    
    it "rasises ArgumentError if no block is provided" do
      proc { subject.for(:definition) }.must_raise ArgumentError
    end
    
  end
      
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
canard-0.4.2.pre test/canard/abilities_test.rb
canard-0.4.1 test/canard/abilities_test.rb
canard-0.4.0 test/canard/abilities_test.rb
canard-0.4.0.pre test/canard/abilities_test.rb
canard-0.3.7 test/canard/abilities_test.rb
canard-0.3.6 test/canard/abilities_test.rb
canard-0.3.5 test/abilities_test.rb
canard-0.3.4 test/abilities_test.rb
canard-0.3.2 test/abilities_test.rb
canard-0.3.1 test/abilities_test.rb