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

Feature Request: Support suffix for RSpec/ContextWording #1356

Closed
okuramasafumi opened this issue Aug 5, 2022 · 0 comments · Fixed by #1358
Closed

Feature Request: Support suffix for RSpec/ContextWording #1356

okuramasafumi opened this issue Aug 5, 2022 · 0 comments · Fixed by #1358

Comments

@okuramasafumi
Copy link

https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspeccontextwording

Currently only prefix is supported for RSpec/ContextWording, but for some languages, only prefix cannot make description sound natural. I'm a native speaker of Japanese so here I'd like to take Japanese as an example.

description '#some_method' do
  # Bad
  '条件1' do
    # When condition 1 is fulfilled
  end

  # Good
  '条件1が満たされるとき' do
    # When condition 1 is fulfilled
  end
end

Here, the better context for me is the one that ends with 'とき', meaning if or when in Japanese.
In general, when rubocop-rspec supports suffix for context wording, it can help writing context in other languages than English. And in some situations, we need to write contexts in our native languages, not English. In addition, RSpec/ContextWording doesn't mean that it only supports prefix.
In English, suffix is not important in terms of context. So, the default value for suffix can be empty. With empty default value, we can benefit from restricting suffix while it doesn't effect existing users.

ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 5, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 5, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 16, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 16, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 25, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 25, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 30, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 31, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 31, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Aug 31, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Sep 1, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Sep 1, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Sep 1, 2022
ydah added a commit to ydah/rubocop-rspec that referenced this issue Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant