Sha256: 877669f318d1fc388c151cff834d56b6edf2d7a06a9cae22616e0379261c09dc

Contents?: true

Size: 893 Bytes

Versions: 3

Compression:

Stored size: 893 Bytes

Contents

require 'spec_helper'
require "scrapers/nasa_apod"

module Scrapers

  describe NasaApod do
    it {Scrapers::NasaApod.should respond_to :scrape}

    context "scrape" do

      before(:all) do
        @url = "http://apod.nasa.gov/apod/astropix.html"
        VCR.use_cassette("nasa-apod", :record => :new_episodes) do
          @apod_hash = Scrapers::NasaApod.scrape(@url)
        end
      end

      it "should be a Hash" do
        @apod_hash.should be_a(Hash)
      end

      %w{title link description pubDate guid content_encoded}.map(&:to_sym).each do |attr|
        it "should include #{attr}" do
          @apod_hash.keys.should include attr
        end
        it "#{attr} should not be nil" do
          @apod_hash[attr].should_not be_nil
        end

        it "#{attr} should be a Sring" do
          @apod_hash[attr].should be_a(String)
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scrapers-3.2.0 spec/scrapers/nasa_apod_spec.rb
scrapers-3.1.0 spec/scrapers/nasa_apod_spec.rb
scrapers-3.0.0 spec/scrapers/nasa_apod_spec.rb