spec/git_trend/scraper_spec.rb in git-trend-1.0.1 vs spec/git_trend/scraper_spec.rb in git-trend-1.0.2

- old
+ new

@@ -1,17 +1,26 @@ +include GitTrend RSpec.describe GitTrend::Scraper do let(:scraper) { Scraper.new } describe 'settings' do before do - allow(ENV).to receive(:[]).with('http_proxy').and_return('http://proxy_user:proxy_pass@192.168.1.99:9999') + allow(ENV).to receive(:[]).with('http_proxy').and_return("http://#{proxy_user}:#{proxy_pass}@#{proxy_addr}:#{proxy_port}") end + let(:proxy_addr) { '192.168.1.99' } + let(:proxy_port) { 9999 } + let(:proxy_user) { 'proxy_user' } + let(:proxy_pass) { 'proxy_pass' } subject { scraper.instance_variable_get(:@agent) } - its(:user_agent) { should eq "git-trend #{VERSION}" } - its(:proxy_addr) { should eq '192.168.1.99' } - its(:proxy_user) { should eq 'proxy_user' } - its(:proxy_pass) { should eq 'proxy_pass' } - its(:proxy_port) { should eq 9999 } + it 'should use proxy settings of ENV' do + aggregate_failures do + expect(subject.proxy_addr).to eq proxy_addr + expect(subject.proxy_user).to eq proxy_user + expect(subject.proxy_pass).to eq proxy_pass + expect(subject.proxy_port).to eq proxy_port + expect(subject.user_agent).to eq "git-trend #{VERSION}" + end + end end describe '#get' do context 'when a network error occurred' do before do