location_test.rb 702 B

1234567891011121314
  1. require 'test_helper'
  2. class LocationTest < Test::Unit::TestCase
  3. test '#inventory_levels returns all inventory_levels associated with this location' do
  4. location = ShopifyAPI::Location.new(id: 487838322)
  5. expected_body = JSON.parse(load_fixture('inventory_levels'))
  6. expected_body['inventory_levels'].delete_if {|level| level['location_id'] != location.id }
  7. fake "locations/#{location.id}/inventory_levels", method: :get, status: 200, body: JSON(expected_body).to_s
  8. inventory_levels = location.inventory_levels
  9. assert inventory_levels.all? { |item| item.location_id == location.id },
  10. message: 'Response contained locations other than the current location.'
  11. end
  12. end