Sha256: 0b366b6972a7ad710fd11aeed2b0a726e4e217211d647050d69ea070f8ae2b02

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require_relative '../../tasks/gemfile_util'

class GemfileSuper
  def gem(*args)
    :superclass
  end
end

class GemfileUtilUser < GemfileSuper
  include GemfileUtil
end

describe GemfileUtil do
  let (:gem_name) { "uncle_bobs_json_parser" }
  let (:gemfile_util) { GemfileUtilUser.new }

  context "#gem", :skip do
    it "calls the superclass method by default" do
      expect(gemfile_util).to receive(:gem).and_return(:superclass)
      gemfile_util.gem(gem_name)
    end

    # :path and :override follow the same code path, but for clarity get unrefactored specs.
    it "overrides gems with :path" do
      expect(gemfile_util).to receive(:warn_if_replacing)
      expect(gemfile_util.gem(gem_name, path: true)).to be_nil
      expect(gemfile_util.overridden_gems).to eq({ gem_name => [{ path: true }] })
    end

    it "overrides gems with :override" do
      expect(gemfile_util).to receive(:warn_if_replacing)
      expect(gemfile_util.gem(gem_name, override: true)).to be_nil
      expect(gemfile_util.overridden_gems).to eq({ gem_name => [{ }] })
    end

    it "does not override gems with :overrideable" do
      expect(gemfile_util.gem(gem_name, override: true)).to be_nil
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
chef-dk-1.2.22 spec/unit/gemfile_util_spec.rb
chef-dk-1.2.20 spec/unit/gemfile_util_spec.rb
chef-dk-1.1.16 spec/unit/gemfile_util_spec.rb
chef-dk-1.0.3 spec/unit/gemfile_util_spec.rb
chef-dk-0.19.6 spec/unit/gemfile_util_spec.rb
chef-dk-0.18.30 spec/unit/gemfile_util_spec.rb
chef-dk-0.18.26 spec/unit/gemfile_util_spec.rb
chef-dk-0.17.17 spec/unit/gemfile_util_spec.rb
chef-dk-0.16.28 spec/unit/gemfile_util_spec.rb
chef-dk-0.15.16 spec/unit/gemfile_util_spec.rb
chef-dk-0.15.15 spec/unit/gemfile_util_spec.rb
chef-dk-0.15.9 spec/unit/gemfile_util_spec.rb