Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider supporting conversion of matcher protocol #30

Closed
yujinakayama opened this issue Dec 4, 2013 · 2 comments
Closed

Consider supporting conversion of matcher protocol #30

yujinakayama opened this issue Dec 4, 2013 · 2 comments

Comments

@yujinakayama
Copy link
Owner

rspec/rspec-expectations#270
rspec/rspec-expectations#373
rspec/rspec-expectations#375

@myronmarston
Copy link

If you're going to do anything here, I think transpec should focus only on updating uses of the custom matcher DSL, e.g. changing from this:

RSpec::Matchers.define :be_awesome do
  match_for_should { }
  match_for_should_not { }
  failure_message_for_should { }
  failure_message_for_should_not { }
end

...to this:

RSpec::Matchers.define :be_awesome do
  match { }
  match_when_negated { }
  failure_message { }
  failure_message_when_negated { }
end

For the case of a custom matcher being defined using a standard ruby class (as is the case in a gem like shoulda), I don't think transpec needs to do anything: they'll almost certainly want to support RSpec 2.x and 3.x (which is trivial: simply use aliases to support both forms of the protocol).

Note that the old protocol isn't removed from RSpec 3. It's simply deprecated (and the new protocol isn't even available in 2.99). We did that, rather than the typical "deprecate in 2.99, remove in 3.0" route, because one of the most common places where custom matchers show up is in extension gems, and we don't want people to not be able to upgrade because an extension gem they use (like shoulda) uses the old protocol. So we're having a longer period of deprecation with the plan to remove support for the old protocol in 4.0.

@yujinakayama
Copy link
Owner Author

Thanks. I'll try in accordance with your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants