Sha256: 07b48e461ce7b40050bef548dd51e5ebbb3f927843060c41054320e40e89a55d

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe BikePOA::HttpClient do
  describe 'fetch' do
    context 'when no URI is set in the config' do
      before :each do
        BikePOA.configure do |c|
          c['bikepoa:uri'] = nil
        end
      end

      let(:default_uri) { 'http://ww2.mobilicidade.com.br/bikepoa/mapaestacao.asp' }
      let(:content)     { 'pretend this is a content' }

      it 'tries do download station map from bikepoa website' do
        FakeWeb.register_uri(:get, default_uri, body: content)
        subject.fetch.should == content
      end
    end

    context 'when an URI is set in config' do
      before :each do
        BikePOA.configure do |c|
          c['bikepoa:uri'] = pretend_uri
        end
      end
      let(:pretend_uri) { 'http://pretend-uri.example.com' }
      let(:content)     { 'pretend this is another content' }

      it 'tries do download spreadsheet from the configged URI' do
        FakeWeb.register_uri(:get, pretend_uri, body: content)
        subject.fetch.should == content
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bikepoa-tools-0.4.0 spec/http_client_spec.rb
bikepoa-tools-0.3.1 spec/http_client_spec.rb
bikepoa-tools-0.3.0 spec/http_client_spec.rb
bikepoa-tools-0.2.0 spec/http_client_spec.rb
bikepoa-tools-0.1.0 spec/http_client_spec.rb