Skip to content

Commit

Permalink
Add unpublished events to the scraper page to have their previews
Browse files Browse the repository at this point in the history
  • Loading branch information
octopusinvitro committed Apr 20, 2017
1 parent 8aa9a73 commit ebcdd60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,5 +284,7 @@
@places = mapit.places_of_type('FED') + mapit.places_of_type('SEN') + mapit.places_of_type('STA')
finder = Document::Finder.new(pattern: posts_pattern, baseurl: '/blog/')
@posts = finder.find_unpublished
finder = Document::Finder.new(pattern: events_pattern, baseurl: '/events/')
@events = finder.find_unpublished
erb :scraper_start_page, layout: false
end
3 changes: 2 additions & 1 deletion tests/web/unlinked_pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@
subject.xpath('//a[contains(@href, "/places/")]').count.must_equal(fed + sen + sta)
end

it 'scrapes unlinked post pages' do
it 'scrapes unlinked documents (post events and info pages)' do
unpublished = '---
published: false
---'
Dir.stub :glob, [new_tempfile(unpublished)] do
get '/scraper-start-page.html'
refute_empty(subject.xpath('//a[contains(text(), "Unlinked post")]'))
refute_empty(subject.xpath('//a[contains(text(), "Unlinked event")]'))
end
end
end
Expand Down
5 changes: 5 additions & 0 deletions views/scraper_start_page.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@
<% @posts.each do |post| %>
<p><a href="<%= post.url %>">Unlinked post - <%= post.title %></a></p>
<% end %>

<% @events.each do |event| %>
<p><a href="<%= event.url %>">Unlinked event - <%= event.title %></a></p>
<% end %>

0 comments on commit ebcdd60

Please sign in to comment.