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

Replace should-example with expect-example #899

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/rubocop/cop/rspec/named_subject.rb
Expand Up @@ -6,11 +6,11 @@ module RSpec
# Checks for explicitly referenced test subjects.
#
# RSpec lets you declare an "implicit subject" using `subject { ... }`
# which allows for tests like `it { should be_valid }`. If you need to
# reference your test subject you should explicitly name it using
# `subject(:your_subject_name) { ... }`. Your test subjects should be
# the most important object in your tests so they deserve a descriptive
# name.
# which allows for tests like `it { is_expected.to be_valid }`.
# If you need to reference your test subject you should explicitly
# name it using `subject(:your_subject_name) { ... }`. Your test subjects
# should be the most important object in your tests so they deserve
# a descriptive name.
#
# This cop can be configured in your configuration using the
# `IgnoreSharedExamples` which will not report offenses for implicit
Expand Down Expand Up @@ -39,7 +39,7 @@ module RSpec
# RSpec.describe Foo do
# subject(:user) { described_class.new }
#
# it { should be_valid }
# it { is_expected.to be_valid }
# end
class NamedSubject < Cop
MSG = 'Name your test subject if you need '\
Expand Down
12 changes: 6 additions & 6 deletions manual/cops_rspec.md
Expand Up @@ -2120,11 +2120,11 @@ Enabled | No
Checks for explicitly referenced test subjects.

RSpec lets you declare an "implicit subject" using `subject { ... }`
which allows for tests like `it { should be_valid }`. If you need to
reference your test subject you should explicitly name it using
`subject(:your_subject_name) { ... }`. Your test subjects should be
the most important object in your tests so they deserve a descriptive
name.
which allows for tests like `it { is_expected.to be_valid }`.
If you need to reference your test subject you should explicitly
name it using `subject(:your_subject_name) { ... }`. Your test subjects
should be the most important object in your tests so they deserve
a descriptive name.

This cop can be configured in your configuration using the
`IgnoreSharedExamples` which will not report offenses for implicit
Expand Down Expand Up @@ -2155,7 +2155,7 @@ end
RSpec.describe Foo do
subject(:user) { described_class.new }

it { should be_valid }
it { is_expected.to be_valid }
end
```

Expand Down