gundestrup / acts_as_authenticated

Home | Edit | New

RSpecs

Some Rails developers are using brilliant RSpec BDD framework for app testing purposes.

A really simple way to have these methods work within contexts is to put the line:

Test::Unit::TestCase.send(:include, AuthenticatedTestHelper)

above the opening of the definition of your controller test class. For example:

require File.dirname(FILE) + ‘/../test_helper’
require ‘welcome_controller’

Test::Unit::TestCase.send(:include, AuthenticatedTestHelper)

class WelcomeControllerTest < Test::Unit::TestCase

context “A logged-in person” do
setup do
use_controller WelcomeController
login_as :mr_foo
end
specify “should…” do

end
end

end

Here are RSpec specifications for acts_as_authenticated:
Model&Controller
Controller, seems to be somewhat outdated

This looks like the most up-to-date version:
RSpec 1.0 Acts_As_Authenticated Specs

Any chance these could get included into trunk?
http://web.archive.org/web/20071228190908/http://rashkovskii.com/articles/2007/01/01/rspec-on-rails-acts_as_authenticated
http://web.archive.org/web/20071228190908/http://blog.caboo.se/articles/2006/10/29/rspec-on-rails
http://web.archive.org/web/20071228190908/http://btucker.org/blog/rspec10acts_as_authenticatedspecs.html

Last edited by gundestrup, Fri Oct 24 03:15:03 -0700 2008
Home | Edit | New
Versions: