Sha256: f7df924b9c6db1503813d65172a57b0a293a2232669d5918634746e5f571caa4
Contents?: true
Size: 850 Bytes
Versions: 2
Compression:
Stored size: 850 Bytes
Contents
require 'rspec' RSpec.shared_context "example Page" do let(:code) { 200 } let(:msg) { 'OK' } let(:content_type) { 'text/html' } let(:headers) { {} } let(:body) { '' } let(:response) do Net::HTTPResponse.new('1.1', code.to_s, msg).tap do |response| response.set_content_type(content_type) if content_type headers.each do |name,values| if values Array(values).each do |value| response.add_field(name,value) end else response.remove_field(name) end end # stub #body, otherwise Net::HTTP will check @socket allow(response).to receive(:body).and_return(body) end end let(:host) { 'example.com' } let(:url) { URI::HTTP.build(host: host) } subject { described_class.new(url,response) } end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spidr-0.6.1 | spec/example_page.rb |
spidr-0.6.0 | spec/example_page.rb |