Sha256: b4361fdd3c54b290d12ec6eab2c3ea7f877dcc6abc7dadfd5e22b4b6f28e31ca
Contents?: true
Size: 721 Bytes
Versions: 38
Compression:
Stored size: 721 Bytes
Contents
describe Spotlight::Resources::Web, type: :model do class TestResource < Spotlight::Resource include Spotlight::Resources::Web end subject { TestResource.new } 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
38 entries across 38 versions & 1 rubygems