Sha256: 749190ead095fa4fe550f929c4942144e7cf519281680aa2779afc7c15691f31

Contents?: true

Size: 1.55 KB

Versions: 6

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

describe 'Gemspec' do
  before do
    build_appraisal_file
    build_rakefile
  end

  it 'supports gemspec syntax with default options' do
    build_gemspec

    write_file 'Gemfile', <<-Gemfile
      gem 'appraisal', path: #{PROJECT_ROOT.inspect}

      gemspec
    Gemfile

    run 'bundle install --local'
    run 'appraisal install'
    output = run 'appraisal rake version'

    expect(output).to include 'Loaded 1.1.0'
  end

  it 'supports gemspec syntax with path option' do
    build_gemspec 'specdir'

    write_file 'Gemfile', <<-Gemfile
      gem 'appraisal', path: #{PROJECT_ROOT.inspect}

      gemspec path: './specdir'
    Gemfile

    run 'bundle install --local'
    run 'appraisal install'
    output = run 'appraisal rake version'

    expect(output).to include 'Loaded 1.1.0'
  end

  def build_appraisal_file
    super <<-Appraisals
      appraise 'stock' do
        gem 'rake'
      end
    Appraisals
  end

  def build_rakefile
    write_file 'Rakefile', <<-rakefile
      require 'rubygems'
      require 'bundler/setup'
      require 'appraisal'

      task :version do
        require 'dummy'
        puts "Loaded \#{$dummy_version}"
      end
    rakefile
  end

  def build_gemspec(path = '.')
    Dir.mkdir("tmp/stage/#{path}") rescue nil

    write_file File.join(path, 'gemspec_project.gemspec'), <<-gemspec
      Gem::Specification.new do |s|
        s.name = 'gemspec_project'
        s.version = '0.1'
        s.summary = 'Awesome Gem!'

        s.add_development_dependency('dummy', '1.1.0')
      end
    gemspec
  end
end

Version data entries

6 entries across 4 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/appraisal-1.0.2/spec/acceptance/gemspec_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/appraisal-1.0.2/spec/acceptance/gemspec_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/appraisal-1.0.2/spec/acceptance/gemspec_spec.rb
appraisal-1.0.3 spec/acceptance/gemspec_spec.rb
appraisal-1.0.2 spec/acceptance/gemspec_spec.rb
appraisal-1.0.0 spec/acceptance/gemspec_spec.rb