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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:02:35+00:00 2026-06-13T02:02:35+00:00

I’m trying to stub out a Class method for any instance of the class

  • 0

I’m trying to stub out a Class method for any instance of the class (via any_instance). My tests run through successfully, but at the end of the test when rspec is trying to reset the any_instance stub, it throws an error (Unable to find matching line from backtrace). Here’s the apparent culprit line of code (removing it removes the error):

Confetti::Config.any_instance.stub(:write_info)

The full error is below. Seems like stub should’ve (but fails to) created the __rspec_original_dup method, and when the reset happens, it can’t find the expected method.

 Failure/Error: Unable to find matching line from backtrace
 NameError:
   undefined method `__rspec_original_dup' for class `Confetti::Config'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/any_instance.rb:73:in `alias_method'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/any_instance.rb:73:in `restore_dup'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/any_instance.rb:72:in `class_eval'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/any_instance.rb:72:in `restore_dup'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/any_instance.rb:46:in `rspec_reset'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/space.rb:17:in `reset_all'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/space.rb:16:in `each'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/space.rb:16:in `reset_all'
 # /Library/Ruby/Gems/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks.rb:23:in `teardown'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/mocking/with_rspec.rb:18:in `teardown_mocks_for_rspec'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example.rb:308:in `run_after_each'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example.rb:119:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example.rb:253:in `with_around_each_hooks'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example.rb:110:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:378:in `run_examples'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:374:in `map'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:374:in `run_examples'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:360:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:361:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:361:in `map'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:361:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:28:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:28:in `map'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:28:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/reporter.rb:34:in `report'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:25:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
 # /Library/Ruby/Gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
 # /usr/bin/rspec:19
  • 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-13T02:02:36+00:00Added an answer on June 13, 2026 at 2:02 am

    I solved this by simply using Rspec v2.10.0 instead of v2.11.0:

    gem 'rspec', '~> 2.10.0'
    

    From the links that Henrik provided, it sounds like they may release a bugfix for Rspec. Watch this issue for more information. In the meantime, downgrading solved the issue for me.

    (Thanks for your work in helping me figure this out, Henrik.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I am doing a simple coin flipping experiment for class that involves flipping a
I have a French site that I want to parse, but am running into

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.