Sha256: 37a68616173c52401f2386064bda80810f5e26685a6d33261cbf4a9aa0943d2a

Contents?: true

Size: 1.98 KB

Versions: 3

Compression:

Stored size: 1.98 KB

Contents

require 'spec_helper'

describe RepoManager do

  def load_gemspec
    filename = File.expand_path('../../../repo_manager.gemspec', __FILE__)
    eval(File.read(filename), nil, filename)
  end

  describe 'gemspec' do

    it "should return the gem VERSION" do
      @gemspec = load_gemspec
      RepoManager::version.should_not be_nil
      @gemspec.version.to_s.should == RepoManager::version
    end

    describe 'files' do

      it "should return 'files' array" do
        @gemspec = load_gemspec
        @gemspec.files.is_a?(Array).should == true
        @gemspec.files.include?('VERSION').should == true
      end
      it "should return 'executables' array" do
        @gemspec = load_gemspec
        @gemspec.executables.is_a?(Array).should == true
      end

      describe 'without .gemfiles cache' do
        before(:each) do
          File.stub!('exists?').and_return false
          @gemspec = load_gemspec
        end

        it "should return 'files' from using 'git ls-files" do
          File.exists?(File.expand_path('../../../.gemfiles', __FILE__)).should == false
          @gemspec.files.is_a?(Array).should == true
          @gemspec.files.include?('VERSION').should == true
        end
        it "should return 'executables' from 'git ls-files"  do
          File.exists?(File.expand_path('../../../.gemfiles', __FILE__)).should == false
          @gemspec.executables.is_a?(Array).should == true
        end
      end

      describe 'without git binary' do

        before(:each) do
          stub!(:system).and_return false
          @gemspec = load_gemspec
        end

        it "should return 'files' from cache" do
          system('git --version').should == false
          @gemspec.files.is_a?(Array).should == true
          @gemspec.files.include?('VERSION').should == true
        end
        it "should return 'executables' from cache"  do
          system('git --version').should == false
          @gemspec.executables.is_a?(Array).should == true
        end

      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
repo_manager-0.7.3 spec/basic_gem/gemspec_spec.rb
repo_manager-0.7.2 spec/basic_gem/gemspec_spec.rb
repo_manager-0.7.1 spec/basic_gem/gemspec_spec.rb