diff options
53 files changed, 519 insertions, 443 deletions
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index e0490248..135d4a21 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -35,7 +35,7 @@ describe "bundle executable" do bundle :install, :env => { "BUNDLE_GEMFILE" => "" } - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index a1bb8751..ad175fe2 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -24,14 +24,14 @@ describe "bundle cache" do gem "omg" G - should_be_installed "omg 1.0.0" + expect(the_bundle).to have_installed "omg 1.0.0" end it "uses the cache as a source when installing gems with --local" do system_gems [] bundle "install --local" - should_be_installed("rack 1.0.0") + expect(the_bundle).to have_installed("rack 1.0.0") end it "does not reinstall gems from the cache if they exist on the system" do @@ -43,7 +43,7 @@ describe "bundle cache" do gem "rack" G - should_be_installed("rack 1.0.0") + expect(the_bundle).to have_installed("rack 1.0.0") end it "does not reinstall gems from the cache if they exist in the bundle" do @@ -58,7 +58,7 @@ describe "bundle cache" do end bundle "install --local" - should_be_installed("rack 1.0.0") + expect(the_bundle).to have_installed("rack 1.0.0") end it "creates a lockfile" do @@ -89,7 +89,7 @@ describe "bundle cache" do it "uses builtin gems" do install_gemfile %(gem 'builtin_gem', '1.0.2') - should_be_installed("builtin_gem 1.0.2") + expect(the_bundle).to have_installed("builtin_gem 1.0.2") end it "caches remote and builtin gems" do @@ -115,7 +115,7 @@ describe "bundle cache" do G bundle "install --local" - should_be_installed("builtin_gem_2 1.0.2") + expect(the_bundle).to have_installed("builtin_gem_2 1.0.2") end it "errors if the builtin gem isn't available to cache" do @@ -149,7 +149,7 @@ describe "bundle cache" do system_gems [] bundle "install --local" - should_be_installed("rack 1.0.0", "foo 1.0") + expect(the_bundle).to have_installed("rack 1.0.0", "foo 1.0") end it "should not explode if the lockfile is not present" do @@ -286,7 +286,7 @@ describe "bundle cache" do gem "foo-bundler" G - should_be_installed "foo-bundler 1.0" + expect(the_bundle).to have_installed "foo-bundler 1.0" end end end diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index df77e39c..89d4b5c7 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -29,7 +29,7 @@ end expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file FileUtils.rm_rf lib_path("foo-1.0") - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "copies repository to vendor cache and uses it even when installed with bundle --path" do @@ -47,7 +47,7 @@ end expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist FileUtils.rm_rf lib_path("foo-1.0") - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "runs twice without exploding" do @@ -62,7 +62,7 @@ end expect(err).to lack_errors FileUtils.rm_rf lib_path("foo-1.0") - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "tracks updates" do @@ -139,7 +139,7 @@ end expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}")).to exist expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0")).to exist - should_be_installed "has_submodule 1.0" + expect(the_bundle).to have_installed "has_submodule 1.0" end it "displays warning message when detecting git repo in Gemfile" do diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb index b8176810..72b12948 100644 --- a/spec/cache/path_spec.rb +++ b/spec/cache/path_spec.rb @@ -12,7 +12,7 @@ require "spec_helper" bundle "#{cmd} --all" expect(bundled_app("vendor/cache/foo-1.0")).not_to exist - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "copies when the path is outside the bundle " do @@ -27,7 +27,7 @@ require "spec_helper" expect(bundled_app("vendor/cache/foo-1.0/.bundlecache")).to be_file FileUtils.rm_rf lib_path("foo-1.0") - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "copies when the path is outside the bundle and the paths intersect" do @@ -45,7 +45,7 @@ require "spec_helper" expect(bundled_app("vendor/cache/#{libname}/.bundlecache")).to be_file FileUtils.rm_rf libpath - should_be_installed "#{libname} 1.0" + expect(the_bundle).to have_installed "#{libname} 1.0" end it "updates the path on each cache" do diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index e739f942..1f8a3bd5 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -244,7 +244,7 @@ describe "bundle binstubs <gem>" do bundle "config auto_install 1" bundle "binstubs rack" expect(out).to include("Installing rack 1.0.0") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "does nothing when already up to date" do diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb index ad88af62..375c5727 100644 --- a/spec/commands/config_spec.rb +++ b/spec/commands/config_spec.rb @@ -16,7 +16,7 @@ describe ".bundle/config" do expect(bundled_app(".bundle")).not_to exist expect(tmp("foo/bar/config")).to exist - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "can provide a relative path with the environment variable" do @@ -28,7 +28,7 @@ describe ".bundle/config" do expect(bundled_app(".bundle")).not_to exist expect(bundled_app("../foo/config")).to exist - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "removes environment.rb from BUNDLE_APP_CONFIG's path" do @@ -36,7 +36,7 @@ describe ".bundle/config" do ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s bundle "install" FileUtils.touch tmp("foo/bar/environment.rb") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" expect(tmp("foo/bar/environment.rb")).not_to exist end end diff --git a/spec/commands/console_spec.rb b/spec/commands/console_spec.rb index b60ac2c9..a727b43e 100644 --- a/spec/commands/console_spec.rb +++ b/spec/commands/console_spec.rb @@ -102,6 +102,6 @@ describe "bundle console" do end expect(out).to include("Installing foo 1.0") expect(out).to include("hello") - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end end diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 5e16eea8..df3e08fd 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -151,7 +151,7 @@ describe "bundle exec" do bundle "exec rackup" expect(out).to eq("0.9.1") - should_not_be_installed "rack_middleware 1.0" + expect(the_bundle).not_to have_installed "rack_middleware 1.0" end it "does not duplicate already exec'ed RUBYOPT" do @@ -320,7 +320,7 @@ describe "bundle exec" do end it "works when locked" do - should_be_locked + expect(the_bundle).to be_locked bundle "exec 'cd #{tmp("gems")} && rackup'" expect(out).to include("1.0.0") end @@ -343,7 +343,7 @@ describe "bundle exec" do end it "works when locked" do - should_be_locked + expect(the_bundle).to be_locked bundle "exec fizz" expect(out).to eq("1.0") @@ -367,7 +367,7 @@ describe "bundle exec" do end it "works when locked" do - should_be_locked + expect(the_bundle).to be_locked bundle "exec fizz_git" expect(out).to eq("1.0") end @@ -390,7 +390,7 @@ describe "bundle exec" do end it "works when locked" do - should_be_locked + expect(the_bundle).to be_locked bundle "exec fizz_no_gemspec" expect(out).to eq("1.0") end diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb index 89a9138d..8f096897 100644 --- a/spec/commands/install_spec.rb +++ b/spec/commands/install_spec.rb @@ -83,7 +83,7 @@ describe "bundle install with gem sources" do G expect(default_bundle_path("gems/rack-1.0.0")).to exist - should_be_installed("rack 1.0.0") + expect(the_bundle).to have_installed("rack 1.0.0") end it "fetches gems when multiple versions are specified" do @@ -93,7 +93,7 @@ describe "bundle install with gem sources" do G expect(default_bundle_path("gems/rack-0.9.1")).to exist - should_be_installed("rack 0.9.1") + expect(the_bundle).to have_installed("rack 0.9.1") end it "fetches gems when multiple versions are specified take 2" do @@ -103,7 +103,7 @@ describe "bundle install with gem sources" do G expect(default_bundle_path("gems/rack-0.9.1")).to exist - should_be_installed("rack 0.9.1") + expect(the_bundle).to have_installed("rack 0.9.1") end it "raises an appropriate error when gems are specified using symbols" do @@ -120,7 +120,7 @@ describe "bundle install with gem sources" do gem "rails" G - should_be_installed "actionpack 2.3.2", "rails 2.3.2" + expect(the_bundle).to have_installed "actionpack 2.3.2", "rails 2.3.2" end it "does the right version" do @@ -129,7 +129,7 @@ describe "bundle install with gem sources" do gem "rack", "0.9.1" G - should_be_installed "rack 0.9.1" + expect(the_bundle).to have_installed "rack 0.9.1" end it "does not install the development dependency" do @@ -138,8 +138,8 @@ describe "bundle install with gem sources" do gem "with_development_dependency" G - should_be_installed "with_development_dependency 1.0.0" - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed("with_development_dependency 1.0.0"). + and not_have_installed("activesupport 2.3.5") end it "resolves correctly" do @@ -149,7 +149,7 @@ describe "bundle install with gem sources" do gem "rails" G - should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2" + expect(the_bundle).to have_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2" end it "activates gem correctly according to the resolved gems" do @@ -164,7 +164,7 @@ describe "bundle install with gem sources" do gem "rails" G - should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2" + expect(the_bundle).to have_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2" end it "does not reinstall any gem that is already available locally" do @@ -181,7 +181,7 @@ describe "bundle install with gem sources" do gem "activerecord", "2.3.2" G - should_be_installed "activesupport 2.3.2" + expect(the_bundle).to have_installed "activesupport 2.3.2" end it "works when the gemfile specifies gems that only exist in the system" do @@ -192,7 +192,7 @@ describe "bundle install with gem sources" do gem "foo" G - should_be_installed "rack 1.0.0", "foo 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0", "foo 1.0.0" end it "prioritizes local gems over remote gems" do @@ -205,7 +205,7 @@ describe "bundle install with gem sources" do gem "rack" G - should_be_installed "rack 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to have_installed "rack 1.0.0", "activesupport 2.3.5" end describe "with a gem that installs multiple platforms" do @@ -264,21 +264,21 @@ describe "bundle install with gem sources" do it "works" do bundle "install --path vendor" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "allows running bundle install --system without deleting foo" do bundle "install --path vendor" bundle "install --system" FileUtils.rm_rf(bundled_app("vendor")) - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "allows running bundle install --system after deleting foo" do bundle "install --path vendor" FileUtils.rm_rf(bundled_app("vendor")) bundle "install --system" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end @@ -294,7 +294,7 @@ describe "bundle install with gem sources" do gem "rack", "1.2" G - should_be_installed "rack 1.2", "activesupport 1.2.3" + expect(the_bundle).to have_installed "rack 1.2", "activesupport 1.2.3" end it "gives a useful error if no sources are set" do diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb index 83b56f30..4dfe47ab 100644 --- a/spec/commands/package_spec.rb +++ b/spec/commands/package_spec.rb @@ -12,7 +12,7 @@ describe "bundle package" do bundle "package --gemfile=NotGemfile" ENV["BUNDLE_GEMFILE"] = "NotGemfile" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -151,7 +151,7 @@ describe "bundle package" do bundle "package --path=#{bundled_app("test")}" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" expect(bundled_app("test/vendor/cache/")).to exist end end @@ -165,7 +165,7 @@ describe "bundle package" do bundle "package --no-install" - should_not_be_installed "rack 1.0.0", :expect_err => true + expect(the_bundle).not_to have_installed "rack 1.0.0", :expect_err => true expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end @@ -178,7 +178,7 @@ describe "bundle package" do bundle "package --no-install" bundle "install" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -236,7 +236,7 @@ describe "bundle install with gem sources" do FileUtils.rm_rf gem_repo2 bundle "install --local" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "does not hit the remote at all" do @@ -251,7 +251,7 @@ describe "bundle install with gem sources" do FileUtils.rm_rf gem_repo2 bundle "install --deployment" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "does not reinstall already-installed gems" do @@ -267,7 +267,7 @@ describe "bundle install with gem sources" do bundle :install expect(err).to lack_errors - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "ignores cached gems for the wrong platform" do diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index b4f9c90c..163c64fb 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -80,7 +80,7 @@ describe "bundle show" do install_gemfile <<-G gem "foo", :git => "#{lib_path("foo-1.0")}" G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" bundle :show expect(out).to include("foo (1.0 #{@git.ref_for("master", 6)}") @@ -95,7 +95,7 @@ describe "bundle show" do install_gemfile <<-G gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg" G - should_be_installed "foo 1.0.omg" + expect(the_bundle).to have_installed "foo 1.0.omg" bundle :show expect(out).to include("foo (1.0 #{@git.ref_for("omg", 6)}") @@ -116,7 +116,7 @@ describe "bundle show" do install_gemfile <<-G gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}" G - should_be_installed "foo 1.0.0.pre.beta.1" + expect(the_bundle).to have_installed "foo 1.0.0.pre.beta.1" bundle! :show expect(out).to include("foo (1.0.0.pre.beta.1") diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index d86db69e..24a3148b 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -20,7 +20,7 @@ describe "bundle update" do bundle "update" expect(out).to include("Bundle updated!") - should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0" + expect(the_bundle).to have_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end it "doesn't delete the Gemfile.lock file if something goes wrong" do @@ -49,7 +49,7 @@ describe "bundle update" do end bundle "update rack-obama" - should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 2.3.5" + expect(the_bundle).to have_installed "rack 1.2", "rack-obama 1.0", "activesupport 2.3.5" end end @@ -68,7 +68,7 @@ describe "bundle update" do it "should update the child dependency" do update_repo2 bundle "update rack" - should_be_installed "rack 1.2" + expect(the_bundle).to have_installed "rack 1.2" end end @@ -92,8 +92,8 @@ describe "bundle update" do build_gem "activesupport", "3.0" end bundle "update --group development" - should_be_installed "activesupport 3.0" - should_not_be_installed "rack 1.2" + expect(the_bundle).to have_installed "activesupport 3.0" + expect(the_bundle).not_to have_installed "rack 1.2" end context "when there is a source with the same name as a gem in a group" do @@ -111,8 +111,8 @@ describe "bundle update" do update_git "foo", "2.0", :path => lib_path("activesupport") bundle "update --group development" - should_be_installed "activesupport 3.0" - should_not_be_installed "foo 2.0" + expect(the_bundle).to have_installed "activesupport 3.0" + expect(the_bundle).not_to have_installed "foo 2.0" end end end @@ -138,7 +138,7 @@ describe "bundle update" do update_repo2 { build_gem "activesupport", "3.0" } bundle "update --source activesupport" - should_not_be_installed "activesupport 3.0" + expect(the_bundle).not_to have_installed "activesupport 3.0" end it "should update gems not included in the source that happen to have the same name" do @@ -149,7 +149,7 @@ describe "bundle update" do update_repo2 { build_gem "activesupport", "3.0" } bundle "update --source activesupport" - should_be_installed "activesupport 3.0" + expect(the_bundle).to have_installed "activesupport 3.0" end end @@ -178,8 +178,8 @@ describe "bundle update" do end bundle "update --source harry" - should_be_installed "harry 2.0" - should_be_installed "fred 1.0" + expect(the_bundle).to have_installed "harry 2.0" + expect(the_bundle).to have_installed "fred 1.0" end end @@ -211,9 +211,9 @@ describe "bundle update" do end bundle "update --source harry" - should_be_installed "harry 2.0" - should_be_installed "fred 1.0" - should_be_installed "george 1.0" + expect(the_bundle).to have_installed "harry 2.0" + expect(the_bundle).to have_installed "fred 1.0" + expect(the_bundle).to have_installed "george 1.0" end end end @@ -238,7 +238,7 @@ describe "bundle update in more complicated situations" do end bundle "update thin" - should_be_installed "thin 2.0", "rack 1.2", "rack-obama 1.0" + expect(the_bundle).to have_installed "thin 2.0", "rack 1.2", "rack-obama 1.0" end it "will update only from pinned source" do @@ -255,7 +255,7 @@ describe "bundle update in more complicated situations" do end bundle "update" - should_be_installed "thin 1.0" + expect(the_bundle).to have_installed "thin 1.0" end end @@ -271,7 +271,7 @@ describe "bundle update without a Gemfile.lock" do bundle "update" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -481,13 +481,13 @@ describe "bundle update conservative" do it "single gem updates dependent gem to minor" do bundle "update --patch foo" - should_be_installed "foo 1.4.5", "bar 2.1.1", "qux 1.0.0" + expect(the_bundle).to have_installed "foo 1.4.5", "bar 2.1.1", "qux 1.0.0" end it "update all" do bundle "update --patch" - should_be_installed "foo 1.4.5", "bar 2.1.1", "qux 1.0.1" + expect(the_bundle).to have_installed "foo 1.4.5", "bar 2.1.1", "qux 1.0.1" end it "warns on minor or major increment elsewhere" ## include in prior test @@ -497,7 +497,7 @@ describe "bundle update conservative" do it "single gem updates dependent gem to major" do bundle "update --minor foo" - should_be_installed "foo 1.5.1", "bar 3.0.0", "qux 1.0.0" + expect(the_bundle).to have_installed "foo 1.5.1", "bar 3.0.0", "qux 1.0.0" end it "warns on major increment elsewhere" ## include in prior test @@ -509,13 +509,13 @@ describe "bundle update conservative" do it "patch preferred" do bundle "update --patch foo bar --strict" - should_be_installed "foo 1.4.4", "bar 2.0.5", "qux 1.0.0" + expect(the_bundle).to have_installed "foo 1.4.4", "bar 2.0.5", "qux 1.0.0" end it "minor preferred" do bundle "update --minor --strict" - should_be_installed "foo 1.5.0", "bar 2.1.1", "qux 1.1.0" + expect(the_bundle).to have_installed "foo 1.5.0", "bar 2.1.1", "qux 1.1.0" end end diff --git a/spec/install/binstubs_spec.rb b/spec/install/binstubs_spec.rb index fed43693..814732fd 100644 --- a/spec/install/binstubs_spec.rb +++ b/spec/install/binstubs_spec.rb @@ -16,7 +16,7 @@ describe "bundle install" do config "BUNDLE_SYSTEM_BINDIR" => system_gem_path("altbin").to_s bundle :install - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" expect(system_gem_path("altbin/rackup")).to exist end end diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb index 901c68d2..688f855d 100644 --- a/spec/install/bundler_spec.rb +++ b/spec/install/bundler_spec.rb @@ -19,7 +19,7 @@ describe "bundle install" do gem "rails", "3.0" G - should_be_installed "bundler #{Bundler::VERSION}" + expect(the_bundle).to have_installed "bundler #{Bundler::VERSION}" end it "are not added if not already present" do @@ -27,7 +27,7 @@ describe "bundle install" do source "file://#{gem_repo1}" gem "rack" G - should_not_be_installed "bundler #{Bundler::VERSION}" + expect(the_bundle).not_to have_installed "bundler #{Bundler::VERSION}" end it "causes a conflict if explicitly requesting a different version" do @@ -71,7 +71,7 @@ describe "bundle install" do gem "rack" G - should_be_installed "multiple_versioned_deps 1.0.0" + expect(the_bundle).to have_installed "multiple_versioned_deps 1.0.0" end it "includes bundler in the bundle when it's a child dependency" do diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index 2156ad87..8bcd65a4 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -38,7 +38,7 @@ describe "install with --deployment or --frozen" do bundle "install --deployment" bundle :install expect(exitstatus).to eq(0) if exitstatus - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "still works if you are not in the app directory and specify --gemfile" do @@ -47,7 +47,7 @@ describe "install with --deployment or --frozen" do simulate_new_machine bundle "install --gemfile #{tmp}/bundled_app/Gemfile --deployment" Dir.chdir bundled_app - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "works if you exclude a group with a git gem" do @@ -105,7 +105,7 @@ describe "install with --deployment or --frozen" do bundle "install --deployment" expect(exitstatus).to eq(0) if exitstatus - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end describe "with an existing lockfile" do @@ -260,7 +260,7 @@ describe "install with --deployment or --frozen" do gem "rack-obama" G - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -272,7 +272,7 @@ describe "install with --deployment or --frozen" do G bundle :install - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" bundle "package --all" expect(bundled_app("vendor/cache/foo")).to be_directory @@ -288,7 +288,7 @@ describe "install with --deployment or --frozen" do expect(out).not_to include("You have deleted from the Gemfile") expect(out).to include("Using foo 1.0 from source at") expect(out).to include("vendor/cache/foo") - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end end end diff --git a/spec/install/force_spec.rb b/spec/install/force_spec.rb index 9209392d..3d38dbee 100644 --- a/spec/install/force_spec.rb +++ b/spec/install/force_spec.rb @@ -21,7 +21,7 @@ describe "bundle install" do expect(out).to include "Using bundler" expect(out).to include "Installing rack 1.0.0" expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "works on first bundle install" do @@ -30,7 +30,7 @@ describe "bundle install" do expect(exitstatus).to eq(0) if exitstatus expect(out).to include "Using bundler" expect(out).to include "Installing rack 1.0.0" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end end diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb index 454dbcf8..21682775 100644 --- a/spec/install/gemfile/gemspec_spec.rb +++ b/spec/install/gemfile/gemspec_spec.rb @@ -18,8 +18,8 @@ describe "bundle install from an existing gemspec" do gemspec :path => '#{tmp.join("foo")}' G - should_be_installed "bar 1.0.0" - should_be_installed "bar-dev 1.0.0", :groups => :development + expect(the_bundle).to have_installed "bar 1.0.0" + expect(the_bundle).to have_installed "bar-dev 1.0.0", :groups => :development end it "that is hidden should install runtime and development dependencies" do @@ -35,8 +35,8 @@ describe "bundle install from an existing gemspec" do gemspec :path => '#{tmp.join("foo")}' G - should_be_installed "bar 1.0.0" - should_be_installed "bar-dev 1.0.0", :groups => :development + expect(the_bundle).to have_installed "bar 1.0.0" + expect(the_bundle).to have_installed "bar-dev 1.0.0", :groups => :development end it "should handle a list of requirements" do @@ -52,7 +52,7 @@ describe "bundle install from an existing gemspec" do gemspec :path => '#{tmp.join("foo")}' G - should_be_installed "baz 1.0" + expect(the_bundle).to have_installed "baz 1.0" end it "should raise if there are no gemspecs available" do @@ -89,8 +89,8 @@ describe "bundle install from an existing gemspec" do gemspec :path => '#{tmp.join("foo")}', :name => 'foo' G - should_be_installed "bar 1.0.0" - should_be_installed "bar-dev 1.0.0", :groups => :development + expect(the_bundle).to have_installed "bar 1.0.0" + expect(the_bundle).to have_installed "bar-dev 1.0.0", :groups => :development end it "should use a specific group for development dependencies" do @@ -105,9 +105,9 @@ describe "bundle install from an existing gemspec" do gemspec :path => '#{tmp.join("foo")}', :name => 'foo', :development_group => :dev G - should_be_installed "bar 1.0.0" - should_not_be_installed "bar-dev 1.0.0", :groups => :development - should_be_installed "bar-dev 1.0.0", :groups => :dev + expect(the_bundle).to have_installed "bar 1.0.0" + expect(the_bundle).not_to have_installed "bar-dev 1.0.0", :groups => :development + expect(the_bundle).to have_installed "bar-dev 1.0.0", :groups => :dev end it "should match a lockfile even if the gemspec defines development dependencies" do @@ -159,7 +159,7 @@ describe "bundle install from an existing gemspec" do gemspec :path => '#{tmp.join("foo")}', :name => 'foo' G - should_be_installed "foo 1.0.0" + expect(the_bundle).to have_installed "foo 1.0.0" end context "when child gemspecs conflict with a released gemspec" do @@ -182,7 +182,7 @@ describe "bundle install from an existing gemspec" do gemspec G - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end @@ -246,7 +246,7 @@ describe "bundle install from an existing gemspec" do simulate_platform "java" do results = bundle "install", :artifice => "endpoint" expect(results).to include("Installing rack 1.0.0") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end end @@ -260,7 +260,7 @@ describe "bundle install from an existing gemspec" do simulate_platform "java" do results = bundle "install", :artifice => "endpoint" expect(results).to include("Installing rack 1.0.0") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end end @@ -271,7 +271,7 @@ describe "bundle install from an existing gemspec" do simulate_windows do results = bundle "install", :artifice => "endpoint" expect(results).to include("Installing rack 1.0.0") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end end @@ -315,7 +315,7 @@ describe "bundle install from an existing gemspec" do context "as a runtime dependency" do it "keeps java dependencies in the lockfile" do - should_be_installed "foo 1.0", "platform_specific 1.0 RUBY" + expect(the_bundle).to have_installed "foo 1.0", "platform_specific 1.0 RUBY" expect(lockfile).to eq strip_whitespace(<<-L) PATH remote: . @@ -346,7 +346,7 @@ describe "bundle install from an existing gemspec" do let(:platform_specific_type) { :development } it "keeps java dependencies in the lockfile" do - should_be_installed "foo 1.0", "platform_specific 1.0 RUBY" + expect(the_bundle).to have_installed "foo 1.0", "platform_specific 1.0 RUBY" expect(lockfile).to eq strip_whitespace(<<-L) PATH remote: . @@ -378,7 +378,7 @@ describe "bundle install from an existing gemspec" do let(:dependency) { "indirect_platform_specific" } it "keeps java dependencies in the lockfile" do - should_be_installed "foo 1.0", "indirect_platform_specific 1.0", "platform_specific 1.0 RUBY" + expect(the_bundle).to have_installed "foo 1.0", "indirect_platform_specific 1.0", "platform_specific 1.0 RUBY" expect(lockfile).to eq strip_whitespace(<<-L) PATH remote: . diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index 577a13a1..176721c6 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -17,7 +17,7 @@ describe "bundle install with git sources" do end it "fetches gems" do - should_be_installed("foo 1.0") + expect(the_bundle).to have_installed("foo 1.0") run <<-RUBY require 'foo' @@ -126,7 +126,7 @@ describe "bundle install with git sources" do FileUtils.mv bundled_app, tmp("bundled_app.bck") Dir.chdir tmp("bundled_app.bck") - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "can still install after moving the application directory" do @@ -147,7 +147,7 @@ describe "bundle install with git sources" do bundle "update foo" - should_be_installed "foo 1.1", "rack 1.0" + expect(the_bundle).to have_installed "foo 1.1", "rack 1.0" end end @@ -166,7 +166,7 @@ describe "bundle install with git sources" do it "does not explode" do bundle "install" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end @@ -398,7 +398,7 @@ describe "bundle install with git sources" do gem "rack", :git => "#{lib_path("rack-0.8")}" G - should_be_installed "rack 0.8" + expect(the_bundle).to have_installed "rack 0.8" end it "installs dependencies from git even if a newer gem is available elsewhere" do @@ -434,7 +434,7 @@ describe "bundle install with git sources" do gem "rack", "1.0.0", :git => "#{lib_path("rack")}" G - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "correctly unlocks when changing to a git source without versions" do @@ -450,7 +450,7 @@ describe "bundle install with git sources" do gem "rack", :git => "#{lib_path("rack")}" G - should_be_installed "rack 1.2" + expect(the_bundle).to have_installed "rack 1.2" end end @@ -466,7 +466,7 @@ describe "bundle install with git sources" do end G - should_be_installed "omg 1.0", "hi2u 1.0" + expect(the_bundle).to have_installed "omg 1.0", "hi2u 1.0" end end @@ -498,8 +498,8 @@ describe "bundle install with git sources" do gem "rails", "2.3.2" G - should_be_installed "foo 1.0" - should_be_installed "rails 2.3.2" + expect(the_bundle).to have_installed "foo 1.0" + expect(the_bundle).to have_installed "rails 2.3.2" end it "runs the gemspec in the context of its parent directory" do @@ -528,8 +528,8 @@ describe "bundle install with git sources" do gem "rails", "2.3.2" G - should_be_installed "bar 1.0" - should_be_installed "rails 2.3.2" + expect(the_bundle).to have_installed "bar 1.0" + expect(the_bundle).to have_installed "rails 2.3.2" end it "installs from git even if a rubygems gem is present" do @@ -543,7 +543,7 @@ describe "bundle install with git sources" do gem "foo", "1.0", :git => "#{lib_path("foo-1.0")}" G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "fakes the gem out if there is no gemspec" do @@ -555,8 +555,8 @@ describe "bundle install with git sources" do gem "rails", "2.3.2" G - should_be_installed("foo 1.0") - should_be_installed("rails 2.3.2") + expect(the_bundle).to have_installed("foo 1.0") + expect(the_bundle).to have_installed("rails 2.3.2") end it "catches git errors and spits out useful output" do @@ -578,7 +578,7 @@ describe "bundle install with git sources" do gem "foo", :git => "#{lib_path("foo space-1.0")}" G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "handles repos that have been force-pushed" do @@ -589,21 +589,21 @@ describe "bundle install with git sources" do gem 'forced' end G - should_be_installed "forced 1.0" + expect(the_bundle).to have_installed "forced 1.0" update_git "forced" do |s| s.write "lib/forced.rb", "FORCED = '1.1'" end bundle "update" - should_be_installed "forced 1.1" + expect(the_bundle).to have_installed "forced 1.1" Dir.chdir(lib_path("forced-1.0")) do `git reset --hard HEAD^` end bundle "update" - should_be_installed "forced 1.0" + expect(the_bundle).to have_installed "forced 1.0" end it "ignores submodules if :submodule is not passed" do @@ -623,7 +623,7 @@ describe "bundle install with git sources" do G expect(out).to match(/could not find gem 'submodule/i) - should_not_be_installed "has_submodule 1.0", :expect_err => true + expect(the_bundle).not_to have_installed "has_submodule 1.0", :expect_err => true end it "handles repos with submodules" do @@ -642,7 +642,7 @@ describe "bundle install with git sources" do end G - should_be_installed "has_submodule 1.0" + expect(the_bundle).to have_installed "has_submodule 1.0" end it "handles implicit updates when modifying the source info" do @@ -747,7 +747,7 @@ describe "bundle install with git sources" do gem "bar", :git => "#{lib_path("bar")}" G - should_be_installed "foo 1.0", "bar 1.0" + expect(the_bundle).to have_installed "foo 1.0", "bar 1.0" end it "doesn't explode when switching Gem to Git source" do @@ -1097,7 +1097,7 @@ describe "bundle install with git sources" do G bundle :install - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end end end diff --git a/spec/install/gemfile/groups_spec.rb b/spec/install/gemfile/groups_spec.rb index 7d8768ec..c338cc5d 100644 --- a/spec/install/gemfile/groups_spec.rb +++ b/spec/install/gemfile/groups_spec.rb @@ -15,11 +15,11 @@ describe "bundle install with groups" do end it "installs gems in the default group" do - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "installs gems in a group block into that group" do - should_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "activesupport 2.3.5" load_error_run <<-R, "activesupport", :default require 'activesupport' @@ -30,7 +30,7 @@ describe "bundle install with groups" do end it "installs gems with inline :groups into those groups" do - should_be_installed "thin 1.0" + expect(the_bundle).to have_installed "thin 1.0" load_error_run <<-R, "thin", :default require 'thin' @@ -88,19 +88,19 @@ describe "bundle install with groups" do it "installs gems in the default group" do bundle :install, :without => "emo" - should_be_installed "rack 1.0.0", :groups => [:default] + expect(the_bundle).to have_installed "rack 1.0.0", :groups => [:default] end it "does not install gems from the excluded group" do bundle :install, :without => "emo" - should_not_be_installed "activesupport 2.3.5", :groups => [:default] + expect(the_bundle).not_to have_installed "activesupport 2.3.5", :groups => [:default] end it "does not install gems from the previously excluded group" do bundle :install, :without => "emo" - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).not_to have_installed "activesupport 2.3.5" bundle :install - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).not_to have_installed "activesupport 2.3.5" end it "does not say it installed gems from the excluded group" do @@ -124,7 +124,7 @@ describe "bundle install with groups" do G bundle :install, :without => "emo" - should_be_installed "activesupport 2.3.2", :groups => [:default] + expect(the_bundle).to have_installed "activesupport 2.3.2", :groups => [:default] end it "still works on a different machine and excludes gems" do @@ -133,8 +133,8 @@ describe "bundle install with groups" do simulate_new_machine bundle :install, :without => "emo" - should_be_installed "rack 1.0.0", :groups => [:default] - should_not_be_installed "activesupport 2.3.5", :groups => [:default] + expect(the_bundle).to have_installed "rack 1.0.0", :groups => [:default] + expect(the_bundle).not_to have_installed "activesupport 2.3.5", :groups => [:default] end it "still works when BUNDLE_WITHOUT is set" do @@ -143,8 +143,8 @@ describe "bundle install with groups" do bundle :install expect(out).not_to include("activesupport") - should_be_installed "rack 1.0.0", :groups => [:default] - should_not_be_installed "activesupport 2.3.5", :groups => [:default] + expect(the_bundle).to have_installed "rack 1.0.0", :groups => [:default] + expect(the_bundle).not_to have_installed "activesupport 2.3.5", :groups => [:default] ENV["BUNDLE_WITHOUT"] = nil end @@ -153,56 +153,56 @@ describe "bundle install with groups" do bundle :install, :without => "emo" bundle 'install --without ""' - should_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "activesupport 2.3.5" end it "doesn't clear without when nothing is passed" do bundle :install, :without => "emo" bundle :install - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).not_to have_installed "activesupport 2.3.5" end it "does not install gems from the optional group" do bundle :install - should_not_be_installed "thin 1.0" + expect(the_bundle).not_to have_installed "thin 1.0" end it "does install gems from the optional group when requested" do bundle :install, :with => "debugging" - should_be_installed "thin 1.0" + expect(the_bundle).to have_installed "thin 1.0" end it "does install gems from the previously requested group" do bundle :install, :with => "debugging" - should_be_installed "thin 1.0" + expect(the_bundle).to have_installed "thin 1.0" bundle :install - should_be_installed "thin 1.0" + expect(the_bundle).to have_installed "thin 1.0" end it "does install gems from the optional groups requested with BUNDLE_WITH" do ENV["BUNDLE_WITH"] = "debugging" bundle :install - should_be_installed "thin 1.0" + expect(the_bundle).to have_installed "thin 1.0" ENV["BUNDLE_WITH"] = nil end it "clears with when passed an empty list" do bundle :install, :with => "debugging" bundle 'install --with ""' - should_not_be_installed "thin 1.0" + expect(the_bundle).not_to have_installed "thin 1.0" end it "does remove groups from without when passed at with" do bundle :install, :without => "emo" bundle :install, :with => "emo" - should_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "activesupport 2.3.5" end it "does remove groups from with when passed at without" do bundle :install, :with => "debugging" bundle :install, :without => "debugging" - should_not_be_installed "thin 1.0" + expect(the_bundle).not_to have_installed "thin 1.0" end it "errors out when passing a group to with and without" do @@ -212,18 +212,18 @@ describe "bundle install with groups" do it "can add and remove a group at the same time" do bundle :install, :with => "debugging", :without => "emo" - should_be_installed "thin 1.0" - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "thin 1.0" + expect(the_bundle).not_to have_installed "activesupport 2.3.5" end it "does have no effect when listing a not optional group in with" do bundle :install, :with => "emo" - should_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "activesupport 2.3.5" end it "does have no effect when listing an optional group in without" do bundle :install, :without => "debugging" - should_not_be_installed "thin 1.0" + expect(the_bundle).not_to have_installed "thin 1.0" end end @@ -240,12 +240,12 @@ describe "bundle install with groups" do it "installs gems in the default group" do bundle :install, :without => "emo lolercoaster" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "installs the gem if any of its groups are installed" do bundle "install --without emo" - should_be_installed "rack 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to have_installed "rack 1.0.0", "activesupport 2.3.5" end describe "with a gem defined multiple times in different groups" do @@ -266,22 +266,22 @@ describe "bundle install with groups" do it "installs the gem w/ option --without emo" do bundle "install --without emo" - should_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "activesupport 2.3.5" end it "installs the gem w/ option --without lolercoaster" do bundle "install --without lolercoaster" - should_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "activesupport 2.3.5" end it "does not install the gem w/ option --without emo lolercoaster" do bundle "install --without emo lolercoaster" - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).not_to have_installed "activesupport 2.3.5" end it "does not install the gem w/ option --without 'emo lolercoaster'" do bundle "install --without 'emo lolercoaster'" - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).not_to have_installed "activesupport 2.3.5" end end end @@ -301,12 +301,12 @@ describe "bundle install with groups" do it "installs gems in the default group" do bundle :install, :without => "emo lolercoaster" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "installs the gem if any of its groups are installed" do bundle "install --without emo" - should_be_installed "rack 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to have_installed "rack 1.0.0", "activesupport 2.3.5" end end end @@ -352,14 +352,14 @@ describe "bundle install with groups" do end it "uses the correct versions even if --without was used on the original" do - should_be_installed "rack 0.9.1" - should_not_be_installed "rack_middleware 1.0" + expect(the_bundle).to have_installed "rack 0.9.1" + expect(the_bundle).not_to have_installed "rack_middleware 1.0" simulate_new_machine bundle :install - should_be_installed "rack 0.9.1" - should_be_installed "rack_middleware 1.0" + expect(the_bundle).to have_installed "rack 0.9.1" + expect(the_bundle).to have_installed "rack_middleware 1.0" end it "does not hit the remote a second time" do diff --git a/spec/install/gemfile/install_if.rb b/spec/install/gemfile/install_if.rb index 080a35b9..4140ad6f 100644 --- a/spec/install/gemfile/install_if.rb +++ b/spec/install/gemfile/install_if.rb @@ -15,9 +15,9 @@ describe "bundle install with install_if conditionals" do gem "rack" G - should_be_installed("rack 1.0", "activesupport 2.3.5") - should_not_be_installed("thin") - should_not_be_installed("foo") + expect(the_bundle).to have_installed("rack 1.0", "activesupport 2.3.5") + expect(the_bundle).not_to have_installed("thin") + expect(the_bundle).not_to have_installed("foo") lockfile_should_be <<-L GEM diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index d3910748..60b02491 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -10,7 +10,7 @@ describe "bundle install with explicit source paths" do gem 'foo' G - should_be_installed("foo 1.0") + expect(the_bundle).to have_installed("foo 1.0") end it "supports pinned paths" do @@ -20,7 +20,7 @@ describe "bundle install with explicit source paths" do gem 'foo', :path => "#{lib_path("foo-1.0")}" G - should_be_installed("foo 1.0") + expect(the_bundle).to have_installed("foo 1.0") end it "supports relative paths" do @@ -32,7 +32,7 @@ describe "bundle install with explicit source paths" do gem 'foo', :path => "#{relative_path}" G - should_be_installed("foo 1.0") + expect(the_bundle).to have_installed("foo 1.0") end it "expands paths" do @@ -44,7 +44,7 @@ describe "bundle install with explicit source paths" do gem 'foo', :path => "~/#{relative_path}" G - should_be_installed("foo 1.0") + expect(the_bundle).to have_installed("foo 1.0") end it "expands paths raise error with not existing user's home dir" do @@ -68,7 +68,7 @@ describe "bundle install with explicit source paths" do bundled_app("subdir").mkpath Dir.chdir(bundled_app("subdir")) do - should_be_installed("foo 1.0") + expect(the_bundle).to have_installed("foo 1.0") end end @@ -118,7 +118,7 @@ describe "bundle install with explicit source paths" do gem "omg", :path => "#{lib_path("omg")}" G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "prefers gemspecs closer to the path root" do @@ -139,7 +139,7 @@ describe "bundle install with explicit source paths" do # Installation of the 'gemfiles' gemspec would fail since it will be unable # to require 'premailer.rb' - should_be_installed "premailer 1.0.0" + expect(the_bundle).to have_installed "premailer 1.0.0" end it "warns on invalid specs", :rubygems => "1.7" do @@ -179,8 +179,8 @@ describe "bundle install with explicit source paths" do Dir.chdir(lib_path("foo")) do bundle "install" - should_be_installed "foo 1.0" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "foo 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end @@ -194,8 +194,8 @@ describe "bundle install with explicit source paths" do gemspec :path => "#{lib_path("foo")}" G - should_be_installed "foo 1.0" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "foo 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "doesn't automatically unlock dependencies when using the gemspec syntax" do @@ -214,8 +214,8 @@ describe "bundle install with explicit source paths" do bundle "install" - should_be_installed "foo 1.0" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "foo 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "doesn't automatically unlock dependencies when using the gemspec syntax and the gem has development dependencies" do @@ -235,8 +235,8 @@ describe "bundle install with explicit source paths" do bundle "install" - should_be_installed "foo 1.0" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "foo 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "raises if there are multiple gemspecs" do @@ -261,7 +261,7 @@ describe "bundle install with explicit source paths" do gemspec :path => "#{lib_path("foo")}", :name => "foo" G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "sets up executables" do @@ -273,7 +273,7 @@ describe "bundle install with explicit source paths" do path "#{lib_path("foo-1.0")}" gem 'foo' G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" bundle "exec foobar" expect(out).to eq("1.0") @@ -312,7 +312,7 @@ describe "bundle install with explicit source paths" do end G - should_be_installed "omg 1.0", "hi2u 1.0" + expect(the_bundle).to have_installed "omg 1.0", "hi2u 1.0" end end @@ -328,7 +328,7 @@ describe "bundle install with explicit source paths" do gem "omg", :path => "#{lib_path("omg")}" G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "works when the path does not have a gemspec" do @@ -338,9 +338,9 @@ describe "bundle install with explicit source paths" do gem "foo", "1.0", :path => "#{lib_path("foo-1.0")}" G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "works when the path does not have a gemspec but there is a lockfile" do @@ -371,7 +371,7 @@ describe "bundle install with explicit source paths" do bundle :check, :env => { "DEBUG" => 1 } expect(out).to match(/using resolution from the lockfile/) - should_be_installed "rack-obama 1.0", "net-ssh 1.0" + expect(the_bundle).to have_installed "rack-obama 1.0", "net-ssh 1.0" end it "source path gems w/deps don't re-resolve without changes" do @@ -391,7 +391,7 @@ describe "bundle install with explicit source paths" do bundle :check, :env => { "DEBUG" => 1 } expect(out).to match(/using resolution from the lockfile/) - should_be_installed "rack-obama 1.0", "net-ssh 1.0" + expect(the_bundle).to have_installed "rack-obama 1.0", "net-ssh 1.0" end end @@ -427,7 +427,7 @@ describe "bundle install with explicit source paths" do bundle "install" - should_be_installed "foo 2.0", "bar 1.0" + expect(the_bundle).to have_installed "foo 2.0", "bar 1.0" end it "unlocks all gems when a child dependency gem is updated" do @@ -435,7 +435,7 @@ describe "bundle install with explicit source paths" do bundle "install" - should_be_installed "foo 1.0", "bar 2.0" + expect(the_bundle).to have_installed "foo 1.0", "bar 2.0" end end @@ -456,7 +456,7 @@ describe "bundle install with explicit source paths" do bundle "install" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -480,7 +480,7 @@ describe "bundle install with explicit source paths" do gem "bar", :path => "#{lib_path("bar")}" G - should_be_installed "foo 1.0", "bar 1.0" + expect(the_bundle).to have_installed "foo 1.0", "bar 1.0" end it "switches the source when the gem existed in rubygems and the path was already being used for another gem" do @@ -507,7 +507,7 @@ describe "bundle install with explicit source paths" do end G - should_be_installed "bar 1.0" + expect(the_bundle).to have_installed "bar 1.0" end end @@ -525,8 +525,8 @@ describe "bundle install with explicit source paths" do bundle :install, :env => { "DEBUG" => 1 }, :artifice => "endpoint" expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$}) expect(out).not_to match(/^HTTP GET.*private_lib/) - should_be_installed "private_lib 2.2" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "private_lib 2.2" + expect(the_bundle).to have_installed "rack 1.0" end end end diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb index a562a3bc..bd8e7ac2 100644 --- a/spec/install/gemfile/platform_spec.rb +++ b/spec/install/gemfile/platform_spec.rb @@ -22,7 +22,7 @@ describe "bundle install across platforms" do gem "rack" G - should_be_installed "rack 0.9.1" + expect(the_bundle).to have_installed "rack 0.9.1" end it "pulls in the correct platform specific gem" do @@ -48,7 +48,7 @@ describe "bundle install across platforms" do gem "platform_specific" G - should_be_installed "platform_specific 1.0 JAVA" + expect(the_bundle).to have_installed "platform_specific 1.0 JAVA" end it "works with gems that have different dependencies" do @@ -59,7 +59,7 @@ describe "bundle install across platforms" do gem "nokogiri" G - should_be_installed "nokogiri 1.4.2 JAVA", "weakling 0.0.3" + expect(the_bundle).to have_installed "nokogiri 1.4.2 JAVA", "weakling 0.0.3" simulate_new_machine @@ -70,8 +70,8 @@ describe "bundle install across platforms" do gem "nokogiri" G - should_be_installed "nokogiri 1.4.2" - should_not_be_installed "weakling" + expect(the_bundle).to have_installed "nokogiri 1.4.2" + expect(the_bundle).not_to have_installed "weakling" end it "works the other way with gems that have different dependencies" do @@ -85,7 +85,7 @@ describe "bundle install across platforms" do simulate_platform "java" bundle "install" - should_be_installed "nokogiri 1.4.2 JAVA", "weakling 0.0.3" + expect(the_bundle).to have_installed "nokogiri 1.4.2 JAVA", "weakling 0.0.3" end it "fetches gems again after changing the version of Ruby" do @@ -115,7 +115,7 @@ describe "bundle install with platform conditionals" do end G - should_be_installed "nokogiri 1.4.2" + expect(the_bundle).to have_installed "nokogiri 1.4.2" end it "does not install gems tagged w/ another platforms" do @@ -127,8 +127,8 @@ describe "bundle install with platform conditionals" do end G - should_be_installed "rack 1.0" - should_not_be_installed "nokogiri 1.4.2" + expect(the_bundle).to have_installed "rack 1.0" + expect(the_bundle).not_to have_installed "nokogiri 1.4.2" end it "installs gems tagged w/ the current platforms inline" do @@ -136,7 +136,7 @@ describe "bundle install with platform conditionals" do source "file://#{gem_repo1}" gem "nokogiri", :platforms => :#{local_tag} G - should_be_installed "nokogiri 1.4.2" + expect(the_bundle).to have_installed "nokogiri 1.4.2" end it "does not install gems tagged w/ another platforms inline" do @@ -145,8 +145,8 @@ describe "bundle install with platform conditionals" do gem "rack" gem "nokogiri", :platforms => :#{not_local_tag} G - should_be_installed "rack 1.0" - should_not_be_installed "nokogiri 1.4.2" + expect(the_bundle).to have_installed "rack 1.0" + expect(the_bundle).not_to have_installed "nokogiri 1.4.2" end it "installs gems tagged w/ the current platform inline" do @@ -154,7 +154,7 @@ describe "bundle install with platform conditionals" do source "file://#{gem_repo1}" gem "nokogiri", :platform => :#{local_tag} G - should_be_installed "nokogiri 1.4.2" + expect(the_bundle).to have_installed "nokogiri 1.4.2" end it "doesn't install gems tagged w/ another platform inline" do @@ -162,7 +162,7 @@ describe "bundle install with platform conditionals" do source "file://#{gem_repo1}" gem "nokogiri", :platform => :#{not_local_tag} G - should_not_be_installed "nokogiri 1.4.2" + expect(the_bundle).not_to have_installed "nokogiri 1.4.2" end it "does not blow up on sources with all platform-excluded specs" do @@ -217,6 +217,6 @@ describe "when a gem has no architecture" do G bundle :install, :fakeweb => "windows" - should_be_installed "rcov 1.0.0" + expect(the_bundle).to have_installed "rcov 1.0.0" end end diff --git a/spec/install/gemfile/ruby_spec.rb b/spec/install/gemfile/ruby_spec.rb index d250e786..d4dad646 100644 --- a/spec/install/gemfile/ruby_spec.rb +++ b/spec/install/gemfile/ruby_spec.rb @@ -24,7 +24,7 @@ describe "ruby requirement" do G expect(exitstatus).to eq(0) if exitstatus - should_be_installed "rack-obama 1.0" + expect(the_bundle).to have_installed "rack-obama 1.0" end it "allows removing the ruby version requirement" do @@ -41,7 +41,7 @@ describe "ruby requirement" do gem "rack" G - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" expect(lockfile).not_to include("RUBY VERSION") end @@ -62,7 +62,7 @@ describe "ruby requirement" do gem "rack" G - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" expect(locked_ruby_version).to eq(Bundler::RubyVersion.system) end @@ -83,7 +83,7 @@ describe "ruby requirement" do gem "rack" G - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" expect(locked_ruby_version.versions).to eq(["5100"]) end end diff --git a/spec/install/gemfile/sources_spec.rb b/spec/install/gemfile/sources_spec.rb index 1ad9aac0..c6f389a7 100644 --- a/spec/install/gemfile/sources_spec.rb +++ b/spec/install/gemfile/sources_spec.rb @@ -35,7 +35,7 @@ describe "bundle install with gems on multiple sources" do expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") expect(out).to include("Installed from: file:#{gem_repo1}") - should_be_installed("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1") + expect(the_bundle).to have_installed("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1") end it "errors when disable_multisource is set" do @@ -65,7 +65,7 @@ describe "bundle install with gems on multiple sources" do expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") expect(out).to include("Installed from: file:#{gem_repo1}") - should_be_installed("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1") + expect(the_bundle).to have_installed("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1") end end end @@ -94,8 +94,8 @@ describe "bundle install with gems on multiple sources" do it "installs the gems without any warning" do bundle :install expect(out).not_to include("Warning") - should_be_installed("rack-obama 1.0.0") - should_be_installed("rack 1.0.0", :source => "remote1") + expect(the_bundle).to have_installed("rack-obama 1.0.0") + expect(the_bundle).to have_installed("rack 1.0.0", :source => "remote1") end it "can cache and deploy" do @@ -107,7 +107,7 @@ describe "bundle install with gems on multiple sources" do bundle "install --deployment" expect(exitstatus).to eq(0) if exitstatus - should_be_installed("rack-obama 1.0.0", "rack 1.0.0") + expect(the_bundle).to have_installed("rack-obama 1.0.0", "rack 1.0.0") end end @@ -131,7 +131,7 @@ describe "bundle install with gems on multiple sources" do it "installs the gems without any warning" do bundle :install expect(out).not_to include("Warning") - should_be_installed("rack-obama 1.0.0", "rack 1.0.0") + expect(the_bundle).to have_installed("rack-obama 1.0.0", "rack 1.0.0") end end @@ -167,7 +167,7 @@ describe "bundle install with gems on multiple sources" do it "installs from the same source without any warning" do bundle :install expect(out).not_to include("Warning") - should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to have_installed("depends_on_rack 1.0.1", "rack 1.0.0") end end @@ -184,7 +184,7 @@ describe "bundle install with gems on multiple sources" do it "installs from the same source without any warning" do bundle :install expect(out).not_to include("Warning") - should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to have_installed("depends_on_rack 1.0.1", "rack 1.0.0") end end end @@ -210,7 +210,7 @@ describe "bundle install with gems on multiple sources" do it "installs from the other source without any warning" do bundle :install expect(out).not_to include("Warning") - should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to have_installed("depends_on_rack 1.0.1", "rack 1.0.0") end end @@ -231,7 +231,7 @@ describe "bundle install with gems on multiple sources" do expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") expect(out).to include("Installed from: file:#{gem_repo2}") - should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to have_installed("depends_on_rack 1.0.1", "rack 1.0.0") end end @@ -257,7 +257,7 @@ describe "bundle install with gems on multiple sources" do bundle :install expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") - should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to have_installed("depends_on_rack 1.0.1", "rack 1.0.0") # In https://github.com/bundler/bundler/issues/3585 this failed # when there is already a lock file, and the gems are missing, so try again @@ -265,7 +265,7 @@ describe "bundle install with gems on multiple sources" do bundle :install expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") - should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to have_installed("depends_on_rack 1.0.1", "rack 1.0.0") end end end @@ -317,7 +317,7 @@ describe "bundle install with gems on multiple sources" do # Reproduction of https://github.com/bundler/bundler/issues/3298 it "does not unlock the installed gem on exec" do - should_be_installed("rack 0.9.1") + expect(the_bundle).to have_installed("rack 0.9.1") end end @@ -355,7 +355,7 @@ describe "bundle install with gems on multiple sources" do it "installs the gems without any warning" do bundle :install expect(out).not_to include("Warning") - should_be_installed("rack 1.0.0") + expect(the_bundle).to have_installed("rack 1.0.0") end end @@ -413,8 +413,8 @@ describe "bundle install with gems on multiple sources" do G # 6. Which should update foo to 0.2, but not the (locked) bar 0.1 - should_be_installed("foo 0.2") - should_be_installed("bar 0.1") + expect(the_bundle).to have_installed("foo 0.2") + expect(the_bundle).to have_installed("bar 0.1") end end diff --git a/spec/install/gemfile_spec.rb b/spec/install/gemfile_spec.rb index a0a1cb9a..3bc1c50e 100644 --- a/spec/install/gemfile_spec.rb +++ b/spec/install/gemfile_spec.rb @@ -22,7 +22,7 @@ describe "bundle install" do bundle :install, :gemfile => bundled_app("NotGemfile") ENV["BUNDLE_GEMFILE"] = "NotGemfile" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 22557156..e78eda45 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -13,7 +13,7 @@ describe "compact index api" do bundle! :install, :artifice => "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "should URI encode gem names" do @@ -34,7 +34,7 @@ describe "compact index api" do bundle! :install, :artifice => "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed( + expect(the_bundle).to have_installed( "rails 2.3.2", "actionpack 2.3.2", "activerecord 2.3.2", @@ -51,7 +51,7 @@ describe "compact index api" do G bundle! :install, :artifice => "compact_index" - should_be_installed "net-sftp 1.1.1" + expect(the_bundle).to have_installed "net-sftp 1.1.1" end it "should use the endpoint when using --deployment" do @@ -63,7 +63,7 @@ describe "compact index api" do bundle "install --deployment", :artifice => "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "handles git dependencies that are in rubygems" do @@ -81,7 +81,7 @@ describe "compact index api" do bundle! :install, :artifice => "compact_index" - should_be_installed("rails 2.3.2") + expect(the_bundle).to have_installed("rails 2.3.2") end it "handles git dependencies that are in rubygems using --deployment" do @@ -99,7 +99,7 @@ describe "compact index api" do bundle "install --deployment", :artifice => "compact_index" - should_be_installed("rails 2.3.2") + expect(the_bundle).to have_installed("rails 2.3.2") end it "doesn't fail if you only have a git gem with no deps when using --deployment" do @@ -113,7 +113,7 @@ describe "compact index api" do bundle "install --deployment", :artifice => "compact_index" expect(exitstatus).to eq(0) if exitstatus - should_be_installed("foo 1.0") + expect(the_bundle).to have_installed("foo 1.0") end it "falls back when the API errors out" do @@ -126,7 +126,7 @@ describe "compact index api" do bundle! :install, :fakeweb => "windows" expect(out).to include("Fetching source index from #{source_uri}") - should_be_installed "rcov 1.0.0" + expect(the_bundle).to have_installed "rcov 1.0.0" end it "falls back when the API URL returns 403 Forbidden" do @@ -137,7 +137,7 @@ describe "compact index api" do bundle! :install, :verbose => true, :artifice => "compact_index_forbidden" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "falls back when the versions endpoint has a checksum mismatch" do @@ -151,7 +151,7 @@ describe "compact index api" do expect(out).to include <<-'WARN' The checksum of /versions does not match the checksum provided by the server! Something is wrong (local checksum is "\"d41d8cd98f00b204e9800998ecf8427e\"", was expecting "\"123\""). WARN - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "falls back when the user's home directory does not exist or is not writable" do @@ -164,7 +164,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "handles host redirects" do @@ -174,7 +174,7 @@ The checksum of /versions does not match the checksum provided by the server! So G bundle! :install, :artifice => "compact_index_host_redirect" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "handles host redirects without Net::HTTP::Persistent" do @@ -198,7 +198,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")] expect(out).to_not match(/Too many redirects/) - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "times out when Bundler::Fetcher redirects too much" do @@ -220,7 +220,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle "install --full-index", :artifice => "compact_index" expect(out).to include("Fetching source index from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "should use the modern index for update" do @@ -231,7 +231,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle "update --full-index", :artifice => "compact_index" expect(out).to include("Fetching source index from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -250,7 +250,7 @@ The checksum of /versions does not match the checksum provided by the server! So G bundle! :install, :artifice => "compact_index_extra" - should_be_installed "back_deps 1.0" + expect(the_bundle).to have_installed "back_deps 1.0" end it "fetches gem versions even when those gems are already installed" do @@ -259,7 +259,7 @@ The checksum of /versions does not match the checksum provided by the server! So gem "rack", "1.0.0" G bundle! :install, :artifice => "compact_index_extra_api" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" build_repo4 do build_gem "rack", "1.2" do |s| @@ -273,7 +273,7 @@ The checksum of /versions does not match the checksum provided by the server! So gem "rack", "1.2" G bundle! :install, :artifice => "compact_index_extra_api" - should_be_installed "rack 1.2" + expect(the_bundle).to have_installed "rack 1.2" end it "considers all possible versions of dependencies from all api gem sources" do @@ -296,8 +296,8 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index_extra_api" - should_be_installed "somegem 1.0.0" - should_be_installed "activesupport 1.2.3" + expect(the_bundle).to have_installed "somegem 1.0.0" + expect(the_bundle).to have_installed "activesupport 1.2.3" end it "prints API output properly with back deps" do @@ -341,7 +341,7 @@ The checksum of /versions does not match the checksum provided by the server! So G bundle! :install, :artifice => "compact_index_extra_missing" - should_be_installed "back_deps 1.0" + expect(the_bundle).to have_installed "back_deps 1.0" end it "uses the endpoint if all sources support it" do @@ -352,7 +352,7 @@ The checksum of /versions does not match the checksum provided by the server! So G bundle! :install, :artifice => "compact_index_api_missing" - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "fetches again when more dependencies are found in subsequent sources using --deployment" do @@ -372,7 +372,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index_extra" bundle "install --deployment", :artifice => "compact_index_extra" - should_be_installed "back_deps 1.0" + expect(the_bundle).to have_installed "back_deps 1.0" end it "does not refetch if the only unmet dependency is bundler" do @@ -395,7 +395,7 @@ The checksum of /versions does not match the checksum provided by the server! So gem "rails" G bundle! :install, :artifice => "compact_index" - should_be_installed "rails 2.3.2" + expect(the_bundle).to have_installed "rails 2.3.2" end it "installs the binstubs" do @@ -472,7 +472,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index_basic_authentication" expect(out).not_to include("#{user}:#{password}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "strips http basic authentication creds for modern index" do @@ -483,7 +483,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "endopint_marshal_fail_basic_authentication" expect(out).not_to include("#{user}:#{password}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "strips http basic auth creds when it can't reach the server" do @@ -506,7 +506,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index_basic_authentication" expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") expect(out).not_to include("#{user}:#{password}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "does not pass the user / password to different hosts on redirect" do @@ -516,7 +516,7 @@ The checksum of /versions does not match the checksum provided by the server! So G bundle! :install, :artifice => "compact_index_creds_diff_host" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end describe "with authentication details in bundle config" do @@ -533,7 +533,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "reads authentication details by full url from bundle config" do @@ -543,14 +543,14 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "should use the API" do bundle "config #{source_hostname} #{user}:#{password}" bundle! :install, :artifice => "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "prefers auth supplied in the source uri" do @@ -562,7 +562,7 @@ The checksum of /versions does not match the checksum provided by the server! So bundle "config #{source_hostname} otheruser:wrong" bundle! :install, :artifice => "compact_index_strict_basic_authentication" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "shows instructions if auth is not provided for the source" do @@ -588,7 +588,7 @@ The checksum of /versions does not match the checksum provided by the server! So G bundle! :install, :artifice => "compact_index_basic_authentication" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end end @@ -673,6 +673,6 @@ The checksum of /versions does not match the checksum provided by the server! So bundle! :install, :artifice => "compact_index_concurrent_download" expect(File.read(versions)).to start_with("created_at") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index 837a1f87..72e7bffc 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -13,7 +13,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "should URI encode gem names" do @@ -34,7 +34,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}/...") - should_be_installed( + expect(the_bundle).to have_installed( "rails 2.3.2", "actionpack 2.3.2", "activerecord 2.3.2", @@ -51,7 +51,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint" - should_be_installed "net-sftp 1.1.1" + expect(the_bundle).to have_installed "net-sftp 1.1.1" end it "should use the endpoint when using --deployment" do @@ -63,7 +63,7 @@ describe "gemcutter's dependency API" do bundle "install --deployment", :artifice => "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "handles git dependencies that are in rubygems" do @@ -81,7 +81,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint" - should_be_installed("rails 2.3.2") + expect(the_bundle).to have_installed("rails 2.3.2") end it "handles git dependencies that are in rubygems using --deployment" do @@ -99,7 +99,7 @@ describe "gemcutter's dependency API" do bundle "install --deployment", :artifice => "endpoint" - should_be_installed("rails 2.3.2") + expect(the_bundle).to have_installed("rails 2.3.2") end it "doesn't fail if you only have a git gem with no deps when using --deployment" do @@ -113,7 +113,7 @@ describe "gemcutter's dependency API" do bundle "install --deployment", :artifice => "endpoint" expect(exitstatus).to eq(0) if exitstatus - should_be_installed("foo 1.0") + expect(the_bundle).to have_installed("foo 1.0") end it "falls back when the API errors out" do @@ -126,7 +126,7 @@ describe "gemcutter's dependency API" do bundle :install, :fakeweb => "windows" expect(out).to include("Fetching source index from #{source_uri}") - should_be_installed "rcov 1.0.0" + expect(the_bundle).to have_installed "rcov 1.0.0" end it "falls back when hitting the Gemcutter Dependency Limit" do @@ -143,7 +143,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint_fallback" expect(out).to include("Fetching source index from #{source_uri}") - should_be_installed( + expect(the_bundle).to have_installed( "activesupport 2.3.2", "actionpack 2.3.2", "actionmailer 2.3.2", @@ -163,7 +163,7 @@ describe "gemcutter's dependency API" do bundle :install, :verbose => true, :artifice => "endpoint_marshal_fail" expect(out).to include("could not fetch from the dependency API, trying the full index") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "falls back when the API URL returns 403 Forbidden" do @@ -174,7 +174,7 @@ describe "gemcutter's dependency API" do bundle :install, :verbose => true, :artifice => "endpoint_api_forbidden" expect(out).to include("Fetching source index from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "handles host redirects" do @@ -184,7 +184,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_host_redirect" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "handles host redirects without Net::HTTP::Persistent" do @@ -208,7 +208,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")] expect(out).to_not match(/Too many redirects/) - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "timeouts when Bundler::Fetcher redirects too much" do @@ -230,7 +230,7 @@ describe "gemcutter's dependency API" do bundle "install --full-index", :artifice => "endpoint" expect(out).to include("Fetching source index from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "should use the modern index for update" do @@ -241,7 +241,7 @@ describe "gemcutter's dependency API" do bundle "update --full-index", :artifice => "endpoint" expect(out).to include("Fetching source index from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -260,7 +260,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_extra" - should_be_installed "back_deps 1.0" + expect(the_bundle).to have_installed "back_deps 1.0" end it "fetches gem versions even when those gems are already installed" do @@ -282,7 +282,7 @@ describe "gemcutter's dependency API" do gem "rack", "1.2" G bundle :install, :artifice => "endpoint_extra_api" - should_be_installed "rack 1.2" + expect(the_bundle).to have_installed "rack 1.2" end it "considers all possible versions of dependencies from all api gem sources" do @@ -305,8 +305,8 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint_extra_api" - should_be_installed "somegem 1.0.0" - should_be_installed "activesupport 1.2.3" + expect(the_bundle).to have_installed "somegem 1.0.0" + expect(the_bundle).to have_installed "activesupport 1.2.3" end it "prints API output properly with back deps" do @@ -350,7 +350,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_extra_missing" - should_be_installed "back_deps 1.0" + expect(the_bundle).to have_installed "back_deps 1.0" end it "uses the endpoint if all sources support it" do @@ -361,7 +361,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_api_missing" - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "fetches again when more dependencies are found in subsequent sources using --deployment" do @@ -381,7 +381,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint_extra" bundle "install --deployment", :artifice => "endpoint_extra" - should_be_installed "back_deps 1.0" + expect(the_bundle).to have_installed "back_deps 1.0" end it "does not refetch if the only unmet dependency is bundler" do @@ -404,7 +404,7 @@ describe "gemcutter's dependency API" do gem "rails" G bundle :install, :artifice => "endpoint" - should_be_installed "rails 2.3.2" + expect(the_bundle).to have_installed "rails 2.3.2" end it "installs the binstubs" do @@ -481,7 +481,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint_basic_authentication" expect(out).not_to include("#{user}:#{password}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "strips http basic authentication creds for modern index" do @@ -492,7 +492,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endopint_marshal_fail_basic_authentication" expect(out).not_to include("#{user}:#{password}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "strips http basic auth creds when it can't reach the server" do @@ -515,7 +515,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint_basic_authentication" expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") expect(out).not_to include("#{user}:#{password}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "does not pass the user / password to different hosts on redirect" do @@ -525,7 +525,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_creds_diff_host" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end describe "with authentication details in bundle config" do @@ -542,7 +542,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "reads authentication details by full url from bundle config" do @@ -552,14 +552,14 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "should use the API" do bundle "config #{source_hostname} #{user}:#{password}" bundle :install, :artifice => "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "prefers auth supplied in the source uri" do @@ -571,7 +571,7 @@ describe "gemcutter's dependency API" do bundle "config #{source_hostname} otheruser:wrong" bundle :install, :artifice => "endpoint_strict_basic_authentication" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "shows instructions if auth is not provided for the source" do @@ -597,7 +597,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_basic_authentication" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end end diff --git a/spec/install/gems/env_spec.rb b/spec/install/gems/env_spec.rb index 072e698d..3168dc79 100644 --- a/spec/install/gems/env_spec.rb +++ b/spec/install/gems/env_spec.rb @@ -15,13 +15,13 @@ describe "bundle install with ENV conditionals" do it "excludes the gems when the ENV variable is not set" do bundle :install - should_not_be_installed "rack" + expect(the_bundle).not_to have_installed "rack" end it "includes the gems when the ENV variable is set" do ENV["BUNDLER_TEST"] = "1" bundle :install - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end @@ -38,13 +38,13 @@ describe "bundle install with ENV conditionals" do it "excludes the gems when the ENV variable is not set" do bundle :install - should_not_be_installed "rack" + expect(the_bundle).not_to have_installed "rack" end it "includes the gems when the ENV variable is set" do ENV["BUNDLER_TEST"] = "1" bundle :install - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end @@ -61,19 +61,19 @@ describe "bundle install with ENV conditionals" do it "excludes the gems when the ENV variable is not set" do bundle :install - should_not_be_installed "rack" + expect(the_bundle).not_to have_installed "rack" end it "excludes the gems when the ENV variable is set but does not match the condition" do ENV["BUNDLER_TEST"] = "1" bundle :install - should_not_be_installed "rack" + expect(the_bundle).not_to have_installed "rack" end it "includes the gems when the ENV variable is set and matches the condition" do ENV["BUNDLER_TEST"] = "foo" bundle :install - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end @@ -90,19 +90,19 @@ describe "bundle install with ENV conditionals" do it "excludes the gems when the ENV variable is not set" do bundle :install - should_not_be_installed "rack" + expect(the_bundle).not_to have_installed "rack" end it "excludes the gems when the ENV variable is set but does not match the condition" do ENV["BUNDLER_TEST"] = "fo" bundle :install - should_not_be_installed "rack" + expect(the_bundle).not_to have_installed "rack" end it "includes the gems when the ENV variable is set and matches the condition" do ENV["BUNDLER_TEST"] = "foobar" bundle :install - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end end diff --git a/spec/install/gems/flex_spec.rb b/spec/install/gems/flex_spec.rb index 452cadf3..232b3ced 100644 --- a/spec/install/gems/flex_spec.rb +++ b/spec/install/gems/flex_spec.rb @@ -8,8 +8,8 @@ describe "bundle flex_install" do gem 'rack' G - should_be_installed "rack 1.0.0" - should_be_locked + expect(the_bundle).to have_installed "rack 1.0.0" + expect(the_bundle).to be_locked end it "installs even when the lockfile is invalid" do @@ -18,8 +18,8 @@ describe "bundle flex_install" do gem 'rack' G - should_be_installed "rack 1.0.0" - should_be_locked + expect(the_bundle).to have_installed "rack 1.0.0" + expect(the_bundle).to be_locked gemfile <<-G source "file://#{gem_repo1}" @@ -27,8 +27,8 @@ describe "bundle flex_install" do G bundle :install - should_be_installed "rack 1.0.0" - should_be_locked + expect(the_bundle).to have_installed "rack 1.0.0" + expect(the_bundle).to be_locked end it "keeps child dependencies at the same version" do @@ -39,7 +39,7 @@ describe "bundle flex_install" do gem "rack-obama" G - should_be_installed "rack 1.0.0", "rack-obama 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0", "rack-obama 1.0.0" update_repo2 install_gemfile <<-G @@ -47,7 +47,7 @@ describe "bundle flex_install" do gem "rack-obama", "1.0" G - should_be_installed "rack 1.0.0", "rack-obama 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0", "rack-obama 1.0.0" end describe "adding new gems" do @@ -67,7 +67,7 @@ describe "bundle flex_install" do gem 'activesupport', '2.3.5' G - should_be_installed "rack 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to have_installed "rack 1.0.0", "activesupport 2.3.5" end it "keeps child dependencies pinned" do @@ -86,7 +86,7 @@ describe "bundle flex_install" do gem "thin" G - should_be_installed "rack 1.0.0", "rack-obama 1.0", "thin 1.0" + expect(the_bundle).to have_installed "rack 1.0.0", "rack-obama 1.0", "thin 1.0" end end @@ -106,8 +106,8 @@ describe "bundle flex_install" do gem 'rack' G - should_be_installed "rack 1.0.0" - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "rack 1.0.0" + expect(the_bundle).not_to have_installed "activesupport 2.3.5" install_gemfile <<-G source "file://#{gem_repo2}" @@ -115,7 +115,7 @@ describe "bundle flex_install" do gem 'activesupport', '2.3.2' G - should_be_installed "rack 1.0.0", "activesupport 2.3.2" + expect(the_bundle).to have_installed "rack 1.0.0", "activesupport 2.3.2" end it "removes top level dependencies when removed from the Gemfile while leaving other dependencies intact" do @@ -133,7 +133,7 @@ describe "bundle flex_install" do gem 'rack' G - should_not_be_installed "activesupport 2.3.5" + expect(the_bundle).not_to have_installed "activesupport 2.3.5" end it "removes child dependencies" do @@ -144,7 +144,7 @@ describe "bundle flex_install" do gem 'activesupport' G - should_be_installed "rack 1.0.0", "rack-obama 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to have_installed "rack 1.0.0", "rack-obama 1.0.0", "activesupport 2.3.5" update_repo2 install_gemfile <<-G @@ -152,8 +152,8 @@ describe "bundle flex_install" do gem 'activesupport' G - should_be_installed "activesupport 2.3.5" - should_not_be_installed "rack-obama", "rack" + expect(the_bundle).to have_installed "activesupport 2.3.5" + expect(the_bundle).not_to have_installed "rack-obama", "rack" end end @@ -165,7 +165,7 @@ describe "bundle flex_install" do gem "rack_middleware" G - should_be_installed "rack_middleware 1.0", "rack 0.9.1" + expect(the_bundle).to have_installed "rack_middleware 1.0", "rack 0.9.1" build_repo2 update_repo2 do diff --git a/spec/install/gems/mirror_spec.rb b/spec/install/gems/mirror_spec.rb index 8540778d..ba2e5020 100644 --- a/spec/install/gems/mirror_spec.rb +++ b/spec/install/gems/mirror_spec.rb @@ -15,7 +15,7 @@ describe "bundle install with a mirror configured" do it "installs from the normal location" do bundle :install expect(out).to include("Fetching source index from file:#{gem_repo1}") - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end @@ -34,7 +34,7 @@ describe "bundle install with a mirror configured" do bundle :install expect(out).to include("Fetching source index from file:#{gem_repo1}") expect(out).not_to include("Fetching source index from file:#{gem_repo2}") - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end end diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index a3ff7394..f18f4dbb 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -36,7 +36,7 @@ describe "bundle install with install-time dependencies" do gem "actionpack", "2.3.2" G - should_be_installed "actionpack 2.3.2", "activesupport 2.3.2" + expect(the_bundle).to have_installed "actionpack 2.3.2", "activesupport 2.3.2" end describe "with crazy rubygem plugin stuff" do @@ -46,7 +46,7 @@ describe "bundle install with install-time dependencies" do gem "net_b" G - should_be_installed "net_b 1.0" + expect(the_bundle).to have_installed "net_b 1.0" end it "installs plugins depended on by other plugins" do @@ -55,7 +55,7 @@ describe "bundle install with install-time dependencies" do gem "net_a" G - should_be_installed "net_a 1.0", "net_b 1.0" + expect(the_bundle).to have_installed "net_a 1.0", "net_b 1.0" end it "installs multiple levels of dependencies" do @@ -65,7 +65,7 @@ describe "bundle install with install-time dependencies" do gem "net_e" G - should_be_installed "net_a 1.0", "net_b 1.0", "net_c 1.0", "net_d 1.0", "net_e 1.0" + expect(the_bundle).to have_installed "net_a 1.0", "net_b 1.0", "net_c 1.0", "net_d 1.0", "net_e 1.0" end context "with ENV['DEBUG_RESOLVER'] set" do @@ -118,7 +118,7 @@ describe "bundle install with install-time dependencies" do G expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000") - should_be_installed("rack 1.2") + expect(the_bundle).to have_installed("rack 1.2") end end diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb index 396edb50..71e58305 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -5,7 +5,7 @@ shared_examples "bundle install --standalone" do shared_examples "common functionality" do it "still makes the gems available to normal bundler" do args = expected_gems.map {|k, v| "#{k} #{v}" } - should_be_installed(*args) + expect(the_bundle).to have_installed(*args) end it "generates a bundle/bundler/setup.rb" do diff --git a/spec/install/gems/sudo_spec.rb b/spec/install/gems/sudo_spec.rb index e102d2da..decac037 100644 --- a/spec/install/gems/sudo_spec.rb +++ b/spec/install/gems/sudo_spec.rb @@ -18,7 +18,7 @@ describe "when using sudo", :sudo => true do expect(out).to_not match(/an error occurred/i) expect(system_gem_path("cache/rack-1.0.0.gem")).to exist - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end end @@ -37,7 +37,7 @@ describe "when using sudo", :sudo => true do expect(system_gem_path("gems/rack-1.0.0")).to exist expect(system_gem_path("gems/rack-1.0.0").stat.uid).to eq(0) - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "installs rake and a gem dependent on rake in the same session" do @@ -63,7 +63,7 @@ describe "when using sudo", :sudo => true do expect(bundle_path.join("gems/rack-1.0.0")).to exist expect(bundle_path.join("gems/rack-1.0.0").stat.uid).to eq(0) - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "installs when BUNDLE_PATH does not exist" do @@ -80,7 +80,7 @@ describe "when using sudo", :sudo => true do expect(bundle_path.join("gems/rack-1.0.0")).to exist expect(bundle_path.join("gems/rack-1.0.0").stat.uid).to eq(0) - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "installs extensions/ compiled by Rubygems 2.2", :rubygems => "2.2" do @@ -107,7 +107,7 @@ describe "when using sudo", :sudo => true do G expect(default_bundle_path("gems/rack-1.0.0")).to exist - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end it "cleans up the tmpdirs generated" do @@ -139,7 +139,7 @@ describe "when using sudo", :sudo => true do bundle :install, :env => { "GEM_HOME" => gem_home.to_s, "GEM_PATH" => nil } expect(gem_home.join("bin/rackup")).to exist - should_be_installed "rack 1.0", :env => { "GEM_HOME" => gem_home.to_s, "GEM_PATH" => nil } + expect(the_bundle).to have_installed "rack 1.0", :env => { "GEM_HOME" => gem_home.to_s, "GEM_PATH" => nil } end end diff --git a/spec/install/gemspecs_spec.rb b/spec/install/gemspecs_spec.rb index 58e086b4..d9d95ce0 100644 --- a/spec/install/gemspecs_spec.rb +++ b/spec/install/gemspecs_spec.rb @@ -44,7 +44,7 @@ describe "bundle install" do f.write spec.to_ruby end bundle :install, :artifice => "endpoint_marshal_fail" # force gemspec load - should_be_installed "activesupport 2.3.2" + expect(the_bundle).to have_installed "activesupport 2.3.2" end context "when ruby version is specified in gemspec and gemfile" do @@ -57,7 +57,7 @@ describe "bundle install" do ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby' gemspec G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "installs when patch level is specified and the version still matches the current version", @@ -70,7 +70,7 @@ describe "bundle install" do ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{RUBY_PATCHLEVEL}' gemspec G - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end it "fails and complains about patchlevel on patchlevel mismatch", diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index 518e1291..1cfab669 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -12,7 +12,7 @@ describe "bundle install" do bundle :install expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at master@#{revision_for(lib_path("foo"))[0..6]})") - should_be_installed "foo 1.0", :source => "git@#{lib_path("foo")}" + expect(the_bundle).to have_installed "foo 1.0", :source => "git@#{lib_path("foo")}" end it "should check out git repos that are missing but not being installed" do diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index 4076eec2..986bda81 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -16,7 +16,7 @@ describe "bundle install" do it "does not use available system gems with bundle --path vendor/bundle" do bundle "install --path vendor/bundle" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "handles paths with regex characters in them" do @@ -48,7 +48,7 @@ describe "bundle install" do bundle "install" expect(vendored_gems("gems/rack-1.0.0")).to be_directory - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -79,7 +79,7 @@ describe "bundle install" do expect(vendored_gems("gems/rack-1.0.0")).to be_directory expect(bundled_app("vendor2")).not_to be_directory - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "installs gems to BUNDLE_PATH with #{type}" do @@ -88,7 +88,7 @@ describe "bundle install" do bundle :install expect(bundled_app("vendor/gems/rack-1.0.0")).to be_directory - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "installs gems to BUNDLE_PATH relative to root when relative" do @@ -100,7 +100,7 @@ describe "bundle install" do end expect(bundled_app("vendor/gems/rack-1.0.0")).to be_directory - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -110,14 +110,14 @@ describe "bundle install" do bundle :install expect(vendored_gems("gems/rack-1.0.0")).to be_directory - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "sets BUNDLE_PATH as the first argument to bundle install" do bundle "install --path ./vendor/bundle" expect(vendored_gems("gems/rack-1.0.0")).to be_directory - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "disables system gems when passing a path to install" do @@ -126,7 +126,7 @@ describe "bundle install" do bundle "install --path ./vendor/bundle" expect(vendored_gems("gems/rack-1.0.0")).to be_directory - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end diff --git a/spec/install/prereleases_spec.rb b/spec/install/prereleases_spec.rb index 61676f5d..05756ff3 100644 --- a/spec/install/prereleases_spec.rb +++ b/spec/install/prereleases_spec.rb @@ -8,7 +8,7 @@ describe "bundle install" do source "file://#{gem_repo1}" gem "not_released" G - should_be_installed "not_released 1.0.pre" + expect(the_bundle).to have_installed "not_released 1.0.pre" end it "uses regular releases if available" do @@ -16,7 +16,7 @@ describe "bundle install" do source "file://#{gem_repo1}" gem "has_prerelease" G - should_be_installed "has_prerelease 1.0" + expect(the_bundle).to have_installed "has_prerelease 1.0" end it "uses prereleases if requested" do @@ -24,7 +24,7 @@ describe "bundle install" do source "file://#{gem_repo1}" gem "has_prerelease", "1.1.pre" G - should_be_installed "has_prerelease 1.1.pre" + expect(the_bundle).to have_installed "has_prerelease 1.1.pre" end end @@ -36,7 +36,7 @@ describe "bundle install" do gem "rack" G - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end end diff --git a/spec/install/security_policy_spec.rb b/spec/install/security_policy_spec.rb index 08a9213e..b886362c 100644 --- a/spec/install/security_policy_spec.rb +++ b/spec/install/security_policy_spec.rb @@ -19,7 +19,7 @@ describe "policies with unsigned gems" do bundle "install --deployment" bundle :install expect(exitstatus).to eq(0) if exitstatus - should_be_installed "rack 1.0", "signed_gem 1.0" + expect(the_bundle).to have_installed "rack 1.0", "signed_gem 1.0" end it "will fail when given invalid security policy" do @@ -66,12 +66,12 @@ describe "policies with signed gems and no CA" do it "will succeed with Low Security setting, low security accepts self signed gem" do bundle "install --trust-policy=LowSecurity" expect(exitstatus).to eq(0) if exitstatus - should_be_installed "signed_gem 1.0" + expect(the_bundle).to have_installed "signed_gem 1.0" end it "will succeed with no policy" do bundle "install" expect(exitstatus).to eq(0) if exitstatus - should_be_installed "signed_gem 1.0" + expect(the_bundle).to have_installed "signed_gem 1.0" end end diff --git a/spec/lock/git_spec.rb b/spec/lock/git_spec.rb index 69937aab..db88aed7 100644 --- a/spec/lock/git_spec.rb +++ b/spec/lock/git_spec.rb @@ -11,7 +11,7 @@ describe "bundle lock with git gems" do end it "doesn't break right after running lock" do - should_be_installed "foo 1.0.0" + expect(the_bundle).to have_installed "foo 1.0.0" end it "locks a git source to the current ref" do diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 6e071310..2e158d8c 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -413,7 +413,7 @@ describe "the lockfile format" do #{Bundler::VERSION} G - should_be_installed "net-sftp 1.1.1", "net-ssh 1.0.0" + expect(the_bundle).to have_installed "net-sftp 1.1.1", "net-ssh 1.0.0" end it "generates a simple lockfile for a single pinned source, gem with a version requirement" do @@ -480,7 +480,7 @@ describe "the lockfile format" do L bundle "install" - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "serializes global git sources" do @@ -1168,7 +1168,7 @@ describe "the lockfile format" do G bundle "install --path vendor" - should_be_installed "omg 1.0" + expect(the_bundle).to have_installed "omg 1.0" # Create a Gemfile.lock that has duplicate GIT sections lockfile <<-L @@ -1202,7 +1202,7 @@ describe "the lockfile format" do FileUtils.rm_rf(bundled_app("vendor")) bundle "install" - should_be_installed "omg 1.0" + expect(the_bundle).to have_installed "omg 1.0" # Confirm that duplicate specs do not appear expect(File.read(bundled_app("Gemfile.lock"))).to eq(strip_whitespace(<<-L)) @@ -1245,7 +1245,7 @@ describe "the lockfile format" do it "generates Gemfile.lock with \\n line endings" do expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n") - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end context "during updates" do @@ -1254,7 +1254,7 @@ describe "the lockfile format" do expect { bundle "update" }.to change { File.mtime(bundled_app("Gemfile.lock")) } expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n") - should_be_installed "rack 1.2" + expect(the_bundle).to have_installed "rack 1.2" end it "preserves Gemfile.lock \\n\\r line endings" do @@ -1265,7 +1265,7 @@ describe "the lockfile format" do expect { bundle "update" }.to change { File.mtime(bundled_app("Gemfile.lock")) } expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n") - should_be_installed "rack 1.2" + expect(the_bundle).to have_installed "rack 1.2" end end diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index c0d121c7..97ed8d4f 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -494,7 +494,7 @@ G end bundle "update" - should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0" + expect(the_bundle).to have_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end it "updates fine with any engine" do @@ -511,7 +511,7 @@ G end bundle "update" - should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0" + expect(the_bundle).to have_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end end diff --git a/spec/plugins/install_spec.rb b/spec/plugins/install_spec.rb index eaf64275..880984b0 100644 --- a/spec/plugins/install_spec.rb +++ b/spec/plugins/install_spec.rb @@ -127,7 +127,7 @@ describe "bundler plugin install" do expect(out).to include("Bundle complete!") - should_be_installed("rack 1.0.0") + expect(the_bundle).to have_installed("rack 1.0.0") plugin_should_be_installed("foo") end diff --git a/spec/plugins/source/example_spec.rb b/spec/plugins/source/example_spec.rb index ead24e0d..2cb6c123 100644 --- a/spec/plugins/source/example_spec.rb +++ b/spec/plugins/source/example_spec.rb @@ -61,7 +61,7 @@ describe "real source plugins" do expect(out).to include("Bundle complete!") - should_be_installed("a-path-gem 1.0") + expect(the_bundle).to have_installed("a-path-gem 1.0") end it "writes to lock file" do @@ -124,7 +124,7 @@ describe "real source plugins" do expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}/.bundlecache")).to be_file FileUtils.rm_rf lib_path("a-path-gem-1.0") - should_be_installed("a-path-gem 1.0") + expect(the_bundle).to have_installed("a-path-gem 1.0") end it "copies repository to vendor cache and uses it even when installed with bundle --path" do @@ -134,7 +134,7 @@ describe "real source plugins" do expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist FileUtils.rm_rf lib_path("a-path-gem-1.0") - should_be_installed("a-path-gem 1.0") + expect(the_bundle).to have_installed("a-path-gem 1.0") end it "bundler package copies repository to vendor cache" do @@ -144,7 +144,7 @@ describe "real source plugins" do expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist FileUtils.rm_rf lib_path("a-path-gem-1.0") - should_be_installed("a-path-gem 1.0") + expect(the_bundle).to have_installed("a-path-gem 1.0") end end @@ -175,7 +175,7 @@ describe "real source plugins" do it "installs" do bundle "install" - should_be_installed("a-path-gem 1.0") + expect(the_bundle).to have_installed("a-path-gem 1.0") end end end @@ -324,7 +324,7 @@ describe "real source plugins" do it "handles the source option" do bundle "install" expect(out).to include("Bundle complete!") - should_be_installed("ma-gitp-gem 1.0") + expect(the_bundle).to have_installed("ma-gitp-gem 1.0") end it "writes to lock file" do @@ -382,7 +382,7 @@ describe "real source plugins" do it "installs" do bundle "install" - should_be_installed("ma-gitp-gem 1.0") + expect(the_bundle).to have_installed("ma-gitp-gem 1.0") end it "uses the locked ref" do @@ -417,7 +417,7 @@ describe "real source plugins" do G bundle "install" - should_be_installed("ma-gitp-gem 1.1") + expect(the_bundle).to have_installed("ma-gitp-gem 1.1") end end @@ -439,7 +439,7 @@ describe "real source plugins" do expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file FileUtils.rm_rf lib_path("foo-1.0") - should_be_installed "foo 1.0" + expect(the_bundle).to have_installed "foo 1.0" end end end diff --git a/spec/realworld/dependency_api_spec.rb b/spec/realworld/dependency_api_spec.rb index c77036fc..f59fae43 100644 --- a/spec/realworld/dependency_api_spec.rb +++ b/spec/realworld/dependency_api_spec.rb @@ -41,7 +41,7 @@ describe "gemcutter's dependency API", :realworld => true do bundle :install expect(out).to include("Fetching source index from #{@server_uri}/") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end end diff --git a/spec/realworld/gemfile_source_header_spec.rb b/spec/realworld/gemfile_source_header_spec.rb index be8f45c8..e2021861 100644 --- a/spec/realworld/gemfile_source_header_spec.rb +++ b/spec/realworld/gemfile_source_header_spec.rb @@ -26,7 +26,7 @@ describe "fetching dependencies with a mirrored source", :realworld => true, :ru expect(out).to include("Installing weakling") expect(out).to include("Bundle complete") - should_be_installed "weakling 0.0.3" + expect(the_bundle).to have_installed "weakling 0.0.3" end private diff --git a/spec/realworld/mirror_probe_spec.rb b/spec/realworld/mirror_probe_spec.rb index 981c4b84..aa2d02fe 100644 --- a/spec/realworld/mirror_probe_spec.rb +++ b/spec/realworld/mirror_probe_spec.rb @@ -35,7 +35,7 @@ describe "fetching dependencies with a not available mirror", :realworld => true expect(out).to include("Installing weakling") expect(out).to include("Bundle complete") - should_be_installed "weakling 0.0.3" + expect(the_bundle).to have_installed "weakling 0.0.3" end end @@ -55,7 +55,7 @@ describe "fetching dependencies with a not available mirror", :realworld => true expect(out).to include("Installing weakling") expect(out).to include("Bundle complete") - should_be_installed "weakling 0.0.3" + expect(the_bundle).to have_installed "weakling 0.0.3" end end diff --git a/spec/runtime/platform_spec.rb b/spec/runtime/platform_spec.rb index db99f355..02cb1b03 100644 --- a/spec/runtime/platform_spec.rb +++ b/spec/runtime/platform_spec.rb @@ -57,7 +57,7 @@ describe "Bundler.setup with multi platform stuff" do gem "nokogiri" G - should_be_installed "nokogiri 1.4.2" + expect(the_bundle).to have_installed "nokogiri 1.4.2" end it "will add the resolve for the current platform" do @@ -86,6 +86,6 @@ describe "Bundler.setup with multi platform stuff" do gem "platform_specific" G - should_be_installed "nokogiri 1.4.2", "platform_specific 1.0 x86-darwin-100" + expect(the_bundle).to have_installed "nokogiri 1.4.2", "platform_specific 1.0 x86-darwin-100" end end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 5a4ca2ac..b943cf92 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -256,7 +256,7 @@ describe "Bundler.setup" do ENV["BUNDLE_GEMFILE"] = bundled_app("4realz").to_s bundle :install - should_be_installed "activesupport 2.3.5" + expect(the_bundle).to have_installed "activesupport 2.3.5" end it "prioritizes gems in BUNDLE_PATH over gems in GEM_HOME" do @@ -270,7 +270,7 @@ describe "Bundler.setup" do s.write "lib/rack.rb", "RACK = 'FAIL'" end - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end describe "integrate with rubygems" do @@ -439,14 +439,14 @@ describe "Bundler.setup" do it "works even when the cache directory has been deleted" do bundle "install --path vendor/bundle" FileUtils.rm_rf vendored_gems("cache") - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do bundle "install --path vendor/bundle" with_read_only("**/*") do - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end @@ -454,7 +454,7 @@ describe "Bundler.setup" do bundle "install" with_read_only("#{Bundler.bundle_path}/**/*") do - should_be_installed "rack 1.0.0" + expect(the_bundle).to have_installed "rack 1.0.0" end end end @@ -559,7 +559,7 @@ describe "Bundler.setup" do install_gems "activesupport-2.3.5" - should_be_installed "activesupport 2.3.2", :groups => :default + expect(the_bundle).to have_installed "activesupport 2.3.2", :groups => :default end it "remembers --without and does not bail on bare Bundler.setup" do @@ -574,7 +574,7 @@ describe "Bundler.setup" do install_gems "activesupport-2.3.5" - should_be_installed "activesupport 2.3.2" + expect(the_bundle).to have_installed "activesupport 2.3.2" end it "remembers --without and does not include groups passed to Bundler.setup" do @@ -591,8 +591,8 @@ describe "Bundler.setup" do end G - should_not_be_installed "activesupport 2.3.2", :groups => :rack - should_be_installed "rack 1.0.0", :groups => :rack + expect(the_bundle).not_to have_installed "activesupport 2.3.2", :groups => :rack + expect(the_bundle).to have_installed "rack 1.0.0", :groups => :rack end end diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 6ed3a290..058b7f10 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -434,6 +434,7 @@ module Spec def build_with(builder, name, args, &blk) @_build_path ||= nil + @_build_repo ||= nil options = args.last.is_a?(Hash) ? args.pop : {} versions = args.last || "1.0" spec = nil diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 0d2338df..d00e8a38 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -34,6 +34,10 @@ module Spec attr_reader :out, :err, :exitstatus + def the_bundle(*args) + TheBundle.new(*args) + end + def in_app_root(&blk) Dir.chdir(bundled_app, &blk) end diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 91c0f658..e4244294 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true require "forwardable" +require "support/the_bundle" module Spec module Matchers extend RSpec::Matchers @@ -19,6 +20,7 @@ module Spec def initialize(matcher, preconditions) @matcher = with_matchers_cloned(matcher) @preconditions = with_matchers_cloned(preconditions) + @failure_index = nil end def matches?(target, &blk) @@ -100,65 +102,108 @@ module Spec define_compound_matcher :read_as, [exist] do |file_contents| diffable + attr_reader :strip_whitespace + + chain :stripping_whitespace do + @strip_whitespace = true + end + match do |actual| @actual = Bundler.read_file(actual) + file_contents = strip_whitespace(file_contents) if strip_whitespace values_match?(file_contents, @actual) end end - def should_be_installed(*names) - opts = names.last.is_a?(Hash) ? names.pop : {} - source = opts.delete(:source) - groups = Array(opts[:groups]) - groups << opts - aggregate_failures "should be installed" do - names.each do |name| + def indent(string, padding = 4, indent_character = " ") + string.to_s.gsub(/^/, indent_character * padding).gsub("\t", " ") + end + + define_compound_matcher :have_installed, [be_an_instance_of(Spec::TheBundle)] do |*names| + match do + opts = names.last.is_a?(Hash) ? names.pop : {} + source = opts.delete(:source) + groups = Array(opts[:groups]) + groups << opts + @errors = names.map do |name| name, version, platform = name.split(/\s+/) version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name) - run! "require '#{name}.rb'; puts #{version_const}", *groups - expect(out).not_to be_empty, "#{name} is not installed" + begin + run! "require '#{name}.rb'; puts #{version_const}", *groups + rescue => e + next "#{name} is not installed:\n#{indent(e)}" + end out.gsub!(/#{MAJOR_DEPRECATION}.*$/, "") actual_version, actual_platform = out.strip.split(/\s+/, 2) - expect(Gem::Version.new(actual_version)).to eq(Gem::Version.new(version)) - expect(actual_platform).to eq(platform) + unless Gem::Version.new(actual_version) == Gem::Version.new(version) + next "#{name} was expected to be at version #{version} but was #{actual_version}" + end + unless actual_platform == platform + next "#{name} was expected to be of platform #{platform} but was #{actual_platform}" + end next unless source - source_const = "#{Spec::Builders.constantize(name)}_SOURCE" - run! "require '#{name}/source'; puts #{source_const}", *groups + begin + source_const = "#{Spec::Builders.constantize(name)}_SOURCE" + run! "require '#{name}/source'; puts #{source_const}", *groups + rescue + next "#{name} does not have a source defined:\n#{indent(e)}" + end out.gsub!(/#{MAJOR_DEPRECATION}.*$/, "") - expect(out.strip).to eq(source), - "Expected #{name} (#{version}) to be installed from `#{source}`, was actually from `#{out}`" - end - end - end + unless out.strip == source + next "Expected #{name} (#{version}) to be installed from `#{source}`, was actually from `#{out}`" + end + end.compact - alias_method :should_be_available, :should_be_installed + @errors.empty? + end - def should_not_be_installed(*names) - opts = names.last.is_a?(Hash) ? names.pop : {} - groups = Array(opts[:groups]) || [] - names.each do |name| - name, version = name.split(/\s+/, 2) - run <<-R, *(groups + [opts]) + match_when_negated do + opts = names.last.is_a?(Hash) ? names.pop : {} + groups = Array(opts[:groups]) || [] + @errors = names.map do |name| + name, version = name.split(/\s+/, 2) begin - require '#{name}' - puts #{Spec::Builders.constantize(name)} - rescue LoadError, NameError - puts "WIN" + run <<-R, *(groups + [opts]) + begin + require '#{name}' + puts #{Spec::Builders.constantize(name)} + rescue LoadError, NameError + puts "WIN" + end + R + rescue => e + next "checking for #{name} failed:\n#{e}" end - R - if version.nil? || out == "WIN" - expect(out).to eq("WIN") - else - expect(Gem::Version.new(out)).not_to eq(Gem::Version.new(version)) - end + next if out == "WIN" + if version.nil? + next "expected #{name} to not be installed, but it was" + elsif Gem::Version.new(out) == Gem::Version.new(version) + next "expected #{name} (#{version}) not to be installed, but it was" + end + end.compact + + @errors.empty? + end + + failure_message do + super() + " but:\n" + @errors.map {|e| indent(e) }.join("\n") + end + + failure_message_when_negated do + super() + " but:\n" + @errors.map {|e| indent(e) }.join("\n") end end + RSpec::Matchers.define_negated_matcher :not_have_installed, :have_installed + + 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) - path = Bundler::Plugin.installed?(name) - expect(File.join(path, "plugins.rb")).to exist + path = Pathname.new(Bundler::Plugin.installed?(name)) + expect(path + "plugins.rb").to exist end end @@ -168,10 +213,6 @@ module Spec end end - def should_be_locked - expect(bundled_app("Gemfile.lock")).to exist - end - def lockfile_should_be(expected) expect(bundled_app("Gemfile.lock")).to read_as(strip_whitespace(expected)) end diff --git a/spec/support/the_bundle.rb b/spec/support/the_bundle.rb new file mode 100644 index 00000000..85282db7 --- /dev/null +++ b/spec/support/the_bundle.rb @@ -0,0 +1,30 @@ +require "support/helpers" +require "support/path" + +module Spec + class TheBundle + include Spec::Helpers + include Spec::Path + + attr_accessor :bundle_dir + + def initialize(opts = {}) + opts = opts.dup + @bundle_dir = Pathname.new(opts.delete(:bundle_dir) { bundled_app }) + raise "Too many options! #{opts}" unless opts.empty? + end + + def to_s + "the bundle" + end + alias inspect to_s + + def locked? + lockfile.file? + end + + def lockfile + bundle_dir.join("Gemfile.lock") + end + end +end diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb index 25dff681..6228e25e 100644 --- a/spec/update/git_spec.rb +++ b/spec/update/git_spec.rb @@ -19,7 +19,7 @@ describe "bundle update" do bundle "update" - should_be_installed "foo 1.1" + expect(the_bundle).to have_installed "foo 1.1" end it "updates correctly when you have like craziness" do @@ -34,7 +34,7 @@ describe "bundle update" do bundle "update rails" expect(out).to include("Using activesupport 3.0 from #{lib_path("rails")} (at master@#{revision_for(lib_path("rails"))[0..6]})") - should_be_installed "rails 3.0", "activesupport 3.0" + expect(the_bundle).to have_installed "rails 3.0", "activesupport 3.0" end it "floats on a branch when :branch is used and the source is specified in the update" do @@ -53,7 +53,7 @@ describe "bundle update" do bundle "update --source foo" - should_be_installed "foo 1.1" + expect(the_bundle).to have_installed "foo 1.1" end it "floats on master when updating all gems that are pinned to the source even if you have child dependencies" do @@ -73,7 +73,7 @@ describe "bundle update" do bundle "update foo" - should_be_installed "foo 1.1" + expect(the_bundle).to have_installed "foo 1.1" end it "notices when you change the repo url in the Gemfile" do @@ -268,7 +268,7 @@ describe "bundle update" do update_git "foo", "2.0", :path => @git.path bundle "update --source foo" - should_be_installed "foo 2.0" + expect(the_bundle).to have_installed "foo 2.0" end it "leaves all other gems frozen" do @@ -276,7 +276,7 @@ describe "bundle update" do update_git "foo", :path => @git.path bundle "update --source foo" - should_be_installed "rack 1.0" + expect(the_bundle).to have_installed "rack 1.0" end end |