Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSpec 2: NoMethodError on 'route_to' with rspec-rails?

I'm trying to run this test...

require 'spec_helper'

describe HomeController do

  describe 'boilerplate routes' do

    it "should route to '/about'" do
      { :get => "/about" }.should route_to(:controller => 'home', :action => 'show')
    end

  end

end

... and it keeps failing with this error message:

1) HomeController boilerplate routes should route to '/about'
Failure/Error: { :get => "/about" }.should route_to(:controller => 'home', :action => 'show')
   NoMethodError:
      undefined method `route_to' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x00000101499650>
   # ./spec/routes/home_routes_spec.rb:8:in `block (3 levels) in <top (required)>'

I'm using rspec-rails 2.5.0 with rails 3.0.5 & rspec 2.5.1.

I'm doing my code just like it says in the rdocs, trying to follow along with this example code... what am I doing wrong? Help!

like image 913
neezer Avatar asked Mar 09 '11 17:03

neezer


1 Answers

Aph, found my problem.

I had my routing spec folder named spec/routes instead of spec/routing, which it should be.

Missed that in the readme.

like image 98
neezer Avatar answered Nov 02 '22 19:11

neezer