Sha256: 43cd6531f208e637c960a9fe6779911b67f27a75ea5c375aaf17ecb266b92470
Contents?: true
Size: 751 Bytes
Versions: 18
Compression:
Stored size: 751 Bytes
Contents
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 'caches the body and headers in the data' do allow(described_class).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 'returns the body DOM' do allow(described_class).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
18 entries across 18 versions & 1 rubygems