Skip to content

Commit 18b415f

Browse files
committed
chore(parse_sitemap): renaming get_sources to parse_sitemap
1 parent 7690b6b commit 18b415f

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

lib/ingestors/concerns/sitemap_helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Concerns
66
module SitemapHelpers
77
private
88

9-
def get_sources(source_url)
9+
def parse_sitemap(source_url)
1010
case source_url.downcase
1111
when /sitemap(.*)?\.xml\Z/
1212
parse_xml_sitemap(source_url)

lib/ingestors/github_ingestor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def self.config
4141
def read(source_url)
4242
@verbose = false
4343
# Returns either a map of unique URL entries, either the URL itself
44-
sources = get_sources(source_url)
44+
sources = parse_sitemap(source_url)
4545

4646
sources.each do |url|
4747
# Reads each source, if github.{com|io}, gets the repo's api, if not, next

test/helpers/sitemap_helper_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ class SitemapHelperTest < ActionView::TestCase
66
@messages = []
77
end
88

9-
test 'get_sources with url only returns url only' do
9+
test 'parse_sitemap with url only returns url only' do
1010
url = 'https://test.com'
11-
assert_equal @ingestor.send(:get_sources, url), [url]
11+
assert_equal @ingestor.send(:parse_sitemap, url), [url]
1212
end
1313

14-
test 'get_sources returns parsed URLs from sitemap.xml' do
14+
test 'parse_sitemap returns parsed URLs from sitemap.xml' do
1515
sitemap_xml = <<~XML
1616
<?xml version="1.0" encoding="UTF-8"?>
1717
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@@ -27,11 +27,11 @@ class SitemapHelperTest < ActionView::TestCase
2727
stub_request(:get, 'https://app.com/events/sitemap.xml')
2828
.to_return(status: 200, body: sitemap_xml, headers: { 'Content-Type' => 'application/xml' })
2929

30-
urls = @ingestor.send(:get_sources, 'https://app.com/events/sitemap.xml')
30+
urls = @ingestor.send(:parse_sitemap, 'https://app.com/events/sitemap.xml')
3131
assert_equal ['https://app.com/events/123', 'https://app.com/events/456'], urls
3232
end
3333

34-
test 'get_sources returns parsed URLs from sitemap.txt' do
34+
test 'parse_sitemap returns parsed URLs from sitemap.txt' do
3535
sitemap_txt = <<~TXT
3636
https://app.com/events/123
3737
https://app.com/events/456
@@ -40,7 +40,7 @@ class SitemapHelperTest < ActionView::TestCase
4040
stub_request(:get, 'https://app.com/events/sitemap.txt')
4141
.to_return(status: 200, body: sitemap_txt, headers: { 'Content-Type' => 'txt' })
4242

43-
urls = @ingestor.send(:get_sources, 'https://app.com/events/sitemap.txt')
43+
urls = @ingestor.send(:parse_sitemap, 'https://app.com/events/sitemap.txt')
4444
assert_equal ['https://app.com/events/123', 'https://app.com/events/456'], urls
4545
end
4646

test/test_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def self.config
411411
end
412412

413413
def read(url)
414-
get_sources(url)
414+
parse_sitemap(url)
415415
open_url(url)
416416
end
417417
end

test/unit/ingestors/github_ingestor_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def materials
321321
end
322322

323323
test 'std errors when exception is raised' do
324-
@ingestor.stub(:get_sources, ->(*) { raise StandardError, 'test failure' }) do
324+
@ingestor.stub(:parse_sitemap, ->(*) { raise StandardError, 'test failure' }) do
325325
mock_logger = Minitest::Mock.new
326326
mock_logger.expect(:error, nil, ['StandardError: read() failed, test failure'])
327327

0 commit comments

Comments
 (0)