# Why do restful\_authentication generated rspec tests fail?

**URL:** <https://www.ruby-forum.com/t/why-do-restful-authentication-generated-rspec-tests-fail/169717>\
**Category:** Rails\
**Created:** [June 7, 2009, 6:51pm UTC](https://www.ruby-forum.com/t/why-do-restful-authentication-generated-rspec-tests-fail/169717 "2009-06-07T18:51:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonathan](https://www.ruby-forum.com/u/jonathan)\
**Post date:** [June 7, 2009, 6:51pm UTC](https://www.ruby-forum.com/t/why-do-restful-authentication-generated-rspec-tests-fail/169717/1 "2009-06-07T18:51:59Z")

</div>

Been searching online for an answer to this without success - also  
been digging through the documentation but I’m still very new to  
rails.

I started a brand new app (rails 2.3.2), then the first thing I did  
was install restful\_authentication with the --rspec and –  
include\_activation options, then went through and followed the  
directions for post install as detailed in the plugin documentation.  
Performed a migration, then ran the rspec tests generated by the  
plugin. The tests failed with 6 errors, which I wasn’t expecting  
because I haven’t personally written a line of code yet, just used the  
rails and restful\_authentication generated code. Has anyone else run  
into this?

Thanks in advance~

---

<div class="post-metadata">

**Author:** ![jonathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonathan](https://www.ruby-forum.com/u/jonathan)\
**Post date:** [June 7, 2009, 7:01pm UTC](https://www.ruby-forum.com/t/why-do-restful-authentication-generated-rspec-tests-fail/169717/2 "2009-06-07T19:01:26Z")

</div>

They break 'cos they rely in a old Rspec behaviour for matching routes.

The best you can do is just remove all restful\_auth specs and cucumber  
scenarios (they’re HORRIBLE, btw, you probably won’t understand  
anything anyway and any change is going to be a PITA) and just write  
your own specs and Cucumber scenarios. Way more simpler than fixing  
and keeping all those specs in your project.

But, if you’re in to "fix’ those specs, the problem is that routes  
that are not expected to be used as GET requests should be matched  
with this:

{ :path =\> ‘/users’, :method =\> :post}

Instead of just “/users”.

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) |  
[http://codeshooter.wordpress.com/](http://codeshooter.wordpress.com/) (en)

---

<div class="post-metadata">

**Author:** ![jonathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonathan](https://www.ruby-forum.com/u/jonathan)\
**Post date:** [June 7, 2009, 7:19pm UTC](https://www.ruby-forum.com/t/why-do-restful-authentication-generated-rspec-tests-fail/169717/3 "2009-06-07T19:19:06Z")

</div>

Many thanks for the explanation. Just what I needed to know.

On Jun 8, 2:00 am, Maurício Linhares [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jonathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonathan](https://www.ruby-forum.com/u/jonathan)\
**Post date:** [June 8, 2009, 6:24pm UTC](https://www.ruby-forum.com/t/why-do-restful-authentication-generated-rspec-tests-fail/169717/4 "2009-06-08T18:24:50Z")

</div>

Jonathan wrote:

> Many thanks for the explanation. Just what I needed to know.
> 
> On Jun 8, 2:00ï¿½am, Maurï¿½cio Linhares [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

There are several forks of restful\_authentication that have fixed the  
rSpec failures, including mine at:

> **[GitHub - robertwalker/restful-authentication: Generates common user...](https://github.com/robertwalker/restful-authentication/tree/master)**
>
> master

There is nothing different in my fork except the fixes for the specs.

---

<div class="post-metadata">

**Author:** ![jonathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonathan](https://www.ruby-forum.com/u/jonathan)\
**Post date:** [June 8, 2009, 10:38pm UTC](https://www.ruby-forum.com/t/why-do-restful-authentication-generated-rspec-tests-fail/169717/5 "2009-06-08T22:38:08Z")

</div>

I’ll look into your suggestion - thanks mate.

---

<div class="post-metadata">

**Author:** ![jonathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonathan](https://www.ruby-forum.com/u/jonathan)\
**Post date:** [June 8, 2009, 11:12pm UTC](https://www.ruby-forum.com/t/why-do-restful-authentication-generated-rspec-tests-fail/169717/6 "2009-06-08T23:12:02Z")

</div>

Sigh - my apologies - I replied to the wrong post…
