README.md in clearance-0.13.2 vs README.md in clearance-0.14.0

- old
+ new

@@ -3,11 +3,11 @@ Rails authentication & authorization with email & password. [We have clearance, Clarence.](http://www.youtube.com/watch?v=fVq4_HhBK8Y) -Clearance was extracted out of [Hoptoad](http://hoptoadapp.com). +Clearance was extracted out of [Airbrake](http://airbrakeapp.com/). Help ---- * [Documentation](http://rdoc.info/gems/clearance) at RDoc.info. @@ -15,11 +15,11 @@ * [Mailing list](http://groups.google.com/group/thoughtbot-clearance) at Google Groups. Installation ------------ -Clearance is a Rails engine for Rails 3. It is currently tested against Rails 3.0.9 and Rails 3.1.0.rc4. +Clearance is a Rails engine for Rails 3. It is currently tested against Rails 3.0.9 and Rails 3.1.0. Include the gem in your Gemfile: gem "clearance" @@ -84,10 +84,30 @@ # config/initializers/clearance.rb Clearance.configure do |config| config.mailer_sender = "me@example.com" end +Rack +---- + +Clearance adds its session to the Rack environment hash so middleware and other +Rack applications can interact with it: + + class Bubblegum::Middleware + def initialize(app) + @app = app + end + + def call(env) + if env[:clearance].signed_in? + env[:clearance].current_user.bubble_gum + end + @app.call(env) + end + end + + Overriding defaults ------------------- Clearance is intended to be small, simple, well-tested, and easy to override defaults. @@ -212,19 +232,21 @@ Then run your tests! rake -Optional test matchers ----------------------- +Testing +------- -Clearance comes with test matchers that are compatible with RSpec and Test::Unit. +If you want to write Rails functional tests or controller specs with Clearance, +you'll need to require the included test helpers and matchers. -To use them, require the test matchers. For example, in spec/support/clearance.rb: +For example, in spec/support/clearance.rb or test/test_helper.rb: require 'clearance/testing' -You'll then have access to methods like: +This will make Clearance::Authentication methods work in your controllers +during functional tests and provide access to helper methods like: sign_in sign_in_as(user) sign_out