Skip to content

Commit dd74334

Browse files
committed
chore(parse_sitemap): renaming get_sources to parse_sitemap
1 parent b9baf3d commit dd74334

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

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/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)