Skip to content

Commit

Permalink
fix(parse_uri): handle non-absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
gildesmarais committed Nov 4, 2018
1 parent e1bedae commit 9215025
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/html2rss/item_extractor.rb
Expand Up @@ -11,7 +11,7 @@ module ItemExtractor
uri = URI(href)
else
uri = URI(options['channel']['url'])
uri.path = path
uri.path = path.start_with?('/') ? path : "/#{path}"
uri.query = query
end

Expand Down
2 changes: 1 addition & 1 deletion spec/config.test.yml
Expand Up @@ -30,7 +30,7 @@ feeds:
name: substring
start: 1
link:
selector: '.release-header a'
selector: '.release-header .text-normal a'
extractor: 'href'
post_process:
name: 'parse_uri'
Expand Down
14 changes: 7 additions & 7 deletions spec/html2rss_spec.rb
Expand Up @@ -42,14 +42,14 @@
expect(xml.css('channel > title').text).to eq 'Nuxt.js Github Releases'
end

it 'sets the link' do
expect(xml.css('channel > link').text).to be_a(String)
end
describe 'channel.link' do
it 'sets it to the feed-configs channel url' do
expect(xml.css('channel > link').text).to eq 'https://github.com/nuxt/nuxt.js/releases'
end

it 'sets a URI::HTTP parsable link' do
expect(
URI(xml.css('channel > link').text)
).to be_a(URI::HTTP)
it 'is parseable by URI::HTTP' do
expect(URI(xml.css('channel > link').text)).to be_a(URI::HTTP)
end
end

it 'sets a description' do
Expand Down

0 comments on commit 9215025

Please sign in to comment.