Last active
September 8, 2016 03:21
-
-
Save lizdenhup/894e66bdf02327c3d84cd7e8f723c460 to your computer and use it in GitHub Desktop.
My first RSpec test suite <3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
RSpec.describe WikinewsScraper::Article do | |
# If the fixtures are deleted or VCR generates new cassettes these tests | |
# will have to be updated based on current values from: | |
# https://en.wikinews.org/wiki/Main_Page as well as one of the articles linked | |
# from the day's headlines. | |
describe '#scrape_articles' do | |
it 'scrapes the main page of Wikinews' do | |
VCR.use_cassette("main_page") do | |
expect(WikinewsScraper::Scraper.new.scrape_articles.first.title).to eq("Candidates suspend campaigns as Hong Kong legislative election approaches") | |
end | |
end | |
end | |
describe "#expand_article" do | |
it 'scrapes an individual article from Wikinews' do | |
VCR.use_cassette("candidates_suspend_campaigns_Hong_Kong") do | |
expect(WikinewsScraper::Scraper.new.expand_article('1')).to start_with("Saturday, September 3, 2016 As the Hong Kong legislative election approaches, six candidates considered") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment