|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
module Docs
|
|
|
|
|
class Meteor < UrlScraper
|
|
|
|
|
include StubRootPage
|
|
|
|
|
|
|
|
|
|
self.type = 'meteor'
|
|
|
|
|
self.version = '1.1.0'
|
|
|
|
|
self.base_url = 'http://docs.meteor.com'
|
|
|
|
@ -21,27 +23,7 @@ module Docs
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def request_one(url)
|
|
|
|
|
stub_root_page if url == root_url.to_s
|
|
|
|
|
super
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def request_all(urls, &block)
|
|
|
|
|
stub_root_page
|
|
|
|
|
super
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def stub_root_page
|
|
|
|
|
response = Typhoeus::Response.new(
|
|
|
|
|
effective_url: root_url.to_s,
|
|
|
|
|
code: 200,
|
|
|
|
|
headers: { 'Content-Type' => 'text/html' },
|
|
|
|
|
body: get_root_page_body)
|
|
|
|
|
|
|
|
|
|
Typhoeus.stub(root_url.to_s).and_return(response)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_root_page_body
|
|
|
|
|
def root_page_body
|
|
|
|
|
require 'capybara'
|
|
|
|
|
Capybara.current_driver = :selenium
|
|
|
|
|
Capybara.visit(root_url.to_s)
|
|
|
|
|