mbklein / equivalent-xml

Easy equivalency tests for Nokogiri and Oga XML
MIT License
94 stars 29 forks source link

changed rspec method names to remove deprecation warnings #19

Closed barelyknown closed 10 years ago

barelyknown commented 10 years ago

This fixes these deprecation warnings:

Deprecation Warnings:

`failure_message_for_should_not` is deprecated. Use `failure_message_when_negated` instead. Called from /Users/seandevine/Projects/federatedfreightways/equivalent-xml/lib/equivalent-xml/rspec_matchers.rb:57:in `block in <module:RSpecMatchers>'.

`failure_message_for_should` is deprecated. Use `failure_message` instead. Called from /Users/seandevine/Projects/federatedfreightways/equivalent-xml/lib/equivalent-xml/rspec_matchers.rb:53:in `block in <module:RSpecMatchers>'.
Eric-Guo commented 10 years ago

just I want to commit :smile:

mbklein commented 10 years ago

@barelyknown Thanks for the PR! I would like equivalent-xml's matchers to continue to work with RSpec 2.x, though, so I won't be able to pull and release this change until I get a chance to make a backward-compatible fix. If you come up with one in the meantime and add it to this PR, I'd be happy to pull at that point.

dpehrson commented 10 years ago

Just wanted to pop in here and say I just saw this in my RSpec 3 project when I added the lib.

DanielHeath commented 10 years ago

Fair point - would it make sense to detect the rspec version & use the right method? Otherwise, once they are deprecated equivalent-xml will be broken for users running recent versions.

barelyknown commented 10 years ago

I aliased the old style Rspec methods to the new ones to preserve backwards compatability.

DanielHeath commented 10 years ago

That could cause some very confusing errors for those trying to upgrade (tests pass if equivalent-xml matchers is loaded & fail with an unrelated message otherwise)...

mbklein commented 10 years ago

Yeah, I don't think I'm comfortable reaching into rspec and mucking with its methods. I have an idea on a good middle ground for this; I just need the time to implement it.

mbklein commented 10 years ago

I fixed the deprecation warnings in a backward-compatible, non-invasive way with #23. Thanks for your help and input, everyone!