[rspec-users] undefined method 'get'

Mike Mazur mmazur at gmail.com
Sun Mar 13 09:46:10 EDT 2011


Hi,

On Mon, Mar 7, 2011 at 15:30, DBA <diogo.borges.almeida at gmail.com> wrote:
> I was just starting a rails 3.0.5 application with rspec-rails 2.5.0
> and ruby 1.9.2-p180 and when I went to describe my controller I ran
> into this undefined method 'get' error.
>
> Here's the spec that is causing the problem (which lives in the folder
> spec/controllers)
>
> require 'spec_helper'
>
> describe ArticlesController, :type => :controller do
>  describe "GET index" do
>    get :index
>    response.should be_successful
>  end
> end

Not sure what the problem could be. Does ArticlesController inherit
from ActionController::Base (maybe via ApplicationController)? You
shouldn't need to specify :type => :controller on the top-level
describe like you do. Also, your expectation should be
'response.should be_success'.

Mike


More information about the rspec-users mailing list