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

  • Home
  • SEARCH
  • 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 327599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:25:01+00:00 2026-05-12T09:25:01+00:00

I installed the Mocha 0.9.7 Rails plug-in using: $ script/plugin install git://github.com/floehopper/mocha.git (Just followed

  • 0

I installed the Mocha 0.9.7 Rails plug-in using:

$ script/plugin install git://github.com/floehopper/mocha.git

(Just followed instruction in http://mocha.rubyforge.org/)

Then, I have the following set-up defined in my functional test

def setup
  @controller.expects(:logged_in?).returns(true)
  @controller.expects(:admin_user?).returns(true)
end

Running the test generates the ff. error:

NameError: uninitialized constant Mocha::Mockery::ImpersonatingName
    /test/functional/xxxx_controller_test.rb:x:in `setup'

Before that, I see the ff. error at the top of the test log:

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/test_case.rb:12: warning: already initialized constant Mocha

This has led me to believe that I have an old version of Mocha somewhere in Ruby’s or Rails’ path. The problem is I can’t find it.

Is my guess correct? If so, where is this old version of Mocha? Alternatively, how can I found out where it is?

  • 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-05-12T09:25:02+00:00Added an answer on May 12, 2026 at 9:25 am

    According to http://selfamusementpark.com/blog/2009/07/30/rails233mochaconfusion/, my guess is not correct. The problem really is that Mocha is being loaded before the testing framework which is not what the former expects. The solution is to edit RAILS_ROOT/vendor/plugin/mocha/init.rb to comment out the ff. line:

    require 'mocha'
    

    Then, Mocha will have to be explicitly required in the test files or helpers to ensure that the testing framework will have been loaded beforehand.

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

Sidebar

Ask A Question

Stats

  • Questions 160k
  • Answers 160k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yah, debugging deadlocks is fun. You can set the logging… May 12, 2026 at 11:38 am
  • Editorial Team
    Editorial Team added an answer Funny story, actually. Two years ago, I developed this for… May 12, 2026 at 11:38 am
  • Editorial Team
    Editorial Team added an answer Whether or not it installs "correctly" is entirely up to… May 12, 2026 at 11:38 am

Related Questions

I installed the wxWidgets source code, compiled it and am linking the libraries thus
I installed the ReSharper evaluation version and uninstalled it. Afterwards Visual Studio's Intellisense stopped
I installed the combined package of ICC 11.0.066 for x86 & x64 targets, with
I installed the following component by MacPorts: p5-image-info @1.16 (perl, graphics) Extract meta information
I installed the Maven plugin for Eclipse , and then I got an error

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.