Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

Commit

Permalink
filter testing (requires mocha)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.extendviget.com/lab/trunk/plugins/tester_xtreme@324 e959a6d6-1924-0410-92b3-a6fa492f4c66
  • Loading branch information
ben committed Sep 13, 2007
1 parent 048fdf8 commit 24074a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/tester_xtreme.rb
@@ -1,3 +1,6 @@
require 'tester_xtreme/action_controller'
require 'tester_xtreme/active_record'
require 'tester_xtreme/general'

require 'rubygems'
require 'mocha'
13 changes: 13 additions & 0 deletions lib/tester_xtreme/action_controller.rb
Expand Up @@ -57,6 +57,19 @@ def and_not_assign(variable)

self
end

def and_use_filter(filter_name)
method, action, *extra = extract_from_controller_options
prehook = extra.shift
add_test "#{method.to_s.upcase} #{action} should hit #{filter_name} filter" do |myself|
klass.any_instance.expects(filter_name)
myself.instance_eval do
prehook.call(self) if prehook
send(method, action, *extra)
assert_response :success, "#{method.to_s.upcase} #{action} failed"
end
end
end

def and_render(template = nil)
method, action, *extra = extract_from_controller_options
Expand Down

0 comments on commit 24074a5

Please sign in to comment.