diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-07-27 12:07:11 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-02 15:04:28 -0500 |
commit | c607f20d7d200c18cc26edb1346dda847cc4331e (patch) | |
tree | acf0e680184455241cfea3104a48f6c81ff316d0 /spec/commands | |
parent | 52285c7cefc0daaa99784945a7bc119102f68944 (diff) | |
download | bundler-c607f20d7d200c18cc26edb1346dda847cc4331e.tar.gz |
[Matchers] Add TheBundle class to make custom matchers more fluent
Diffstat (limited to 'spec/commands')
-rw-r--r-- | spec/commands/binstubs_spec.rb | 2 | ||||
-rw-r--r-- | spec/commands/config_spec.rb | 6 | ||||
-rw-r--r-- | spec/commands/console_spec.rb | 2 | ||||
-rw-r--r-- | spec/commands/exec_spec.rb | 10 | ||||
-rw-r--r-- | spec/commands/install_spec.rb | 32 | ||||
-rw-r--r-- | spec/commands/package_spec.rb | 14 | ||||
-rw-r--r-- | spec/commands/show_spec.rb | 6 | ||||
-rw-r--r-- | spec/commands/update_spec.rb | 44 |
8 files changed, 58 insertions, 58 deletions
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index e739f94248..1f8a3bd508 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 ad88af62d9..375c5727b1 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 b60ac2c9f6..a727b43e73 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 5e16eea882..df3e08fd36 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 89a9138dab..8f09689785 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 83b56f304e..4dfe47ab1d 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 b4f9c90c95..163c64fb67 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 d86db69e8d..24a3148b70 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 |