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
Fix problem to catch NoMethodError from non receiver object #12
Conversation
from non receiver object
@le0pard Wow, that's not a use case I foresaw, that the receiver would implement the method but return NoMethodError on purpose ;) Thanks for the fix! Unfortunately it breaks all the 1.8.x builds. I'll investigate a bit, but feel free to also fix in the meantime for 1.8.x if you get to it first. As soon as fixed for 1.8.x, I'll merge and do a release. |
Ah, ok, I see the issue. I'll just go ahead and merge this, and then layer a more complete fix on top of it. |
@ms-ati One moment, almost done :) |
@le0pard ok, sure, no problem 👍 |
@le0pard Oops, you have to use mime-type 1.25 on Ruby 1.8.x, do you want to do another conditional on that version? |
@le0pard do you want to try: if @__receiver__.respond_to?(method.to_sym) Also, pretty please, could we have a test that fails without this fix? |
@le0pard ok, everything passes on 1.8.7 on my end with that one. May I suggest that you add a spec (since you already changed the format of all of them!) which simply sets up the analogous situation: the fallback object calls a non-existent method, such as If you don't want to add it, that's fine -- I can just add this spec after merging -- let me know. |
One moment, will add such spec. |
Perhaps change the gemspec section to something like: if defined?(RUBY_ENGINE) && 'rbx' == RUBY_ENGINE
s.add_development_dependency 'rubysl'
s.add_development_dependency 'rubinius-coverage'
end
if !(defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
# Github flavored markdown in YARD documentation
# http://blog.nikosd.com/2011/11/github-flavored-markdown-in-yard.html
s.add_development_dependency 'yard'
s.add_development_dependency 'redcarpet', '2.3.0' # because 1.8
s.add_development_dependency 'github-markup'
end |
Or let me know if you'd prefer that I do it, that's fine too. |
Fixed. Just need wait for travis :) |
Excellent job, thanks so much for chasing this down and getting it fixed! I'll merge and do a release. |
@le0pard do you want to fix Rubinius now, or have you had enough for today? ;) |
@ms-ati give me a moment :) |
Is it this: rubinius/rubinius#2794 or travis-ci/travis-ci#1641? It looks like you just need to change |
Great. Last bit: in your new spec, you need the string to be a regex with |
@le0pard Here's how to match an exception in RSpec using regex: https://www.relishapp.com/rspec/rspec-expectations/v/2-6/docs/built-in-matchers/raise-error-matcher#expect-specific-error-message-using-a-regular-expression |
Finally! 🍻 |
Cheers man, I'll buy you a beer when you're next in Boston ;) |
Fix problem to catch NoMethodError from non receiver object
Released v1.1.3 with your fix! |
Problem case: follmann/middleman-favicon-maker#22 (comment)