Sha256: 8a1a988285c9b18ca6a7d7fdfd53bfcbbf59d1b296ca52defd3532f0615ccb95

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

require File.expand_path("../../spec_helper", File.dirname(__FILE__))

describe Sprinkle::Package::PackageRepository do
  
  before do
    @repository = PackageRepository.new {}
    @test_package = Package.new(:test) {}
    @mysql_package = Package.new(:mysql, :provides => :db) {}
    @test_v2_package = Package.new(:test) do
      version "2"
    end
    @another_package = Package.new(:another) {}
  end

  it 'should allow adding a package' do
    @repository.add @test_package
    @repository.count.should == 1
  end
  
  it 'should allow clearing' do
    @repository.add @test_package
    @repository.clear
    @repository.count.should == 0
  end
  
  it "should find by provides" do
    @repository.add @mysql_package
    @repository.find_all("db").should == [ @mysql_package ]
  end
  
  it "should find by name" do
    @repository.add @test_package
    @repository.find_all("test").should == [ @test_package ]
  end
  
  it "should filter by version" do
    @repository.add @test_package
    @repository.add @test_v2_package
    @repository.find_all("test").size.should == 2
    @repository.first("test", :version => "2").should == @test_v2_package
  end

  after do
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sprinkle-0.7.4 spec/sprinkle/package/package_repository_spec.rb
sprinkle-0.7.3 spec/sprinkle/package/package_repository_spec.rb
sprinkle-0.7.2 spec/sprinkle/package/package_repository_spec.rb
sprinkle-0.7.1.1 spec/sprinkle/package/package_repository_spec.rb
sprinkle-0.7.1 spec/sprinkle/package/package_repository_spec.rb
sprinkle-0.7 spec/sprinkle/package/package_repository_spec.rb