Sha256: 7cd2ba3e5f9748b573868f6692791be09393adbb0e2f310900b34e5145a8c7c9

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

require File.join(File.dirname(__FILE__), 'spec_helper.rb')


describe 'volutes' do

  before(:each) do

    Volute.clear!

    volute Invoice do
    end
    volute Package do
    end
    volute Financing::Loan do
    end
    volute Financing::Grant do
    end
    volute Financing do
    end
    volute :delivered do
    end
    volute :not, Financing do
    end
  end

  it 'should return an empty array when there are no volutes' do

    Volute.clear!

    volutes.should == []
  end

  it 'should list volutes' do

    volutes.size.should == 7
  end

  it 'should be updatable' do

    financing = volutes(Financing)
    volutes.reject! { |v| financing.include?(v) }

    volutes.size.should == 3
  end

  it 'should be removable' do

    volutes.remove(Financing)

    volutes.size.should == 3
  end

  describe 'with a class argument' do

    it 'should list only the top-level volutes for that class' do

      volutes(Invoice).size.should == 1
    end
  end

  describe 'with a module argument' do

    it 'should list only the top-level volutes for classes of that module' do

      volutes(Financing).size.should == 4
    end
  end

  describe 'with an :attribute argument' do

    it 'should list only the top-level volutes for that argument' do

      volutes(:delivered).size.should == 1
    end
  end

  describe 'with a :not as first arg' do

    it 'should simply ignore the :not' do

      volutes(Financing).size.should == 4
    end

    it 'should list :not volutes' do

      volutes(:not).size.should == 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
volute-0.1.1 spec/volutes_spec.rb