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 8050645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:07:50+00:00 2026-06-05T07:07:50+00:00

I have next modules. module A module B def self.method_b(value) #code end end end

  • 0

I have next modules.

module A
  module B      
    def self.method_b(value)
      #code
    end
  end 
end

and

module A
  module C
    def self.method_c(value)
       A::B.method_b(value)
    end
  end
end

How to test these module? How to create stub self.method_b?

spec_helper.rb

RSpec.configure do |config|
 config.mock_with :mocha
end

Thanks.

  • 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-05T07:07:51+00:00Added an answer on June 5, 2026 at 7:07 am

    You have switched out the built-in RSpec mocking library for mocha. That has a different API. Try:

    A::B.stubs(:method_b).returns('value')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have next code require 'rack/rpc' class Server < Rack::RPC::Server def hello_world Hello, world!
I have scopes defined in an include module like this: module ActsAsAdjacent def self.included(base)
I have next problem, when I'm trying to retrieve value from xforms:select elements I
I have the following python modules. Sorry if the code is ugly. This is
How would I go about testing the following helper method? module HypotheticalHelper def next(array)
I have a project with several modules. When all tests pass, Maven test runs
Say i have this code to separate routes in expressjs: module.exports = function(express,app,client) {
I have next WSDL file <definitions targetNamespace=http://soft.com/ name=LoggingWebService xmlns=http://schemas.xmlsoap.org/wsdl/ xmlns:tns=http://ws.config.softid.softcomputer.com/ xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/> <types> <xsd:schema>
I have next problem. Other team was changed(deleted) property from component and now some
We have next: Big solution with a lot of changes to db Production database

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.