Sha256: 94114cc953d5e446fdadf5678c05a23502ce3d70368ef673d427e3f24f3c48dd

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

= RSpec/Extra

== RSpec/Extra/BeEmpty

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Yes
| Yes
| <<next>>
| -
|===

Prefer using `be_empty` when checking for an empty array.

=== Examples

[source,ruby]
----
# bad
expect(array.empty?).to be true
expect(array.empty?).to be_truthy
expect(array.size).to eq(0)
expect(array.length).to eq(0)
expect(array.count).to eq(0)
expect(array).to eql([])
expect(array).to contain_exactly
expect(array).to match_array([])

# good
expect(array).to be_empty
----

=== References

* https://www.rubydoc.info/gems/rubocop-rspec-extra/RuboCop/Cop/RSpec/Extra/BeEmpty

== RSpec/Extra/RestrictBlockTag

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Disabled
| Yes
| No
| <<next>>
| -
|===

Restrict to only allowed block tags.

=== Examples

==== AllowTags: ['foo', 'bar']

[source,ruby]
----
# bad
RSpec.describe 'Something', :baz do
end

# bad
RSpec.describe 'Something' do
  context 'when something', baz: :foo do
  end
end

# good
RSpec.describe 'Something', :foo do
end

# good
RSpec.describe 'Something' do
  context 'when something', bar: :foo do
  end
end
----

=== Configurable attributes

|===
| Name | Default value | Configurable values

| AllowTags
| `[]`
| Array
|===

== RSpec/Extra/RestrictBlockTagValue

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Yes
| No
| <<next>>
| -
|===

Restrict to only allowed block tag value.

=== Examples

==== AllowTagValues: { foo: 'baz' }

[source,ruby]
----
# bad
RSpec.describe 'Something', foo: :bar do
end

# good
RSpec.describe 'Something', foo: :baz do
end
----

=== Configurable attributes

|===
| Name | Default value | Configurable values

| AllowTagValues
| `{}`
| 
|===

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-rspec-extra-0.1.0 docs/modules/ROOT/pages/cops_rspec_extra.adoc