ghempton / camcorder

VCR not enough? Record arbitrary method invocations for later playback.
MIT License
86 stars 10 forks source link

FYI, you may have to re-record cassettes with psych 2.1.0+ #13

Open jrafanie opened 6 years ago

jrafanie commented 6 years ago

For future people including me, if you get a Camcorder::ProxyPlaybackError because it can't find a recording, it could be due to psych changes.

Because camcorder uses yaml to dump the args for each method call, if you upgrade to newer versions of psych that change the format (even slightly), you may have to rerecord your cassettes:

https://github.com/ghempton/camcorder/blob/f2591cf7c40c570b312c48f06769a4e6ee5fe4c6/lib/camcorder/proxy.rb#L28-L30

For example, psych 2.0.17 to 2.1.0 introduced this change.

irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> Psych::VERSION
=> "2.0.17"
irb(main):003:0> YAML.dump "078123423"
=> "--- 078123423\n...\n"
irb(main):004:0> require 'digest'
=> true
irb(main):005:0> Digest::MD5.hexdigest(YAML.dump("078123423"))
=> "9ad7bbd6de568e136bf7f30105dcbb8d"
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> Psych::VERSION
=> "2.1.0"
irb(main):003:0> YAML.dump "078123423"
=> "--- '078123423'\n"
irb(main):004:0> require 'digest'
=> true
irb(main):005:0> Digest::MD5.hexdigest(YAML.dump("078123423"))
=> "884af5b4d3e7878a214262fca58a9ae6"

See also: https://github.com/ManageIQ/manageiq-gems-pending/pull/344