RSpecで現在のスコープのサブジェクトを定義するときに、親スコープのサブジェクトにアクセスするにはどうしたらいいですか?RSpecの親スコープサブジェクトにアクセスしますか?
コード例:上記のコメントから@mudasobwaする
describe MyModule.method(:some_method) do
context "when called with a String" do
let(:string) { "Hey there!" }
# I want to refine the subject using the parent scope's subject - common case
# is applying a subject method. Something like:
subject { super.subject.call string }
# Use subject...
end # when called with a String
end # MyModule.some_method
あなたはほぼあります '対象は{スーパー()}' okです。 – mudasobwa
@mudasobwa本当に?私は戻ってもう一度やり直すつもりですが、私はそこに 'super()'と同じでなければなりません)と 'super.call'を持っていると誓っています... – nrser
@mudasobwa huh、 super()。call 'works(' super.call'はそうではありません)... ...私は完全に 'super'を理解していないと思います。とにかく、ありがとう! – nrser