To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!More about adding a collaborator
verify_partial_doubles configuration option is set, the same argument and
method existence checks that are performed for
object_double are also performed on partial doubles. You should set this unless you have a good reason not to. It defaults to off
only for backwards compatibility.
- doubling an existing object
a file named "spec/user_spec.rb" with:
class User def save; false; end end def save_user(user) "saved!" if user.save end RSpec.configure do |config| config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end end RSpec.describe '#save_user' do it 'renders message on success' do user = User.new expect(user).to receive(:saave).and_return(true) # Typo in name expect(save_user(user)).to eq("saved!") end end
- the output should contain "1 example, 1 failure"
Last published 6 days ago by Jon Rowe.
RSpec Mocks settings