Sha256: 780b37477cbe526a7f0e746635741ce7dc61b76f79251f8103cc2be4f4f13b68
Contents?: true
Size: 806 Bytes
Versions: 4
Compression:
Stored size: 806 Bytes
Contents
require 'spec_helper' describe Spotlight::Resources::Web, :type => :model do class TestResource < Spotlight::Resource include Spotlight::Resources::Web end subject { TestResource.new } describe ".fetch" do end describe "#harvest!" do it "should cache the body and headers in the data" do allow(Spotlight::Resources::Web).to receive_messages(fetch: double(body: "xyz", headers: {a: 1})) subject.harvest! expect(subject.data[:body]).to eq "xyz" expect(subject.data[:headers]).to eq a: 1 end end describe "#body" do it "should return the body DOM" do allow(Spotlight::Resources::Web).to receive_messages(fetch: double(body: "<html />", headers: {a: 1})) expect(subject.body).to be_a_kind_of(Nokogiri::HTML::Document) end end end
Version data entries
4 entries across 4 versions & 1 rubygems