Sha256: f8077778c30081bac516aaf2ae76f51a6866141e54cdd409acddc8a8914bf376

Contents?: true

Size: 731 Bytes

Versions: 2

Compression:

Stored size: 731 Bytes

Contents

require 'spec_helper'

describe HttpReader::BasePageParser do
  subject { described_class }

  let(:pattern) { /^((http|https):\/\/).*$/ }

  context 'self' do
    it '#pattern cover every url' do
      expect(subject.pattern).to eq pattern
    end

    context '#match' do
      it 'returns true for url string' do
        expect(subject.match('http://some_url')).to eq true
      end

      it 'returns false for non url string' do
        expect(subject.match('some_fake_url')).to eq false
      end
    end

    context '#parse' do
      let(:body) { 'test_body' }
      let(:response) { double('response', body: body) }
      it 'returns body' do
        expect(subject.parse(response)).to eq body
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
http_reader-0.0.2 spec/unit/lib/http_reader/base_page_parser_spec.rb
http_reader-0.0.1 spec/unit/lib/http_reader/base_page_parser_spec.rb