spec/unit/support/update_webmock_data in trollolo-0.1.1 vs spec/unit/support/update_webmock_data in trollolo-0.2.0

- old
+ new

@@ -1,25 +1,23 @@ #!/usr/bin/env ruby -require "json" +require 'json' -require_relative "webmocks" +require_relative 'webmocks' -trollolo_bin = File.expand_path("../../../../bin/trollolo", __FILE__) -spec_data_dir = File.expand_path("../../../data", __FILE__) +trollolo_bin = File.expand_path('../../../../bin/trollolo', __FILE__) +spec_data_dir = File.expand_path('../../../data', __FILE__) -STDERR.puts "Updating web mock data" +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 + if json.is_a?(Hash) && json.key?('cards') + json['cards'].each do |card| + card['email'] = 'trello@example.com' if card.key?('email') end end - File.open(file, "w") do |f| + File.open(file, 'w') do |f| f.write(JSON.pretty_generate(json)) end end webmock_mapping.each do |mapping|