corincerami / mars-photo-api

A Rails API for photo data from NASA's Mars Rovers
https://api.nasa.gov/#MarsPhotos
GNU General Public License v3.0
358 stars 48 forks source link

PerseveranceScraper test failing #146

Closed mtilda closed 1 year ago

mtilda commented 3 years ago

PerseveranceScraper.scrape should create photo objects currently fails. The RSpec output is below:

$ bundle exec rspec

Randomized with seed 50175
F......................................................

Failures:

  1) PerseveranceScraper.scrape should create photo objects
     Failure/Error: expect{ scraper.scrape }.to change { Photo.count }.by(205)
       expected `Photo.count` to have changed by 205, but was changed by 34
     # ./spec/models/perseverance_scraper_spec.rb:41:in `block (3 levels) in <top (required)>'

Finished in 2.15 seconds (files took 1.56 seconds to load)
55 examples, 1 failure

Failed examples:

rspec ./spec/models/perseverance_scraper_spec.rb:38 # PerseveranceScraper.scrape should create photo objects

Randomized with seed 50175

Coverage report generated for RSpec to /home/mxkay/Projects/MarsPhotoAPI/mars-photo-api/coverage. 243 / 245 LOC (99.18%) covered.

At a glance, it actually looks like the test is incorrect. It scrapes photos from sol 1, which can be found here: https://mars.nasa.gov/rss/api/?feed=raw_images&category=mars2020&feedtype=json&sol=1

The json at that address contains 34 photo. I'm not sure why the test expects the photo count to change by 205.