🖥
Create a Forgery mock
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
About
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
公開日時
2019-04-16
Discussion