問題タブ [rspec-mocks]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ruby - スーパークラス メソッドが別のものを返すようにするにはどうすればよいですか?
与えられた 2 つのクラス、Superclass
およびSubclass
-
allow
スーパークラスで を使用して別のものを返すにはどうすればよいですか?
p descriptor.run
上記のコードのreturnの出力false
(つまり、テストが失敗した) はtrue
、期待値を に変更すると while が表示されexpect(subclass.subclass_method).to eq(true)
ます。
ここで単純なものが欠けているように感じます。
いくつかのデバッグを行ったところ、いくつかのことがわかりました。
ここの3行目で問題ないことがわかりますが、サブクラスから呼び出されたときにこれを返す方法がわかりません