Sha256: a335cb8def42add0440212def610d2684f50e804a85418e4af038f8943bd5f07

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'
require 'repository/api_behavior'

describe ::Stickler::Repository::Local do

  before( :each ) do
    @repos_dir = File.join( @spec_dir, "repos" )
    @repo_dir  = File.join( @repos_dir, "1" )
    @repo      = ::Stickler::Repository::Local.new( @repo_dir )
  end

  after( :each ) do
    ::Stickler::Repository::Local.purge
    FileUtils.rm_rf( @repos_dir )
  end

  %w[ gems specifications ].each do |sub_dir|
    it "creates #{sub_dir} directory" do
      new_dir = File.join( @repo_dir , sub_dir ) + File::SEPARATOR
      File.directory?( new_dir ).should eq true
      @repo.send( "#{sub_dir}_dir" ).should eq new_dir
    end

  end

  it "returns a list of all the specs in the repo" do
    Dir.glob( File.join( @gems_dir, "*.gem" ) ).each do |gem|
      @repo.push( gem )
    end
    @repo.specs.size.should eq 5
  end

  it "two instances with the same repo dir are the same object" do
    repo2 = ::Stickler::Repository::Local.new( File.join(@repos_dir, '1') )
    repo2.object_id.should eq @repo.object_id
    ::Stickler::Repository::Local.repos.size.should eq 1
  end


  it "keeps track of all the repository instances" do
    ::Stickler::Repository::Local.new( File.join(@repos_dir, "2" ) )
    ::Stickler::Repository::Local.new( File.join(@repos_dir, "3" ) )
    ::Stickler::Repository::Local.repos.size.should eq 3
  end

  it_should_behave_like 'includes Repository::Api'
  it_should_behave_like 'implements Repository::Api'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stickler-2.3.0 spec/repository/local_spec.rb