RSPecでテストを実行すると以下のエラーが発生。
Failure/Error:
raise WrongScopeError,
"`#{name}` is not available from within an example (e.g. an " \
"`it` block) or from constructs that run in the scope of an " \
"example (e.g. `before`, `let`, etc). It is only available " \
"on an example group (e.g. a `describe` or `context` block)."
`name` is not available from within an example (e.g. an `it` block) or from constructs that run in the scope of an example (e.g. `before`, `let`, etc). It is only available on an example group (e.g. a `describe` or `context` block).
raise WrongScopeError,
^^^^^
バージョンを 5.1.1にしたら解消されました!
バージョンが古かったのが原因だと思われます。
gem 'rspec-rails','~> 5.1.1'