LoginSignup
0
0

More than 1 year has passed since last update.

Create a Forgery mock

Last updated at Posted at 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オープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0