@@ -116,6 +116,86 @@ def test_execute_details
116116 This is a lot of text. This is a lot of text. This is a lot of text.
117117 This is a lot of text.
118118
119+ pl (1)
120+ Platform: i386-linux
121+ Author: A User
122+ Homepage: http://example.com
123+
124+ this is a summary
125+ EOF
126+
127+ assert_equal expected , @ui . output
128+ assert_equal '' , @ui . error
129+ end
130+
131+ def test_execute_details_cleans_text
132+ spec_fetcher do |fetcher |
133+ fetcher . spec 'a' , 2 do |s |
134+ s . summary = 'This is a lot of text. ' * 4
135+ s . authors = [ "Abraham Lincoln \x01 " , "\x02 Hirohito" ]
136+ s . homepage = "http://a.example.com/\x03 "
137+ end
138+
139+ fetcher . legacy_platform
140+ end
141+
142+ @cmd . handle_options %w[ -r -d ]
143+
144+ use_ui @ui do
145+ @cmd . execute
146+ end
147+
148+ expected = <<-EOF
149+
150+ *** REMOTE GEMS ***
151+
152+ a (2)
153+ Authors: Abraham Lincoln ., . Hirohito
154+ Homepage: http://a.example.com/.
155+
156+ This is a lot of text. This is a lot of text. This is a lot of text.
157+ This is a lot of text.
158+
159+ pl (1)
160+ Platform: i386-linux
161+ Author: A User
162+ Homepage: http://example.com
163+
164+ this is a summary
165+ EOF
166+
167+ assert_equal expected , @ui . output
168+ assert_equal '' , @ui . error
169+ end
170+
171+ def test_execute_details_truncates_summary
172+ spec_fetcher do |fetcher |
173+ fetcher . spec 'a' , 2 do |s |
174+ s . summary = 'This is a lot of text. ' * 10_000
175+ s . authors = [ "Abraham Lincoln \x01 " , "\x02 Hirohito" ]
176+ s . homepage = "http://a.example.com/\x03 "
177+ end
178+
179+ fetcher . legacy_platform
180+ end
181+
182+ @cmd . handle_options %w[ -r -d ]
183+
184+ use_ui @ui do
185+ @cmd . execute
186+ end
187+
188+ expected = <<-EOF
189+
190+ *** REMOTE GEMS ***
191+
192+ a (2)
193+ Authors: Abraham Lincoln ., . Hirohito
194+ Homepage: http://a.example.com/.
195+
196+ Truncating the summary for a-2 to 100,000 characters:
197+ #{ " This is a lot of text. This is a lot of text. This is a lot of text.\n " * 1449 } This is a lot of te
198+
119199pl (1)
120200 Platform: i386-linux
121201 Author: A User
0 commit comments