summaryrefslogtreecommitdiff
path: root/spec/bundler/stub_specification_spec.rb
diff options
context:
space:
mode:
authorJulian Nadeau <julian@jnadeau.ca>2017-05-01 23:40:31 -0400
committerJulian Nadeau <julian@jnadeau.ca>2017-05-05 10:04:10 -0400
commit51623aae48bdf0365d577c6d9d4e1930ba328180 (patch)
tree8a924c99717017036c89b0b9a4c46d733a0585a9 /spec/bundler/stub_specification_spec.rb
parentd085451947d41a0a3cdde3fd28723e11b842db7c (diff)
downloadbundler-51623aae48bdf0365d577c6d9d4e1930ba328180.tar.gz
Return Bundler::StubSpec if stub is a Bundler::StubSpec
Diffstat (limited to 'spec/bundler/stub_specification_spec.rb')
-rw-r--r--spec/bundler/stub_specification_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/bundler/stub_specification_spec.rb b/spec/bundler/stub_specification_spec.rb
new file mode 100644
index 0000000000..ecfe2412ee
--- /dev/null
+++ b/spec/bundler/stub_specification_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+require "spec_helper"
+
+if Bundler.rubygems.provides?(">= 2.1")
+ RSpec.describe Bundler::StubSpecification do
+ let(:with_gem_stub_spec) do
+ stub = Gem::Specification.stubs.first
+ described_class.from_stub(stub)
+ end
+
+ let(:with_bundler_stub_spec) do
+ described_class.from_stub(with_gem_stub_spec)
+ end
+
+ describe "#from_stub" do
+ it "returns the same stub if already a Bundler::StubSpecification" do
+ stub = described_class.from_stub(with_bundler_stub_spec)
+ expect(stub).to be(with_bundler_stub_spec)
+ end
+ end
+ end
+end