# 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