0
0

Rspec 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)

nameに心当たりがないので、Rspecの設定に問題があると推測。

原因

rspec-rails3.xだとバージョンが低いことが理由のようです。

対策

gem "rspec-rails", "~> 4.0.2"

この設定で無事、テストが走りました!

0
0
0

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