File tree Expand file tree Collapse file tree
bundler/spec/bundler/plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ RSpec . describe Bundler ::Plugin ::UnloadedSource do
4+ let ( :uri ) { "uri://to/test" }
5+
6+ def source ( type )
7+ described_class . new ( "uri" => uri , "type" => type )
8+ end
9+
10+ describe "equality" do
11+ it "treats sources with the same uri and type as equal" do
12+ a = source ( "type_a" )
13+ b = source ( "type_a" )
14+
15+ expect ( a ) . to eq ( b )
16+ expect ( a ) . to eql ( b )
17+ expect ( a . hash ) . to eq ( b . hash )
18+ end
19+
20+ it "treats sources with the same uri but different types as not equal" do
21+ a = source ( "type_a" )
22+ b = source ( "type_b" )
23+
24+ expect ( a ) . not_to eq ( b )
25+ expect ( a ) . not_to eql ( b )
26+ expect ( a . hash ) . not_to eq ( b . hash )
27+ end
28+
29+ it "is not equal to a real plugin source with the same uri and type" do
30+ klass = Class . new
31+ klass . send :include , Bundler ::Plugin ::API ::Source
32+
33+ expect ( source ( "type_a" ) ) . not_to eq ( klass . new ( "uri" => uri , "type" => "type_a" ) )
34+ end
35+ end
36+ end
You can’t perform that action at this time.
0 commit comments