1
0

More than 1 year has passed since last update.

【Rspec】Error: raise WrongScopeError の解消法

Posted at

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'
1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0