diff options
Diffstat (limited to 'spec/bundler/support/matchers.rb')
-rw-r--r-- | spec/bundler/support/matchers.rb | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb index 1613662981..0f027dcf04 100644 --- a/spec/bundler/support/matchers.rb +++ b/spec/bundler/support/matchers.rb @@ -118,14 +118,14 @@ module Spec opts[:raise_on_error] = false @errors = names.map do |full_name| name, version, platform = full_name.split(/\s+/) - require_path = name == "bundler" ? "#{lib_dir}/bundler" : name.tr("-", "/") + require_path = name.tr("-", "/") version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name) source_const = "#{Spec::Builders.constantize(name)}_SOURCE" ruby <<~R, opts - require '#{lib_dir}/bundler' + require 'bundler' Bundler.setup(#{groups}) - require '#{require_path}.rb' + require '#{require_path}' actual_version, actual_platform = #{version_const}.split(/\s+/, 2) unless Gem::Version.new(actual_version) == Gem::Version.new('#{version}') puts actual_version @@ -150,13 +150,13 @@ module Spec end if exitstatus == 65 actual_platform = out.split("\n").last - next "#{name} was expected to be of platform #{platform} but was #{actual_platform}" + next "#{name} was expected to be of platform #{platform || "ruby"} but was #{actual_platform || "ruby"}" end if exitstatus == 66 actual_source = out.split("\n").last next "Expected #{name} (#{version}) to be installed from `#{source}`, was actually from `#{actual_source}`" end - next "Command to check forgem inclusion of gem #{full_name} failed" + next "Command to check for inclusion of gem #{full_name} failed" end.compact @errors.empty? @@ -170,7 +170,7 @@ module Spec name, version = name.split(/\s+/, 2) ruby <<-R, opts begin - require '#{lib_dir}/bundler' + require 'bundler' Bundler.setup(#{groups}) rescue Bundler::GemNotFound, Bundler::GitError exit 0 @@ -178,7 +178,7 @@ module Spec begin require '#{name}' - name_constant = '#{Spec::Builders.constantize(name)}' + name_constant = #{Spec::Builders.constantize(name)} if #{version.nil?} || name_constant == '#{version}' exit 64 else @@ -208,10 +208,6 @@ module Spec RSpec::Matchers.define_negated_matcher :not_include_gems, :include_gems RSpec::Matchers.alias_matcher :include_gem, :include_gems - def have_lockfile(expected) - read_as(strip_whitespace(expected)) - end - def plugin_should_be_installed(*names) names.each do |name| expect(Bundler::Plugin).to be_installed(name) @@ -225,13 +221,5 @@ module Spec expect(Bundler::Plugin).not_to be_installed(name) end end - - def lockfile_should_be(expected) - expect(bundled_app_lock).to have_lockfile(expected) - end - - def gemfile_should_be(expected) - expect(bundled_app_gemfile).to read_as(strip_whitespace(expected)) - end end end |