Perhaps it is my lack of familiarity with rspec but i do not understand what is going on with my test.
I have 2 classes one called Scrape, the other Result (creative) Scrape is a web scraping class that searches a site and scrapes the results from the page, creating a new Result instance from each.
Result instances are stored in a class variable array accessible via Result.all
this works in practice in the actual program, however when I tried to write a test for this behavior it fails.
describe "#scrape_results" do
it "accepts a url scrapes the page and creates a Result for each" do
s = Scrape.new
s.scrape_results(@url)
expect(Result.all.count).not_to eq(0)
end
end
every time i run the test Result.all.count is 0 if i use pry and manually run #scrape_results the test passes.
I appreciate your time, patience, and help thanks
Aucun commentaire:
Enregistrer un commentaire