Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8744289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:49:08+00:00 2026-06-13T11:49:08+00:00

I have the following code: require_relative ‘../spec_helper’ describe PaymentProcessor do before(:each) do @processor =

  • 0

I have the following code:

require_relative '../spec_helper'

describe PaymentProcessor do
  before(:each) do
    @processor = PaymentProcessor.new
  end

  describe '#process' do
    context 'payment accepted, sha digest valid' do
      it 'should return true and have no errors' do
        GamePlayResult.stub(:new).and_return(mock('GamePlayResult'))
        ticket = stub_model(Ticket, player: stub_model(Player, has_funds?: true))
        Ticket.stub(:find).and_return ticket
        game = stub_model(Game, play: ticket, tolerance: 10)
        query = 'orderID=1060&STATUS=5&PAYID=17314217&NCERROR=0&SHASIGN=E969563B64ED6F93F5DC47A86B1B04DFC884B4A7'
        @processor.process(query, game).should_not be_false
        game.should_receive(:play)
        @processor.error.should equal nil
      end
    end
  end
end

All assertions other other than game.should_receive(:play) are being met. However i know that :play is being called, as a) the other assertions would fail if it wasnt and b) if I don’t stub it, I get a unexpected message error.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:49:09+00:00Added an answer on June 13, 2026 at 11:49 am

    You have to set your RSpec expectation before you call your code that will execute that expectation.

    So this:

    @processor.process(query, game).should_not be_false
    game.should_receive(:play)
    

    Should be changed to this:

    game.should_receive(:play)
    @processor.process(query, game).should_not be_false
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following rspec code: require 'spec_helper' require 'mocha' require 'rr' describe ProjectsController,
I have the following test code: require 'Qt' app = Qt::Application.new( ARGV ) wnd
I have the following code require 'test_helper' class ApplicationControllerTest < ActionController::TestCase test should display
I have the following node.js server-side code: var app = require('http').createServer(handler) , io =
I have the following code: index.jsp: <form name=f action=db/ajoutConducteur.jsp method=post> <input type=text pattern=\d{8} required
Have a look at the following code you are not required to read the
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig
I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
I have following code for loading image from url in xml parsing endElement method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.