/
fund_spec.rb
117 lines (101 loc) · 3.5 KB
/
fund_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# frozen_string_literal: true
RSpec.describe "bundle install" do
context "with gem sources" do
context "when gems include a fund URI" do
it "should display the plural fund message after installing" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'has_metadata'
gem 'has_funding'
gem 'rack-obama'
G
bundle :install
expect(out).to include("2 gems you directly depend on are looking for funding.")
end
it "should display the singular fund message after installing" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'has_funding'
gem 'rack-obama'
G
bundle :install
expect(out).to include("1 gem you directly depend on is looking for funding!")
end
end
context "when gems do not include fund messages" do
it "should not display any fund messages" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "activesupport"
G
bundle :install
expect(out).not_to include("gem you depend on")
end
end
context "when a dependecy includes a fund message" do
it "should not display the fund message" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'gem_with_dependent_funding'
G
bundle :install
expect(out).not_to include("gem you depend on")
end
end
end
context "with git sources" do
context "when gems include fund URI" do
it "should display the fund URI after installing" do
build_git "also_has_funding" do |s|
s.metadata = {
"funding_uri" => "https://example.com/also_has_funding/funding",
}
end
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}'
G
bundle :install
expect(out).to include("1 gem you directly depend on is looking for funding")
end
it "should display the fund URI if repo is updated" do
build_git "also_has_funding" do |s|
s.metadata = {
"funding_uri" => "https://example.com/also_has_funding/funding",
}
end
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}'
G
bundle :install
build_git "also_has_funding", "1.1" do |s|
s.metadata = {
"funding_uri" => "https://example.com/also_has_funding/funding",
}
end
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.1")}'
G
bundle :install
expect(out).to include("1 gem you directly depend on is looking for funding")
end
it "should still display the fund URI if repo is not updated" do
build_git "also_has_funding" do |s|
s.metadata = {
"funding_uri" => "https://example.com/also_has_funding/funding",
}
end
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}'
G
bundle :install
expect(out).to include("1 gem you directly depend on is looking for funding")
bundle :install
expect(out).to include("1 gem you directly depend on is looking for funding")
end
end
end
end