diff options
author | The Bundler Bot <bot@bundler.io> | 2017-05-09 23:23:15 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-05-09 23:23:15 +0000 |
commit | a146905db6478a7a99ba600b2f13dfe4c7383d76 (patch) | |
tree | c6e374a3d0d508a3203371403fb8045a9de98a5b /spec | |
parent | a1925cb18c58232ba009df01478b65dfe43d51ba (diff) | |
parent | b0e00d28d2f7d6f9bd817308e5cb224686c3287c (diff) | |
download | bundler-a146905db6478a7a99ba600b2f13dfe4c7383d76.tar.gz |
Auto merge of #5647 - bundler:colby/spec-set-specs, r=segiddins
Add specs for #find_by_name_and_platform and #merge in SpecSet
As the title says, this PR just adds a few specs that i noticed were missing in SpecSet.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/spec_set_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/bundler/spec_set_spec.rb b/spec/bundler/spec_set_spec.rb index 8f7c27f065..37bdcdaf7f 100644 --- a/spec/bundler/spec_set_spec.rb +++ b/spec/bundler/spec_set_spec.rb @@ -17,6 +17,7 @@ RSpec.describe Bundler::SpecSet do build_spec("e", "1.0.0.pre.1"), ].flatten end + subject { described_class.new(specs) } context "enumerable methods" do @@ -29,6 +30,40 @@ RSpec.describe Bundler::SpecSet do end end + describe "#find_by_name_and_platform" do + let(:platform) { Gem::Platform.new("universal-darwin-64") } + let(:platform_spec) { build_spec("b", "2.0", platform).first } + let(:specs) do + [ + build_spec("a", "1.0"), + platform_spec, + ].flatten + end + + it "finds spec with given name and platform" do + spec = described_class.new(specs).find_by_name_and_platform("b", platform) + expect(spec).to eq platform_spec + end + end + + describe "#merge" do + let(:other_specs) do + [ + build_spec("f", "1.0"), + build_spec("g", "2.0"), + ].flatten + end + + let(:other_spec_set) { described_class.new(other_specs) } + + it "merges the items in each gemspec" do + new_spec_set = subject.merge(other_spec_set) + specs = new_spec_set.to_a.map(&:full_name) + expect(specs).to include("a-1.0") + expect(specs).to include("f-1.0") + end + end + describe "#to_a" do it "returns the specs in order" do expect(subject.to_a.map(&:full_name)).to eq %w( |