Rails Controller Tests for Captcha using Shoulda, Factory Girl, Mocha

Posted by Siva on Stack Overflow See other posts from Stack Overflow or by Siva
Published on 2010-06-06T03:37:57Z Indexed on 2010/06/06 3:42 UTC
Read the original article Hit count: 414

Filed under:
|
|
|
|

Can someone provide a strategy/code samples/pointers to test Captcha validations + Authlogic using Shoulda, Factory Girl and Mocha?

For instance, my UsersController is something like:

class UsersController < ApplicationController
validates_captcha

...
def create
...
if captcha_validated?
      # code to deal with user attributes
end
...
end

In this case, how do you mock/stub using Shoulda / Factory Girl / Mocha to test valid and invalid responses to the Captcha image?

Appreciate your help, Siva

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about TDD