-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add matcher for checking missing interpolation keys #22
Add matcher for checking missing interpolation keys #22
Conversation
This is a really nice addition. I think it would be good to actually include this as part of the functionality of the |
I built something similar a while ago : #15 From experience I recommend a test case which passes as long as the keys are all present, regardless of order e.g expect |
Well, actually I did in that way at the first place. So it's okay if |
@creasty interesting. I'm trying to imagine a case where you wouldn't want an interpolation key in one language even though it's used in another. I suppose if that's a legitimate use case, then yeah, an option argument seems fine to me! (Not a maintainer or owner of this repo, I just would really like to have the extra guarantee as a user of i18n-spec. :)) |
@aprescott aight, I'm gonna change it later |
@s01us Ah, sorry I might have misunderstood your advise. |
Added |
@@ -1,14 +1,32 @@ | |||
RSpec::Matchers.define :be_a_complete_translation_of do |default_locale_filepath| | |||
RSpec::Matchers.define :be_a_complete_translation_of do |default_locale_filepath, check_interpolation_key = false| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what the minimum version of Ruby is that is supported by this library, but it'd be great to use a keyword argument here of check_interpolation_key: false
. I also have a feeling that a default value of true
would be more useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using keyword argument seems to me fine tho it's, in general, difficult problem to take Ruby version up to least 2.x unnecessarily.
And about the default value, I just want this feature to fail existing specs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just dropped support for EOL'd rubies, so we can actually apply this suggestion now 👍
Quite uncertain whether @tigrish is alive... |
I'm tired of waiting. |
@creasty Are you still interested in getting this merged in? I think it would be a valuable addition! |
Wrote matcher for checking missing pairs of interpolation keys like:
'I am %{name}'
and'Soy %{nam3}'
'I am %{name}'
and'Soy name'