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

Version Path
blacklight-spotlight-1.4.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-1.3.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-1.2.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-1.1.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-1.0.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.34.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.34.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.33.3 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.33.2 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.33.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.33.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.32.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.31.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.30.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.29.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-0.29.0 spec/models/spotlight/resources/web_spec.rb