summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-01 13:00:11 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-01 13:08:36 +0100
commit922d514c7bcd56a3506c83a63476ba86b092b4a1 (patch)
tree3f3f71da58799370bbae6764550018ef51a5ab0a
parentcfd0828f0c96721a50f008b49732c0aa557ebb85 (diff)
downloadbundler-922d514c7bcd56a3506c83a63476ba86b092b4a1.tar.gz
Rework DSL specs and enable them in bundler 2
To make sure all cases are covered.
-rw-r--r--spec/bundler/dsl_spec.rb66
1 files changed, 50 insertions, 16 deletions
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb
index c4cf72b53e..2a4a198d24 100644
--- a/spec/bundler/dsl_spec.rb
+++ b/spec/bundler/dsl_spec.rb
@@ -32,20 +32,47 @@ RSpec.describe Bundler::Dsl do
end
end
- context "default hosts (git, gist)", :bundler => "< 2" do
- context "when github.https config is true" do
- before { bundle "config set github.https true" }
- it "converts :github to :git using https" do
- subject.gem("sparks", :github => "indirect/sparks")
- github_uri = "https://github.com/indirect/sparks.git"
+ shared_examples_for "the github DSL" do |protocol|
+ context "when full repo is used" do
+ let(:repo) { "indirect/sparks" }
+
+ it "converts :github to URI using #{protocol}" do
+ subject.gem("sparks", :github => repo)
+ github_uri = "#{protocol}://github.com/#{repo}.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
end
- it "converts :github to :git" do
- subject.gem("sparks", :github => "indirect/sparks")
- github_uri = "git://github.com/indirect/sparks.git"
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
+ context "when shortcut repo is used" do
+ let(:repo) { "rails" }
+
+ it "converts :github to URI using #{protocol}" do
+ subject.gem("sparks", :github => repo)
+ github_uri = "#{protocol}://github.com/#{repo}/#{repo}.git"
+ expect(subject.dependencies.first.source.uri).to eq(github_uri)
+ end
+ end
+ end
+
+ context "default hosts (git, gist)" do
+ context "when github.https config is true" do
+ before { bundle "config set github.https true" }
+
+ it_behaves_like "the github DSL", "https"
+ end
+
+ context "when github.https config is false" do
+ before { bundle "config set github.https false" }
+
+ it_behaves_like "the github DSL", "git"
+ end
+
+ context "by default", :bundler => "< 2" do
+ it_behaves_like "the github DSL", "git"
+ end
+
+ context "by default", :bundler => "2" do
+ it_behaves_like "the github DSL", "https"
end
it "converts numeric :gist to :git" do
@@ -60,12 +87,6 @@ RSpec.describe Bundler::Dsl do
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
- it "converts 'rails' to 'rails/rails'" do
- subject.gem("rails", :github => "rails")
- github_uri = "git://github.com/rails/rails.git"
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
- end
-
it "converts :bitbucket to :git" do
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
bitbucket_uri = "https://mcorp@bitbucket.org/mcorp/flatlab-rails.git"
@@ -258,6 +279,19 @@ RSpec.describe Bundler::Dsl do
end
end
+ describe "#github", :bundler => "2" do
+ it "from github" do
+ spree_gems = %w[spree_core spree_api spree_backend]
+ subject.github "spree" do
+ spree_gems.each {|spree_gem| subject.send :gem, spree_gem }
+ end
+
+ subject.dependencies.each do |d|
+ expect(d.source.uri).to eq("https://github.com/spree/spree.git")
+ end
+ end
+ end
+
describe "#github", :bundler => "3" do
it "from github" do
expect do