aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-01-13 07:14:46 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-01-13 07:14:46 +0000
commitba814a903386ce12ea5370f5c7df8ef9fb693612 (patch)
treeffe0465911c23527fd82c405d220d07b511db6dd /actionpack/test
parent47f99584b3ad6ef15b42f439251ec8dab4d75dfa (diff)
downloadrails-ba814a903386ce12ea5370f5c7df8ef9fb693612.tar.gz
rails-ba814a903386ce12ea5370f5c7df8ef9fb693612.tar.bz2
rails-ba814a903386ce12ea5370f5c7df8ef9fb693612.zip
Use mocha for rescue tests.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5916 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/rescue_test.rb30
1 files changed, 14 insertions, 16 deletions
diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb
index 91532ee0c2..c7e055a859 100644
--- a/actionpack/test/controller/rescue_test.rb
+++ b/actionpack/test/controller/rescue_test.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/../abstract_unit'
-require 'flexmock'
+
+# gem install mocha
+require 'mocha'
class RescueController < ActionController::Base
def raises
@@ -10,7 +12,6 @@ end
class RescueTest < Test::Unit::TestCase
- include FlexMock::TestCase
FIXTURE_PUBLIC = "#{File.dirname(__FILE__)}/../fixtures".freeze
def setup
@@ -30,10 +31,9 @@ class RescueTest < Test::Unit::TestCase
def test_rescue_action_locally_if_all_requests_local
- stub = flexstub(@controller)
- stub.should_receive(:local_request?).and_return(true)
- stub.should_receive(:rescue_action_locally).with(@exception).once
- stub.should_receive(:rescue_action_in_public).never
+ @controller.expects(:local_request?).never
+ @controller.expects(:rescue_action_locally).with(@exception)
+ @controller.expects(:rescue_action_in_public).never
with_all_requests_local do
@controller.send :rescue_action, @exception
@@ -41,10 +41,9 @@ class RescueTest < Test::Unit::TestCase
end
def test_rescue_action_locally_if_remote_addr_is_localhost
- stub = flexstub(@controller)
- stub.should_receive(:local_request?).and_return(true)
- stub.should_receive(:rescue_action_locally).with(@exception).once
- stub.should_receive(:rescue_action_in_public).never
+ @controller.expects(:local_request?).returns(true)
+ @controller.expects(:rescue_action_locally).with(@exception)
+ @controller.expects(:rescue_action_in_public).never
with_all_requests_local false do
@controller.send :rescue_action, @exception
@@ -52,10 +51,9 @@ class RescueTest < Test::Unit::TestCase
end
def test_rescue_action_in_public_otherwise
- stub = flexstub(@controller)
- stub.should_receive(:local_request?).and_return(false)
- stub.should_receive(:rescue_action_in_public).with(@exception).once
- stub.should_receive(:rescue_action_locally).never
+ @controller.expects(:local_request?).returns(false)
+ @controller.expects(:rescue_action_locally).never
+ @controller.expects(:rescue_action_in_public).with(@exception)
with_all_requests_local false do
@controller.send :rescue_action, @exception
@@ -121,14 +119,14 @@ class RescueTest < Test::Unit::TestCase
def test_local_request_when_remote_addr_is_localhost
- flexstub(@controller).should_receive(:request).and_return(@request)
+ @controller.expects(:request).returns(@request).at_least_once
with_remote_addr '127.0.0.1' do
assert @controller.send(:local_request?)
end
end
def test_local_request_when_remote_addr_isnt_locahost
- flexstub(@controller).should_receive(:request).and_return(@request)
+ @controller.expects(:request).returns(@request)
with_remote_addr '1.2.3.4' do
assert !@controller.send(:local_request?)
end