spec/git_trend/scraper_spec.rb in git-trend-0.1.0 vs spec/git_trend/scraper_spec.rb in git-trend-0.1.1

- old
+ new

@@ -14,15 +14,23 @@ its(:proxy_pass) { should eq 'proxy_pass' } its(:proxy_port) { should eq 9999 } end describe '#get' do + before { @scraper = Scraper.new } context 'when a network error occurred' do before do - @scraper = Scraper.new stub_request(:get, Scraper::BASE_URL) .to_return(status: 500, body: '[]') end it { expect { @scraper.get }.to raise_error(Exception) } + end + + context 'when a scraping error occurred' do + before do + stub_request(:get, Scraper::BASE_URL) + .to_return(status: 200, headers: { content_type: 'text/html' }, body: '') + end + it { expect { @scraper.get }.to raise_error(ScrapeException) } end end end