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.
私は次のようなRubyコードを持っています:
Something.create do |x| x.foo = bar end
ブロック引数xの代わりにdoubleを使用するテストを作成したいので、次のように呼び出すことができます。
x_double.should_receive(:foo).with("whatever").
これは可能ですか?
specify 'something' do x = double x.should_receive(:foo=).with("whatever") Something.should_receive(:create).and_yield(x) # call the relevant method end