summaryrefslogtreecommitdiff
path: root/spec/bundler/install/gemfile
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/install/gemfile')
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb18
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb64
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb51
4 files changed, 80 insertions, 57 deletions
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index 0bec2e9d96..bf1f4d7b9a 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe "bundle install from an existing gemspec" do
source "file://#{gem_repo2}"
gemspec :path => '#{tmp.join("foo")}'
G
- expect(last_command.bundler_err).to match(/There are no gemspecs at #{tmp.join('foo')}/)
+ expect(err).to match(/There are no gemspecs at #{tmp.join('foo')}/)
end
it "should raise if there are too many gemspecs available" do
@@ -77,7 +77,7 @@ RSpec.describe "bundle install from an existing gemspec" do
source "file://#{gem_repo2}"
gemspec :path => '#{tmp.join("foo")}'
G
- expect(last_command.bundler_err).to match(/There are multiple gemspecs at #{tmp.join('foo')}/)
+ expect(err).to match(/There are multiple gemspecs at #{tmp.join('foo')}/)
end
it "should pick a specific gemspec" do
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index c6738686bb..8ca22f1d87 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -204,7 +204,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run <<-RUBY
require 'foo'
@@ -234,7 +234,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run! <<-RUBY
require 'foo'
@@ -270,7 +270,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run! <<-RUBY
require 'foo'
@@ -515,7 +515,7 @@ RSpec.describe "bundle install with git sources" do
bundle solution
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "explodes and gives correct solution if branch is not given on install" do
@@ -537,7 +537,7 @@ RSpec.describe "bundle install with git sources" do
bundle solution
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "does not explode if disable_local_branch_check is given" do
@@ -1197,7 +1197,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
- expect(last_command.bundler_err).to end_with(<<-M.strip)
+ expect(err).to end_with(<<-M.strip)
An error occurred while installing foo (1.0), and Bundler cannot continue.
In Gemfile:
@@ -1380,7 +1380,7 @@ In Gemfile:
with_path_as("") do
bundle "update", :all => true
end
- expect(last_command.bundler_err).
+ expect(err).
to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
end
@@ -1437,7 +1437,7 @@ In Gemfile:
G
expect(last_command.stdboth).to_not include("password1")
- expect(last_command.stdout).to include("Fetching https://user1@github.com/company/private-repo")
+ expect(out).to include("Fetching https://user1@github.com/company/private-repo")
end
end
@@ -1452,7 +1452,7 @@ In Gemfile:
G
expect(last_command.stdboth).to_not include("oauth_token")
- expect(last_command.stdout).to include("Fetching https://x-oauth-basic@github.com/company/private-repo")
+ expect(out).to include("Fetching https://x-oauth-basic@github.com/company/private-repo")
end
end
end
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index 54a41b576f..e80764070c 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -313,7 +313,7 @@ RSpec.describe "bundle install with explicit source paths" do
install_gemfile <<-G
gem 'foo', '1.0', :path => "#{lib_path("foo-1.0")}"
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "removes the .gem file after installing" do
@@ -484,6 +484,68 @@ RSpec.describe "bundle install with explicit source paths" do
expect(the_bundle).to include_gems "rack 1.0.0"
end
+
+ it "keeps using the same version if it's compatible" do
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
+ s.add_dependency "rack", "0.9.1"
+ end
+
+ bundle "install"
+
+ expect(the_bundle).to include_gems "rack 0.9.1"
+
+ lockfile_should_be <<-G
+ PATH
+ remote: #{lib_path("foo")}
+ specs:
+ foo (1.0)
+ rack (= 0.9.1)
+
+ GEM
+ remote: #{URI.parse("file://#{gem_repo1}/")}
+ specs:
+ rack (0.9.1)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ foo!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
+ s.add_dependency "rack"
+ end
+
+ bundle "install"
+
+ lockfile_should_be <<-G
+ PATH
+ remote: #{lib_path("foo")}
+ specs:
+ foo (1.0)
+ rack
+
+ GEM
+ remote: #{URI.parse("file://#{gem_repo1}/")}
+ specs:
+ rack (0.9.1)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ foo!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+
+ expect(the_bundle).to include_gems "rack 0.9.1"
+ end
end
describe "switching sources" do
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index 8e1205dfa3..da364a51bb 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -471,13 +471,13 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "when a single source contains multiple locked gems" do
before do
- # 1. With these gems,
+ # With these gems,
build_repo4 do
build_gem "foo", "0.1"
build_gem "bar", "0.1"
end
- # 2. Installing this gemfile will produce...
+ # Installing this gemfile...
gemfile <<-G
source 'file://#{gem_repo1}'
gem 'rack'
@@ -485,28 +485,9 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem 'bar', '~> 0.1', :source => 'file://#{gem_repo4}'
G
- # 3. this lockfile.
- lockfile <<-L
- GEM
- remote: file:/Users/andre/src/bundler/bundler/tmp/gems/remote1/
- remote: file:/Users/andre/src/bundler/bundler/tmp/gems/remote4/
- specs:
- bar (0.1)
- foo (0.1)
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- bar (~> 0.1)!
- foo (~> 0.1)!
- rack
- L
-
bundle! :install, forgotten_command_line_options(:path => "../gems/system")
- # 4. Then we add some new versions...
+ # And then we add some new versions...
update_repo4 do
build_gem "foo", "0.2"
build_gem "bar", "0.3"
@@ -514,7 +495,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "allows them to be unlocked separately" do
- # 5. and install this gemfile, updating only foo.
+ # And install this gemfile, updating only foo.
install_gemfile <<-G
source 'file://#{gem_repo1}'
gem 'rack'
@@ -522,7 +503,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem 'bar', '~> 0.1', :source => 'file://#{gem_repo4}'
G
- # 6. Which should update foo to 0.2, but not the (locked) bar 0.1
+ # It should update foo to 0.2, but not the (locked) bar 0.1
expect(the_bundle).to include_gems("foo 0.2", "bar 0.1")
end
end
@@ -578,7 +559,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
# When this gemfile is installed...
- gemfile <<-G
+ install_gemfile <<-G
source "#{source_uri}"
source "#{second_uri}" do
@@ -588,26 +569,6 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "rack-obama"
G
- # It creates this lockfile.
- lockfile <<-L
- GEM
- remote: #{source_uri}/
- remote: #{second_uri}/
- specs:
- rack (2.0.1.1.forked)
- rack-obama (1.0)
- rack
- thor (0.19.1.1.forked)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (= 2.0.1.1.forked)!
- rack-obama
- thor!
- L
-
# Then we change the Gemfile by adding a version to thor
gemfile <<-G
source "#{source_uri}"