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-2.4.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.4.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.3.3 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.3.2 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.3.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.3.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.2.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.2.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.1.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.2 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.0 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.0.rc6 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.0.rc5 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.0.rc4 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.0.rc3 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.0.rc2 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-2.0.0.rc1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-1.5.1 spec/models/spotlight/resources/web_spec.rb
blacklight-spotlight-1.4.1 spec/models/spotlight/resources/web_spec.rb