Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

readme and inline comments update

  • Loading branch information...
commit 10097e330927a5043bc8c24ea04c8b473c51319f 1 parent 582bb5c
Daniel Pietzsch authored
Showing with 9 additions and 1 deletion.
  1. +4 −0 README.md
  2. +5 −1 lib/filter_assertions.rb
4 README.md
View
@@ -8,6 +8,10 @@ These assertions are added for use in your functional tests:
* `assert_no_before_filter`: use this to test your `skip_before_filter` statements.
* `assert_forgery_protection`: use this to test your `protect_from_forgery` statements.
+## Installation
+
+ script/plugin install git://github.com/pie4dan/filter_assertions.git
+
## Examples
# Test if the before_filter :authenticate applies to all actions in the controller
6 lib/filter_assertions.rb
View
@@ -6,6 +6,7 @@ class ActionController::TestCase
# This method is the matching assertion to the before_filter or append_before_filter methods
#
# Examples:
+ # - assert_before_filter :authenticate
# - assert_before_filter :authenticate, :only => [:index, :new]
# - assert_before_filter :authenticate, :except => :index
def assert_before_filter(before_filter_name, options = {})
@@ -38,6 +39,7 @@ def assert_before_filter(before_filter_name, options = {})
# This method is the matching assertion to the skip_before_filter method
#
# Examples:
+ # - assert_no_before_filter :authenticate
# - assert_no_before_filter :authenticate, :only => [:index, :new]
# - assert_no_before_filter :authenticate, :except => :index
def assert_no_before_filter(before_filter_name, options = {})
@@ -66,7 +68,7 @@ def assert_no_before_filter(before_filter_name, options = {})
end
# The protect_from_forgery method is just a wrapper for
- # another before_filter. And so are these assertion methods
+ # another before_filter. And so is this assertion method
# just a wrapper for the assert_before_filter method.
def assert_forgery_protection(options = {})
assert_before_filter(:verify_authenticity_token, options)
@@ -121,6 +123,8 @@ def before_filter_applied?(filter, action)
end
end
+ # Gets all the actions of the tested controller
+ # Returns an Array of Strings (the names of the actions)
def get_all_controller_actions
# Idea taken from this blogpost:
# http://blog.wolfman.com/articles/2007/7/28/rspec-testing-all-actions-of-a-controller
Please sign in to comment.
Something went wrong with that request. Please try again.