Sha256: 961228878bdc64adc0169ea6a0b597aa7dd9cdd46553c4e6eefc7a5e73a85abc

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'ostruct'
describe Pumper::Project do
  let(:options) {
    {
      project: File.expand_path('../../../fixtures', __FILE__),
      is_absolute_path: true
    }
  }
  let(:project_gemfile) { described_class.new(options) }

  before do
    File.open(project_gemfile.send(:gemfile_path), 'w') { |f| f.write("gem 'simple_gem'") }
  end

  describe 'bump_version!' do
    subject { File.read("#{ options[:project] }/Gemfile") }

    let(:specification) do
      OpenStruct.new(
        name: 'simple_gem',
        for_gemfile: "gem 'simple_gem', '~> 1.1.0'"
      )
    end
    let(:bump_version) { project_gemfile.bump_version!(specification) }

    it { should_not be_include(specification.for_gemfile) }

    context 'when everything is good :)' do
      before { bump_version }

      it { should be_include(specification.for_gemfile) }
    end

    context 'when Gemfile have not bumped gem' do
      before do
        File.open(project_gemfile.send(:gemfile_path), 'w') { |f| f.write('') }
      end

      it { expect { bump_version }.to raise_error(Pumper::Project::UndefinedGem)  }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pumper-1.3.0 spec/lib/pumper/project_spec.rb
pumper-1.2.0 spec/lib/pumper/project_spec.rb