🖥

Create a Forgery mock

2019/04/16に公開

Forgery's Class?

For example, when you want to make a mock on Forgery(:basic).text . Forgery::Basic is a class. So make a mock on it.

 require 'spec_helper' describe do subject { Forgery(:basic).text } before do allow(Forgery::Basic).to receive(:text).and_return('mocked text') end it { should eq 'mocked text' } end 

result

 $ rspec example_spec.rb 

The test passes.

 1 example, 0 failures 

Original by

Forgery の mock を作る

About

About this translattion

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-04-16

Discussion