Sha256: 8875780e07c9f38b6b8451a6bd112fb41172fbc1f932cebbcc5f0044d94e29ea
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
require 'logger' require 'json/add/regexp' module Pact module JsonWarning def check_for_active_support_json # Active support clobbers the as_json methods defined in the json/add directory of the json gem. # These methods are required to serialize and deserialize the Regexp and Symbol classes properly. # You can potentially fix this by making sure the json gem is required AFTER the active_support/json gem # OR if you don't use the json part of activesupport you could only require the parts of active support you really need # OR you can only use strings in your pacts. # Good luck. # If someone knows how to make sure the pact gem uses the json gem as_json methods when activesupport/json is used in the calling code, # without breaking the calling code, which may depend on activesupport/json... then please fix this. # Note: we can probably do this in Ruby 2.0 with refinements, but for now, we're all stuck on 1.9 :( unless Regexp.new('').as_json.is_a?(Hash) Logger.new($stderr).warn("It appears you are using ActiveSupport json in your project. You are now in rubygems hell. Please see Pact::JsonWarning for more info.") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pact-0.1.35 | lib/pact/json_warning.rb |
pact-0.1.28 | lib/pact/json_warning.rb |