diff options
| -rw-r--r-- | spec/bundler/commands/lock_spec.rb | 4 | ||||
| -rw-r--r-- | spec/bundler/support/helpers.rb | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index cbf5394588..76ea4178ae 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -1,10 +1,6 @@ # frozen_string_literal: true RSpec.describe "bundle lock" do - def read_lockfile(file = "Gemfile.lock") - bundled_app(file).read - end - let(:repo) { gem_repo1 } before :each do diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index 7b8c56b6ad..73621685ba 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -244,7 +244,7 @@ module Spec contents = args.pop if contents.nil? - File.open(bundled_app_gemfile, "r", &:read) + read_gemfile else create_file(args.pop || "Gemfile", contents) end @@ -254,12 +254,24 @@ module Spec contents = args.pop if contents.nil? - File.open(bundled_app_lock, "r", &:read) + read_lockfile else create_file(args.pop || "Gemfile.lock", contents) end end + def read_gemfile(file = "Gemfile") + read_bundled_app_file(file) + end + + def read_lockfile(file = "Gemfile.lock") + read_bundled_app_file(file) + end + + def read_bundled_app_file(file) + bundled_app(file).read + end + def strip_whitespace(str) # Trim the leading spaces spaces = str[/\A\s+/, 0] || "" |
