2017年8月6日のブックマーク (1件)

  • RSpecの便利な機能Tips

    🍣 RSpecでスタブの作成allowメソッドでスタブ(テストの際、そのモジュールの代わりに用いる代用品)を構築できます。 RSpec.describe "Specifying a return value" do it "returns the specified return value" do dbl = double allow(dbl).to receive(:foo).and_return(14) expect(dbl.foo).to eq(14) end end RSpec.describe "allow_any_instance_of" do it "returns the specified value on any instance of the class" do allow_any_instance_of(Object).to receive(:foo).and_

    RSpecの便利な機能Tips
    morizyun
    morizyun 2017/08/06
    ブログ書きました!