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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:19:51+00:00 2026-05-15T16:19:51+00:00

Not sure if this is a Rails 3 issue or an RSpec 2 issue,

  • 0

Not sure if this is a Rails 3 issue or an RSpec 2 issue, but I can’t seem to get a standard controller test working – it seems that the ‘get’ method can’t be found.

I have a controller test that looks like this (named discrepancies_controller_spec.rb in spec/controllers directory):

require 'spec_helper'

describe DiscrepanciesController do
  before :each do
    Discrepancy.delete_all
  end

  it "resolves a discrepancy" do
 discrepancy = Discrepancy.create(:my_number=>"12345", :status=>"Open")

 get :resolve, :id => discrepancy.id

 retrieved_discrepancy = Discrepancy.find_by_my_number("12345")
 retrieved_discrepancy.status.should == "Resolved"
  end
end

(Yes, I’m aware of the security implications of modifying data with an HTTP/GET – that’s a separate issue…)

When I run it with rake, I get the following error:

1) DiscrepanciesController resolves a discrepanc
    Failure/Error: Unable to find C to read failed line
    undefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1:0xc9170d0 @__memoized={}>
    # ./spec/controllers/discrepancies_controller_spec.rb:38 (ignore the line number, commented out code was removed from the sample)
    # C:/Users/Patrick_Gannon/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:212:in `inject'
    # C:/Ruby187/bin/rake:19:in `load'
    # C:/Ruby187/bin/rake:19

I can manage to test the controller action by instantiating the controller myself and calling the controller action directly, and it works, but its ugly because I have to mock out things like respond_to and params.

Other pertinent information: I am running Windows 7 32-bit, Ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-wingw32], edge Rails 3 and MongoDB/MongoMapper. Here is my list of installed gems (via ‘bundle gem’ – all my installed gems were installed by Bundler)

  • abstract (1.0.0)
  • actionmailer (3.0.0.beta4)
  • actionpack (3.0.0.beta4)
  • activemodel (3.0.0.beta4)
  • activerecord (3.0.0.beta4)
  • activeresource (3.0.0.beta4)
  • activesupport (3.0.0.beta4)
  • arel (0.4.0)
  • bcrypt-ruby (2.1.2)
  • bson (1.0.3)
  • bson_ext (1.0.1)
  • builder (2.1.2)
  • bundler (0.9.26)
  • capistrano (2.5.19)
  • capybara (0.3.8 a94f99)
  • cucumber (0.8.3)
  • cucumber-rails (0.3.2 master-b75110)
  • culerity (0.2.10)
  • database_cleaner (0.5.2 7ea99d)
  • devise (1.1.rc1 88ab2f)
  • diff-lcs (1.1.2)
  • erubis (2.6.5)
  • factory_girl (1.3.0)
  • factory_girl_rails (1.0)
  • faker (0.3.1)
  • ffi (0.6.3)
  • gherkin (2.0.2)
  • highline (1.5.2)
  • i18n (0.4.1)
  • jnunemaker-validatable (1.8.4)
  • joint (0.3.2 11a094)
  • json_pure (1.4.3)
  • mail (2.2.5)
  • mime-types (1.16)
  • mongo (1.0.3)
  • mongo_mapper (0.8.2)
  • net-scp (1.0.2)
  • net-sftp (2.0.4)
  • net-ssh (2.0.23)
  • net-ssh-gateway (1.0.1)
  • nokogiri (1.4.2.1)
  • plucky (0.3.2)
  • polyglot (0.3.1)
  • rack (1.1.0)
  • rack-mount (0.6.6)
  • rack-test (0.5.4)
  • rails (3.0.0.beta4 6682cc)
  • railties (3.0.0.beta4)
  • rake (0.8.7)
  • rspec (2.0.0.beta.13)
  • rspec-core (2.0.0.beta.13)
  • rspec-expectations (2.0.0.beta.13)
  • rspec-mocks (2.0.0.beta.13)
  • rspec-rails (2.0.0.beta.13)
  • selenium-webdriver (0.0.24)
  • term-ansicolor (1.0.5)
  • thor (0.13.6)
  • treetop (1.4.8)
  • trollop (1.16.2)
  • tzinfo (0.3.22)
  • wand (0.2.1)
  • warden (0.10.7)
  • webrat (0.7.1)

I also added a puts statement in the test to show what methods are available in the test fixture ((methods - Object.methods).sort.inspect), and “get” is not in the list. Here is what is in the list:

"__memoized", "__should_for_example_group__", "__should_not_for_example_group__", "_fixture_class_names", "_fixture_path", "_fixture_table_names", "_pre_loaded_fixtures", "_setup_mocks", "_teardown_mocks", "_use_instantiated_fixtures", "_use_transactional_fixtures", "_verify_mocks", "a_kind_of", "allow_message_expectations_on_nil", "an_instance_of", "any_args", "anything", "assert", "assert_block", "assert_equal", "assert_in_delta", "assert_instance_of", "assert_kind_of", "assert_match", "assert_nil", "assert_no_match", "assert_not_equal", "assert_not_nil", 
"assert_not_same", "assert_nothing_raised", "assert_nothing_thrown", "assert_operator", "assert_raise", "assert_raises", "assert_respond_to", "assert_same", "assert_send", "assert_throws", "be", "be_a", "be_a_kind_of", "be_a_new", "be_an", "be_an_instance_of", "be_close", "be_false", "be_instance_of", "be_kind_of", "be_nil", "be_true", "boolean", "build_message", "change", "described_class", "double", "duck_type", "eq", "eql", "equal", "example", "example=", "exist", "expect", "fixture_class_names", "fixture_class_names?", "fixture_path", "fixture_path?", "fixture_table_names", 
"fixture_table_names?", "flunk", "hash_including", "hash_not_including", "have", "have_at_least", "have_at_most", "have_exactly", "include", "instance_of", "kind_of", "match", "method_missing", "method_name", "mock", "mock_discrepancy", "mock_model", "no_args", "pending", "pre_loaded_fixtures", "pre_loaded_fixtures?", "raise_error", "respond_to", "run_in_transaction?", "running_example", "satisfy", "setup_fixtures", "stub_model", "subject", "teardown_fixtures", "throw_symbol", "use_instantiated_fixtures", "use_instantiated_fixtures?", "use_transactional_fixtures", "use_transactional_fixtures?"
  • 1 1 Answer
  • 1 View
  • 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-15T16:19:52+00:00Added an answer on May 15, 2026 at 4:19 pm

    Got an answer to this on the RSpec mailing list from David Chelimsky, as follows:

    I’m surprised this is the first time this has come up with rspec-2, but here we are 🙂

    This is a path-separator bug that I’ll resolve in the next release. For now, you can do this in your controller specs:

    describe DiscrepanciesController do
      include RSpec::Rails::ControllerExampleGroup
    

    That should work fine.

    If you want to do a more global workaround, add this to your spec_helper config:

    RSpec.configure do |c|
      c.include RSpec::Rails::ControllerExampleGroup, :example_group => { :file_path => /\bspec[\\\/]controllers[\\\/]/ }
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure this is possible, but in ruby, you can dynamically call a
I'm not sure this question is appropriate here but I hope I could get
I'm not sure if this is a DataMapper issue or something more Rails-specific: NoMethodError:
Not sure this is a known issue. I’m using VS2012 RC (Ultimate), and Win8
Not sure this is possible, but looking to write a script that would return
I'm not sure this is even possible but I know if it is, the
I am not sure this can be done at all... Background: I am constructing
I'm not sure this is possible, but is there a syntax to be used
I am not sure what causes this error but since I came across this
I think I understand why this is happening, but I am not sure how

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.