Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
仕様ファイルのコンテキストの外から、現在の例を取得し、そのメタデータを検査する方法をどのように/理解できますか?
テストが失敗した場合、VCR が記録しないようにしようとしています。
beforeRSpecは現在、現在の例にアクセスするためのパブリックAPIを提供していません(内部的にグローバルにアクセス可能な現在の例の概念がないため)が、グローバルフックを使用してこれを自分で公開するのはかなり簡単です。
before
RSpec.configure do |rspec| rspec.before(:each) do $current_rspec_example = self end end
次に、どこからでもを使用して現在のrspecの例にアクセスできます$current_rspec_example。
$current_rspec_example