summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Lance <stefan@lances.net>2015-07-17 09:29:53 -0500
committerStefan Lance <stefan@lances.net>2015-07-17 12:46:25 -0500
commitc62070ffb0269b873727fcf5ac4297e7737f49fd (patch)
tree375e8370f654afb9a825ede511cbdbe4c6348b99
parent7144b68bc20cb7918a860e92ec85b8e96daa417d (diff)
downloadbundler-c62070ffb0269b873727fcf5ac4297e7737f49fd.tar.gz
Fix failing specs introduced by RuboCop merge
-rw-r--r--lib/bundler/dsl.rb11
-rw-r--r--lib/bundler/source_list.rb2
-rw-r--r--lib/bundler/ui/shell.rb2
-rw-r--r--spec/bundler/dsl_spec.rb6
-rw-r--r--spec/commands/binstubs_spec.rb4
-rw-r--r--spec/commands/check_spec.rb2
-rw-r--r--spec/deprecation_spec.rb198
-rw-r--r--spec/install/bundler_spec.rb4
-rw-r--r--spec/install/gemfile/git_spec.rb4
-rw-r--r--spec/install/gemfile/path_spec.rb2
-rw-r--r--spec/support/builders.rb1
-rw-r--r--spec/support/helpers.rb12
12 files changed, 132 insertions, 116 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index d51aad005b..a87a0f825a 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -213,13 +213,7 @@ module Bundler
def add_git_sources
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
- # TODO 2.0 upgrade this setting to the default
- if Bundler.settings["github.https"]
- "https://github.com/#{repo_name}.git"
- else
- warn_github_source_change(repo_name)
- "git://github.com/#{repo_name}.git"
- end
+ "https://github.com/#{repo_name}.git"
end
# TODO 2.0 remove this deprecated git source
@@ -230,7 +224,8 @@ module Bundler
# TODO 2.0 remove this deprecated git source
git_source(:bitbucket) do |repo_name|
- warn_deprecated_git_source(:bitbucket, "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git")
+ # Double quotes here make some dsl_spec.rb specs fail
+ warn_deprecated_git_source(:bitbucket, 'https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git')
user_name, repo_name = repo_name.split "/"
repo_name ||= user_name
"https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index ba2778c1f4..1d0623c0a5 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -1,3 +1,5 @@
+require "set"
+
module Bundler
class SourceList
attr_reader :path_sources,
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index 3c26d0d67d..7371f43e14 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -34,7 +34,7 @@ module Bundler
def deprecate(msg, newline = nil)
unless @deprecation_messages.include?(msg)
@deprecation_messages.add(msg)
- tell_err("DEPRECATION: " + msg, :yellow, newline)
+ tell_stderr("DEPRECATION: " + msg, :yellow, newline)
end
end
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb
index 686e1f9449..ae6d5d5f3a 100644
--- a/spec/bundler/dsl_spec.rb
+++ b/spec/bundler/dsl_spec.rb
@@ -28,7 +28,7 @@ describe Bundler::Dsl do
context "default hosts (git, gist)" do
it "converts :github to :git" do
subject.gem("sparks", :github => "indirect/sparks")
- github_uri = "git://github.com/indirect/sparks.git"
+ github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
@@ -46,7 +46,7 @@ describe Bundler::Dsl do
it "converts 'rails' to 'rails/rails'" do
subject.gem("rails", :github => "rails")
- github_uri = "git://github.com/rails/rails.git"
+ github_uri = "https://github.com/rails/rails.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
@@ -166,7 +166,7 @@ describe Bundler::Dsl do
end
subject.dependencies.each do |d|
- expect(d.source.uri).to eq("git://github.com/spree/spree.git")
+ expect(d.source.uri).to eq("https://github.com/spree/spree.git")
end
end
end
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index 389e3fb7ff..0ca83624ad 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -47,7 +47,7 @@ describe "bundle binstubs <gem>" do
bundle "binstubs"
expect(exitstatus).to eq(1) if exitstatus
- expect(err).to eq("`bundle binstubs` needs at least one gem to run.")
+ expect(err).to include("`bundle binstubs` needs at least one gem to run.")
end
it "does not bundle the bundler binary" do
@@ -114,7 +114,7 @@ describe "bundle binstubs <gem>" do
bundle "binstubs doesnt_exist"
expect(exitstatus).to eq(7) if exitstatus
- expect(err).to eq("Could not find gem 'doesnt_exist'.")
+ expect(err).to include("Could not find gem 'doesnt_exist'.")
end
end
diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb
index 75a3ce1ce7..0f039c067e 100644
--- a/spec/commands/check_spec.rb
+++ b/spec/commands/check_spec.rb
@@ -261,7 +261,7 @@ describe "bundle check" do
bundle "check --path vendor/bundle"
expect(exitstatus).to eq(1) if exitstatus
- expect(out).to match(/The following gems are missing/)
+ expect(err).to match(/The following gems are missing/)
end
end
diff --git a/spec/deprecation_spec.rb b/spec/deprecation_spec.rb
index 19c6514235..e8c2b69ccf 100644
--- a/spec/deprecation_spec.rb
+++ b/spec/deprecation_spec.rb
@@ -1,117 +1,119 @@
require "spec_helper"
-describe "Bundler version 1.99" do
- context "when bundle is run" do
- it "should print a single deprecation warning" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- G
-
- expect(err).to eq("DEPRECATION: Gemfile and Gemfile.lock are " \
- "deprecated and will be replaced with gems.rb and gems.locked in " \
- "Bundler 2.0.")
- end
-
- it "should not warn about gems.rb" do
- create_file "gems.rb", <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- G
+if Bundler::VERSION == "1.99.0.dev"
+ describe "Bundler version 1.99" do
+ context "when bundle is run" do
+ it "should print a single deprecation warning" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ expect(err).to eq("DEPRECATION: Gemfile and Gemfile.lock are " \
+ "deprecated and will be replaced with gems.rb and gems.locked in " \
+ "Bundler 2.0.")
+ end
- bundle :install
- expect(err).to lack_errors
- end
- end
+ it "should not warn about gems.rb" do
+ create_file "gems.rb", <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
- context "when Bundler.setup is run in a ruby script" do
- it "should print a single deprecation warning" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack", :group => :test
- G
-
- ruby <<-RUBY
- require 'rubygems'
- require 'bundler'
- require 'bundler/vendored_thor'
-
- Bundler.ui = Bundler::UI::Shell.new
- Bundler.setup
- Bundler.setup
- RUBY
-
- expect(err).to eq("DEPRECATION: Gemfile and Gemfile.lock are " \
- "deprecated and will be replaced with gems.rb and gems.locked in " \
- "Bundler 2.0.")
+ bundle :install
+ expect(err).to lack_errors
+ end
end
- end
- context "when `bundler/deployment` is required in a ruby script" do
- it "should print a capistrano deprecation warning" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack", :group => :test
- G
-
- ruby(<<-RUBY, { :expect_err => true })
- require 'bundler/deployment'
- RUBY
-
- expect(err).to eq("DEPRECATION: Bundler no longer integrates " \
- "with Capistrano, but Capistrano provides " \
- "its own integration with Bundler via the " \
- "capistrano-bundler gem. Use it instead.")
+ context "when Bundler.setup is run in a ruby script" do
+ it "should print a single deprecation warning" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", :group => :test
+ G
+
+ ruby <<-RUBY
+ require 'rubygems'
+ require 'bundler'
+ require 'bundler/vendored_thor'
+
+ Bundler.ui = Bundler::UI::Shell.new
+ Bundler.setup
+ Bundler.setup
+ RUBY
+
+ expect(err).to eq("DEPRECATION: Gemfile and Gemfile.lock are " \
+ "deprecated and will be replaced with gems.rb and gems.locked in " \
+ "Bundler 2.0.")
+ end
end
- end
- describe Bundler::Dsl do
- before do
- @rubygems = double("rubygems")
- allow(Bundler::Source::Rubygems).to receive(:new){ @rubygems }
+ context "when `bundler/deployment` is required in a ruby script" do
+ it "should print a capistrano deprecation warning" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", :group => :test
+ G
+
+ ruby(<<-RUBY, { :expect_err => true })
+ require 'bundler/deployment'
+ RUBY
+
+ expect(err).to eq("DEPRECATION: Bundler no longer integrates " \
+ "with Capistrano, but Capistrano provides " \
+ "its own integration with Bundler via the " \
+ "capistrano-bundler gem. Use it instead.")
+ end
end
- context "with github gems" do
- it "warns about the https change" do
- allow(Bundler.ui).to receive(:deprecate)
- msg = "The :github option uses the git: protocol, which is not secure. " \
- "Bundler 2.0 will use the https: protcol, which is secure. Enable this change now by " \
- "running `bundle config github.https true`."
- expect(Bundler.ui).to receive(:deprecate).with(msg)
- subject.gem("sparks", :github => "indirect/sparks")
+ describe Bundler::Dsl do
+ before do
+ @rubygems = double("rubygems")
+ allow(Bundler::Source::Rubygems).to receive(:new){ @rubygems }
end
- it "upgrades to https on request" do
- Bundler.settings["github.https"] = true
- subject.gem("sparks", :github => "indirect/sparks")
- github_uri = "https://github.com/indirect/sparks.git"
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
+ context "with github gems" do
+ it "warns about the https change" do
+ allow(Bundler.ui).to receive(:deprecate)
+ msg = "The :github option uses the git: protocol, which is not secure. " \
+ "Bundler 2.0 will use the https: protcol, which is secure. Enable this change now by " \
+ "running `bundle config github.https true`."
+ expect(Bundler.ui).to receive(:deprecate).with(msg)
+ subject.gem("sparks", :github => "indirect/sparks")
+ end
+
+ it "upgrades to https on request" do
+ Bundler.settings["github.https"] = true
+ subject.gem("sparks", :github => "indirect/sparks")
+ github_uri = "https://github.com/indirect/sparks.git"
+ expect(subject.dependencies.first.source.uri).to eq(github_uri)
+ end
end
- end
- context "with bitbucket gems" do
- it "warns about removal" do
- allow(Bundler.ui).to receive(:deprecate)
- msg = "The :bitbucket git source is deprecated, and will be removed " \
- "in Bundler 2.0. Add this code to your Gemfile to ensure it " \
- "continues to work:\n git_source(:bitbucket) do |repo_name|\n " \
- " https://\#{user_name}@bitbucket.org/\#{user_name}/\#{repo_name}" \
- ".git\n end"
- expect(Bundler.ui).to receive(:deprecate).with(msg, true)
- subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
+ context "with bitbucket gems" do
+ it "warns about removal" do
+ allow(Bundler.ui).to receive(:deprecate)
+ msg = "The :bitbucket git source is deprecated, and will be removed " \
+ "in Bundler 2.0. Add this code to your Gemfile to ensure it " \
+ "continues to work:\n git_source(:bitbucket) do |repo_name|\n " \
+ " https://\#{user_name}@bitbucket.org/\#{user_name}/\#{repo_name}" \
+ ".git\n end"
+ expect(Bundler.ui).to receive(:deprecate).with(msg, true)
+ subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
+ end
end
- end
- context "with gist gems" do
- it "warns about removal" do
- allow(Bundler.ui).to receive(:deprecate)
- msg = "The :gist git source is deprecated, and will be removed " \
- "in Bundler 2.0. Add this code to your Gemfile to ensure it " \
- "continues to work:\n git_source(:gist) do |repo_name|\n " \
- " https://gist.github.com/\#{repo_name}.git\n" \
- " end"
- expect(Bundler.ui).to receive(:deprecate).with(msg, true)
- subject.gem("not-really-a-gem", :gist => "1234")
+ context "with gist gems" do
+ it "warns about removal" do
+ allow(Bundler.ui).to receive(:deprecate)
+ msg = "The :gist git source is deprecated, and will be removed " \
+ "in Bundler 2.0. Add this code to your Gemfile to ensure it " \
+ "continues to work:\n git_source(:gist) do |repo_name|\n " \
+ " https://gist.github.com/\#{repo_name}.git\n" \
+ " end"
+ expect(Bundler.ui).to receive(:deprecate).with(msg, true)
+ subject.gem("not-really-a-gem", :gist => "1234")
+ end
end
end
end
diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb
index f31e911fc9..3802858ef6 100644
--- a/spec/install/bundler_spec.rb
+++ b/spec/install/bundler_spec.rb
@@ -100,7 +100,7 @@ describe "bundle install" do
rails_fail (>= 0) ruby depends on
activesupport (= 1.2.3) ruby
E
- expect(err).to eq(nice_error)
+ expect(err).to include(nice_error)
end
it "causes a conflict if a child dependency conflicts with the Gemfile" do
@@ -118,7 +118,7 @@ describe "bundle install" do
activesupport (= 2.3.5) ruby
E
- expect(err).to eq(nice_error)
+ expect(err).to include(nice_error)
end
it "can install dependencies with newer bundler version" do
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index b1744f840c..134b53a131 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -662,6 +662,8 @@ describe "bundle install with git sources" do
it "prints a friendly error if a file blocks the git repo" do
build_git "foo"
+ # NOTE: `default_bundle_path` does not exist prior to `bundle install`.
+ FileUtils.mkdir_p(default_bundle_path)
FileUtils.touch(default_bundle_path("bundler"))
install_gemfile <<-G
@@ -669,7 +671,7 @@ describe "bundle install with git sources" do
G
expect(exitstatus).to_not eq(0) if exitstatus
- expect(out).to include("Bundler could not install a gem because it " \
+ expect(err).to include("Bundler could not install a gem because it " \
"needs to create a directory, but a file exists " \
"- #{default_bundle_path("bundler")}")
end
diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb
index 5eb3adc01c..3c6b19821c 100644
--- a/spec/install/gemfile/path_spec.rb
+++ b/spec/install/gemfile/path_spec.rb
@@ -126,6 +126,8 @@ describe "bundle install with explicit source paths" do
Gem::Specification.new do |s|
s.name = 'premailer'
s.version = '1.0.0'
+ s.summary = 'Hi'
+ s.authors = 'Me'
end
G
end
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index 4d7ad44418..49b0f9e819 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -366,6 +366,7 @@ module Spec
versions = args.last || "1.0"
spec = nil
+ # TODO [2.0]: Change this, since we won't use options[:path]
options[:path] ||= @_build_path
Array(versions).each do |version|
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index cc8241f520..4673a0a8b5 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -339,5 +339,17 @@ module Spec
end
File.open(pathname, "w") { |file| file.puts(changed_lines.join) }
end
+
+ def with_env_vars(env_hash, &block)
+ current_values = {}
+ env_hash.each do |k,v|
+ current_values[k] = v
+ ENV[k] = v
+ end
+ block.call if block_given?
+ env_hash.each do |k,v|
+ ENV[k] = current_values[k]
+ end
+ end
end
end