Sha256: e69e37e4ad66d425583ecfe25cc8d163c5397e57d834a6fd885af90660911b02

Contents?: true

Size: 1.22 KB

Versions: 16

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

module Scrapers

  describe Sinfest do
    it{should respond_to :scrape}
    context "scraping" do
      before(:all) do
        @comic = VCR.use_cassette('sinfest') do
          Scrapers::Sinfest.scrape
        end
      end
      
      it "retrieves a comic" do
        @comic.should_not be_nil
      end
      it "should be a Hash" do
        @comic.should be_a(Hash)
      end
      %w{title url pubdate img_src}.map(&:to_sym).each do |key|
        it "should have key #{key}" do
          @comic.should have_key(key)
        end
      end
      context "title" do
        it{@comic[:title].should_not be_empty}
        it{@comic[:title].should match /Nails/}
      end
      context "url" do
        it{@comic[:url].should_not be_empty}
        it{@comic[:url].should match /http:\/\/sinfest.net/}
      end
      context "pubdate" do
        it{@comic[:pubdate].should_not be_empty}
        it{Date.parse(@comic[:pubdate]).should be_a(Date)}
      end
      context "img_src" do
        it{@comic[:img_src].should_not be_empty}
        it{URI.parse(@comic[:img_src]).should be_a(URI::HTTP)}
        it{@comic[:img_src].should eq 'http://sinfest.net/comikaze/comics/2013-10-19.gif'}
      end
      
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
scrapers-2.1.0 spec/scrapers/sinfest_spec.rb
scrapers-2.0.2 spec/scrapers/sinfest_spec.rb
scrapers-2.0.1 spec/scrapers/sinfest_spec.rb
scrapers-2.0.0 spec/scrapers/sinfest_spec.rb
scrapers-1.5.6 spec/scrapers/sinfest_spec.rb
scrapers-1.5.5 spec/scrapers/sinfest_spec.rb
scrapers-1.5.4 spec/scrapers/sinfest_spec.rb
scrapers-1.5.3 spec/scrapers/sinfest_spec.rb
scrapers-1.5.2 spec/scrapers/sinfest_spec.rb
scrapers-1.5.1 spec/scrapers/sinfest_spec.rb
scrapers-1.5.0 spec/scrapers/sinfest_spec.rb
scrapers-1.4.0 spec/scrapers/sinfest_spec.rb
scrapers-1.3.0 spec/scrapers/sinfest_spec.rb
scrapers-1.2.0 spec/scrapers/sinfest_spec.rb
scrapers-1.1.0 spec/scrapers/sinfest_spec.rb
scrapers-1.0.0 spec/scrapers/sinfest_spec.rb