Sha256: 9db0d3da544583d6da567aff5b0e22115b11a9701f02b5ae7ae070189266b046
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
require_relative './config/initializer' require_relative './spec/fixtures/test_constants' namespace :fixtures do desc 'reload fixtures from remote API' task :reload do fail 'No API key given' if RescueGroups.config.apikey == "" { RescueGroups::Animal => [TEST_ANIMAL_ID, breed: TEST_ANIMAL_BREED], RescueGroups::Organization => [TEST_ORG_ID, name: TEST_ORG_NAME], RescueGroups::Event => [TEST_EVENT_ID, name: TEST_EVENT_NAME], }.each do |klass, test_values| find_request = RescueGroups::Requests::Find.new([*test_values[0]].flatten, klass, klass.api_client) where_request = RescueGroups::Requests::Where.new(test_values[1], klass, klass.api_client, klass.search_engine_class) find_results = klass.api_client.post_and_respond(find_request.as_json).parsed_body where_results = klass.api_client.post_and_respond(where_request.as_json).parsed_body model_name = klass.to_s.split('::').last.downcase find_json_file = "#{ File.expand_path('..', __FILE__) }/spec/fixtures/#{ model_name }/find.json" where_json_file = "#{ File.expand_path('..', __FILE__) }/spec/fixtures/#{ model_name }/where.json" File.open(find_json_file, 'w') { |f| f.write(JSON(find_results)) } File.open(where_json_file, 'w') { |f| f.write(JSON(where_results)) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rescue_groups-1.2.0 | Rakefile |
rescue_groups-1.1.0 | Rakefile |
rescue_groups-1.0.0 | Rakefile |