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

FilePath deficiencies #1701

Open
pirj opened this issue Aug 18, 2023 · 3 comments
Open

FilePath deficiencies #1701

pirj opened this issue Aug 18, 2023 · 3 comments
Labels

Comments

@pirj
Copy link
Member

pirj commented Aug 18, 2023

  1. Split RSpec/FilePath into RSpec/SpecFilePathSuffix and RSpec/SpecFilePathFormat #1698 (comment)
    Would it detect:
RSpec.describe 'MyClass' do
RSpec.describe ::MyClass do
  1. Split RSpec/FilePath into RSpec/SpecFilePathSuffix and RSpec/SpecFilePathFormat #1698 (comment) refactor to avoid nested loops?
@pirj pirj added the bug label Aug 18, 2023
@ydah
Copy link
Member

ydah commented Feb 28, 2024

In the following case, I often use rspec-request_describer to write a request spec. So in the case of String, I don't think it will necessarily match the file path. WDYT? Is there a way to know that in the case of string, it always indicates Class?

RSpec.describe 'MyClass' do

@pirj
Copy link
Member Author

pirj commented Feb 28, 2024

Why?
It could be /get_users_spec.rb as per request_descriptor naming schema, even with dynamic parts.
Or /widget_management_spec.rb if you follow the example naming from rspec-rails examples
http://rspec.info/features/6-1/rspec-rails/request-specs/request-spec/

I like it more descriptive and human-readable, with explicit URL defined in ‘def request’ or subject.
And i don’t see why the file name should not match the top-level docstring.

@ydah
Copy link
Member

ydah commented Feb 28, 2024

rspec-request_describer is a plugin for RSpec, but it is useful to use it as follows, but if you use such a plug-in, it may not be a big problem because Exclude will not change the behavior in the first place before and after the change

# `RSpec::RequestDescriber` provides `subject` from its top-level description.
# subject will be `get('/users')`.
RSpec.describe 'GET /users' do
  it 'returns 200' do
    subject
    expect(response).to have_http_status(200)
  end
end

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

No branches or pull requests

2 participants