# Rspec-rails setup in Rails 3

**URL:** <https://www.ruby-forum.com/t/rspec-rails-setup-in-rails-3/194736>\
**Category:** Rails\
**Created:** [September 9, 2010, 6:28pm UTC](https://www.ruby-forum.com/t/rspec-rails-setup-in-rails-3/194736 "2010-09-09T18:28:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![coolmenu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@coolmenu](https://www.ruby-forum.com/u/coolmenu)\
**Post date:** [September 9, 2010, 6:28pm UTC](https://www.ruby-forum.com/t/rspec-rails-setup-in-rails-3/194736/1 "2010-09-09T18:28:18Z")

</div>

I’m having a hard time getting rspec-rails setup in a Rails 3 app.  
I’m using ruby 1.9.2, rails 3.0.0 and rspec-rails 2.0.0.beta.20. In  
my integration test, I’m using webrat to test a “visit” to a page. I  
get an “undefined local variable” error for the route:

visit new\_articles\_path

Have I missed something in my setup? I followed the basic install  
instructions for both rspec-rails and webrat but can’t seem to get  
passed this error. Thanks for any help.

---

<div class="post-metadata">

**Author:** ![coolmenu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@coolmenu](https://www.ruby-forum.com/u/coolmenu)\
**Post date:** [September 9, 2010, 7:49pm UTC](https://www.ruby-forum.com/t/rspec-rails-setup-in-rails-3/194736/2 "2010-09-09T19:49:41Z")

</div>

On Sep 9, 2010, at 12:22 PM, Lee S. wrote:

> I’m having a hard time getting rspec-rails setup in a Rails 3 app.  
> I’m using ruby 1.9.2, rails 3.0.0 and rspec-rails 2.0.0.beta.20. In  
> my integration test, I’m using webrat to test a “visit” to a page. I  
> get an “undefined local variable” error for the route:
> 
> visit new\_articles\_path
> 
> Have I missed something in my setup? I followed the basic install  
> instructions for both rspec-rails and webrat but can’t seem to get  
> passed this error. Thanks for any help.

Are you sure that you’re using the correct named route?

Run: rake routes  
and look for new\_.\* to see what Rails is looking for.

(You should find the answer obvious.)

-Rob

Rob B.  
removed\_email\_address@domain.invalid [http://AgileConsultingLLC.com/](http://AgileConsultingLLC.com/)  
removed\_email\_address@domain.invalid [http://GaslightSoftware.com/](http://GaslightSoftware.com/)

---

<div class="post-metadata">

**Author:** ![coolmenu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@coolmenu](https://www.ruby-forum.com/u/coolmenu)\
**Post date:** [September 9, 2010, 8:41pm UTC](https://www.ruby-forum.com/t/rspec-rails-setup-in-rails-3/194736/3 "2010-09-09T20:41:13Z")

</div>

Yes, here’s the example setup I’ve put together. I’m using a Post  
model and posts\_path definitely exists.

[http://gist.github.com/572213](http://gist.github.com/572213)
