Sha256: c15b55162f4c36e17e9aac59ef63a171a32db297d908229eb58bb152ab3ab6d9

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

require 'spec_helper'

describe Hckr::Scraper do
  before :each do
    Hckr::Document.should_receive(:open).and_return(File.open('./spec/fixtures/page.html').read)
    @links = Hckr::Scraper.new(page: :newest).scrape!
  end

  it 'scapes the links off the page' do
    expect(@links).to be_kind_of Array
    expect(@links.first).to be_kind_of Hash
  end

  it 'link has name and href' do
    expect(@links.first[:href]).to eq "http://www.newyorker.com/reporting/2014/07/21/140721fa_fact_mnookin"
    expect(@links.first[:name]).to eq "Thanks, HN: You helped discover a disease and save lives. Sincerely, @mattmight"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hckr-0.0.1 spec/hckr/scraper_spec.rb