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

Version Path
blacklight-spotlight-0.28.3 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.28.2 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.28.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.28.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.27.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.26.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.26.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.25.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.24.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.23.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.22.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.21.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.20.3 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.20.2 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.20.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.20.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.19.2 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.19.1 spec/models/spotlight/resources/web_spec.rb