Sha256: 45d22bfa3cdf26f2048868469c634e8a13d59aabbc9bc3d01a42de4e5f30a86a
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
require "spec_helper" RSpec.describe Pokeedex::Pokemon::Scrapper::Fetchers::Base do let(:url) { "https://www.example.com" } let(:fetcher) { described_class.new(url: url) } describe "#initialize" do it "sets the url" do expect(fetcher.url).to eq(url) end end describe "#content" do context "when the content is fetched successfully" do let(:content) { file_fixture("pokemon_com/responses/GET-200-bulbasaur.html") } before do allow(fetcher).to receive(:content).and_return(content) end it "returns the content" do expect(fetcher.content).to eq(content) end end context "when the content is not fetched successfully" do before do allow(fetcher).to receive(:browser).and_raise(Playwright::Error.new(message: "An error occurred")) end it "raises an Pokeedex::Exceptions::ScrapperError exception" do expect { fetcher.content }.to raise_error(Pokeedex::Exceptions::ScrapperError) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pokeedex-0.1.5 | spec/pokeedex/pokemon/scrapper/fetchers/base_spec.rb |
pokeedex-0.1.0 | spec/pokeedex/pokemon/scrapper/fetchers/base_spec.rb |