Sha256: 932febb9daaf3537bb5f867686d67236b34c6c7953101d9de855a22ad932eb88
Contents?: true
Size: 819 Bytes
Versions: 4
Compression:
Stored size: 819 Bytes
Contents
#!/usr/bin/env ruby require "json" require_relative "webmocks" trollolo_bin = File.expand_path("../../../../bin/trollolo", __FILE__) spec_data_dir = File.expand_path("../../../data", __FILE__) STDERR.puts "Updating web mock data" def scrub_file(file) json = JSON.parse(File.read(file)) if json.is_a?(Hash) && json.has_key?("cards") json["cards"].each do |card| if card.has_key?("email") card["email"] = "trello@example.com" end end end File.open(file, "w") do |f| f.write(JSON.pretty_generate(json)) end end webmock_mapping.each do |mapping| url = mapping[:path] + parameters_as_string(mapping) filename = mapping[:file] file = File.join(spec_data_dir, filename) cmd = "#{trollolo_bin} get-raw '#{url}' >#{file}" puts cmd system cmd scrub_file(file) end
Version data entries
4 entries across 4 versions & 1 rubygems