lib/bundler/fixture.rb in bundler-fixture-1.3.2 vs lib/bundler/fixture.rb in bundler-fixture-1.4.0

- old
+ new

@@ -3,12 +3,13 @@ require 'tmpdir' class BundlerFixture attr_reader :dir - def initialize(dir: File.join(Dir.tmpdir, 'fake_project_root')) + def initialize(dir: File.join(Dir.tmpdir, 'fake_project_root'), gemfile: 'Gemfile') @dir = dir + @gemfile = gemfile FileUtils.makedirs @dir @sources = Bundler::SourceList.new @sources.add_rubygems_remote('https://rubygems.org') end @@ -24,11 +25,13 @@ # @param [Array boolean] update_gems An array of gem names to update to latest, or `true` to update all. # Default is empty Array. def create_lockfile(gem_dependencies:, source_specs: [], ensure_sources: true, - update_gems: []) + update_gems: [], + gemfile: nil) + @gemfile = gemfile if gemfile defn = create_definition(gem_dependencies: gem_dependencies, source_specs: source_specs, ensure_sources: ensure_sources, update_gems: update_gems) defn.lock(lockfile_filename) @@ -54,10 +57,10 @@ source.instance_variable_set('@specs', index) defn end def lockfile_filename - File.join(@dir, 'Gemfile.lock') + File.join(@dir, "#{@gemfile}.lock") end def lockfile_contents File.read(lockfile_filename) end