Skip to content

Commit bb22ccd

Browse files
committed
create a separate matcher to avoid failures
1 parent babf887 commit bb22ccd

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

bundler/spec/plugins/install_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def exec(command, args)
251251
expect(out).to include("Bundle complete!")
252252

253253
expect(the_bundle).to include_gems("rack 1.0.0")
254-
plugin_should_be_installed("foo", version: "1.4.0")
254+
plugin_should_be_installed_with_version("foo", "1.4.0")
255255

256256
gemfile <<-G
257257
source '#{file_uri_for(gem_repo2)}'
@@ -265,7 +265,7 @@ def exec(command, args)
265265
expect(out).to include("Bundle complete!")
266266

267267
expect(the_bundle).to include_gems("rack 1.0.0")
268-
plugin_should_be_installed("foo", version: "1.5.0")
268+
plugin_should_be_installed_with_version("foo", "1.5.0")
269269
end
270270

271271
it "downgrade plugins version listed in gemfile" do
@@ -287,7 +287,7 @@ def exec(command, args)
287287
expect(out).to include("Bundle complete!")
288288

289289
expect(the_bundle).to include_gems("rack 1.0.0")
290-
plugin_should_be_installed("foo", version: "1.5.0")
290+
plugin_should_be_installed_with_version("foo", "1.5.0")
291291

292292
gemfile <<-G
293293
source '#{file_uri_for(gem_repo2)}'
@@ -301,7 +301,7 @@ def exec(command, args)
301301
expect(out).to include("Bundle complete!")
302302

303303
expect(the_bundle).to include_gems("rack 1.0.0")
304-
plugin_should_be_installed("foo", version: "1.4.0")
304+
plugin_should_be_installed_with_version("foo", "1.4.0")
305305
end
306306

307307
it "install only plugins not installed yet listed in gemfile" do

bundler/spec/support/matchers.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,22 @@ def indent(string, padding = 4, indent_character = " ")
220220
RSpec::Matchers.define_negated_matcher :not_include_gems, :include_gems
221221
RSpec::Matchers.alias_matcher :include_gem, :include_gems
222222

223-
def plugin_should_be_installed(*names, version: nil)
223+
def plugin_should_be_installed(*names)
224224
names.each do |name|
225225
expect(Bundler::Plugin).to be_installed(name)
226226
path = Pathname.new(Bundler::Plugin.installed?(name))
227-
228-
expect(File.basename(path)).to eq("#{name}-#{version}") unless version.nil?
229227
expect(path + "plugins.rb").to exist
230228
end
231229
end
232230

231+
def plugin_should_be_installed_with_version(name, version)
232+
expect(Bundler::Plugin).to be_installed(name)
233+
path = Pathname.new(Bundler::Plugin.installed?(name))
234+
235+
expect(File.basename(path)).to eq("#{name}-#{version}")
236+
expect(path + "plugins.rb").to exist
237+
end
238+
233239
def plugin_should_not_be_installed(*names)
234240
names.each do |name|
235241
expect(Bundler::Plugin).not_to be_installed(name)

0 commit comments

Comments
 (0)