Skip to content
New issue

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

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

Already on GitHub? # to your account

Require rails_helper instead of spec_helper on rspec #115

Merged
merged 1 commit into from
Oct 28, 2021

Conversation

tricknotes
Copy link
Contributor

rails_helper is an actual entry point of specs.
This change allows developers to running single spec like the following:

$ bundle exec rspec spec/models/letter_opener_web/letter_spec.rb

Without this change, the following error will be occurred:

$ bundle exec rspec spec/models/letter_opener_web/letter_spec.rb

An error occurred while loading ./spec/models/letter_opener_web/letter_spec.rb.
Failure/Error:
  RSpec.describe LetterOpenerWeb::Letter do
    let(:location) { Pathname.new(__dir__).join('..', '..', 'tmp').cleanpath }

...

NameError:
  uninitialized constant LetterOpenerWeb::Letter

rails_helper is an actual entry point of specs.
This change allows developers to running single spec like the following:
```
$ bundle exec rspec spec/models/letter_opener_web/letter_spec.rb
```

Without this change, the following error will be occurred:
```
$ bundle exec rspec spec/models/letter_opener_web/letter_spec.rb

An error occurred while loading ./spec/models/letter_opener_web/letter_spec.rb.
Failure/Error:
  RSpec.describe LetterOpenerWeb::Letter do
    let(:location) { Pathname.new(__dir__).join('..', '..', 'tmp').cleanpath }

...

NameError:
  uninitialized constant LetterOpenerWeb::Letter
```
@fgrehm
Copy link
Owner

fgrehm commented Oct 28, 2021

Thank you!

@fgrehm fgrehm merged commit c19a7f4 into fgrehm:master Oct 28, 2021
@tricknotes tricknotes deleted the require-rails-helper branch October 28, 2021 02:38
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants