similar to: Is there a way to use the rescue_action defined in a controller in the controller''s specs?

Displaying 20 results from an estimated 800 matches similar to: "Is there a way to use the rescue_action defined in a controller in the controller''s specs?"

2006 Oct 26
0
rescue_action overridden
In rspec_on_rails, method setup_with_controller, exists the following line: @controller_class.send(:define_method, :rescue_action) { | e| raise e } I understand that this is a better way to handle errors than the default. However, it gets in the way when you''ve defined your own rescue_action and are trying to test it. No good solutions came to me while I pondered the
2006 Feb 26
0
rescue_action with RoutingError not loading ApplicationController/ApplicationHelper
Why is it that when rescue_action is called with any exception except for RoutingError, "self" refers to a controller within my application, but when there''s a RoutingError, "self" refers to an object of ActionController::Base? This makes some sense because a "RoutingError" implies that no controller was found to process the request. However, I am trying to
2008 Mar 08
3
should_receive(:foo).with(any_object)
Hey, I just ran into a situation where I would like to expect a method call with an argument I know and another one, which is a random number. I think mocking up the rand method is somehow ugly so I thought maybe this is the first time where I can take something from Java to Ruby ;) Java''s EasyMock mocking library knows things like "anyObject()" and "anyInteger()" in
2008 Apr 30
7
rescue_from issue with AWS - uninitialized constant
The new rescue_from in edge rails seems to conflict with ActionWebService, which I need for various other purposes. When I define, for example (with AWS gem installed): <b>rescue_from ActionController::RoutingError, :with => :page_not_found</b> I get the exception: <b>uninitialized constant ActionWebService::Dispatcher::ActionController::Base</b> OK, so AWS
2009 Dec 25
18
rescue_from ActionController::RoutingError II
OK ... so I''m not supposed to use it but ... Why doesn''t rescue_from ActionController::RoutingError work witht he code from http://www.rubyplus.org/episodes/20-Extended-RESTful-Authentication-Rails-2-App.html class ApplicationController < ActionController::Base helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details
2009 Apr 03
0
Truncated development log when using rescue_from
I''m noticing that my development.log messages are not showing the usual complete logging per request/response when I am catching exceptions from my controllers using rescue_from. I was wondering if anyone has ever encountered this issue before. I''m using Rails 2.2.2. Processing DomainsController#show to xml (for 127.0.0.1 at 2009-04-03 16:41:38) [GET] Parameters:
2009 Jun 16
1
[PATCH server] Fix errors in controller tests.
A bunch of controllers were not extending ActionController::TestCase, and instead were just using the basic test/unit testcase, so we were not getting some of the rails baked-in stuff. Signed-off-by: Jason Guiditta <jguiditt at redhat.com> --- src/test/functional/host_controller_test.rb | 2 +- src/test/functional/nic_controller_test.rb | 2 +-
2005 Sep 04
0
IPSwichBoard designers wanted
I am rewriting IPSwitchBoard at the moment. I want to make IPSwitchBoard "Skinable" meaning that you can design your own skins with company logo etc. You will also be able to add graphical extension buttons, and led's that will light up ex. DND, busy/free, message waiting and much more. If you are graphically minded and would like to help with making test skins using PhotoShop or
2007 May 23
8
Rails Rendering diagnostics.rhtml in Controller Spec
Forgive me if this isn''t the proper list. It''s specific to the rSpec Rails plugin. The problem is, some controller actions are rendering the "diagnostics.rhtml" template when I''m expecting it to render something else in a controller spec. I''m assuming this is the template that displays the error message and a stack trace when an error is raised in the
2009 Feb 10
2
rescue_from for NoMethodError
Hi everyone, I was just trying to catch some exceptions in my app, for "Record Not Found" I used this in my application.rb file rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found rescue_from ActionController::NoMethodError, :with => :show_error private def record_not_found render :text => "404 Not Found", :status =>
2008 Oct 24
1
rescue_from and assert_raise
Since commit 5e3517ea7b9fbd460f772bffc9212d882011f2bc, rescue_from is now being handled in tests. I''ve been using rescue_from to handle custom exceptions and testing that those exceptions are raised in functional tests with assert_raise. This no longer works now. What''s the proper way to test this now? --~--~---------~--~----~------------~-------~--~----~ You received this
2006 Jun 30
1
Taking Control of Un-handled Exceptions
Greetings, I''m trying to catch all un-handled exceptions. I''m having problems handling the RoutingError and UnknownAction exceptions. I''ve added the following to my application controller as a protected method: def rescue_action(exception) render(:text => "error") end As far as I understand, this should catch all uncaught exceptions and override
2005 Sep 29
0
Major bug solved in IPSwitchBoard
I have been working on solving a major issue with IPSwitchBoard. It was reported that IPS would use all available memory and get the PC to grind to a halt. I could not understand this as I had it running on many different PC's in Denmark. I now found the bug: IPS would crash on any PC that had "." configured as decimal point (in Denmark we use ",") this meant
2007 Oct 11
0
Custom rescue_action_* methods not being called?
All, Rails 1.1.6 Ruby 1.8.6 Win XP It appears that none of my rescue_action_* methods, if defined in my application.rb file, are being called. I''ve placed debug statements inside of the ActionController Rescue module to verify that rescue_action is being called. Here are my overrides in application.rb, none of which are being called - they are all protected visibility (these are just
2007 Jan 11
0
writing tests for rescue_action_in_public
I''m having trouble with rescue_action_in_public, both in getting it to work right in my rails app, and in writing tests to make sure. What I ultimately want to do is test for what a normal user would see when an error is trapped. I override local_request? like so: application.rb -------------- def rescue_action_in_public(exception) render :text => "oops" end def
2007 Oct 21
7
exact exceptions in rescue_from
rescue_from stores exception class names in a hash table, and associates them with handlers. When an exception is raised there''s a name lookup, and if an entry is found its handler is invoked. In particular rescue_from does not emulate Ruby''s rescue semantics with regard to inheritance. Which is the rationale? Don''t you think taking is_a? and declaration order
2008 Aug 21
1
rescue_from failing to rescue [from]
Having some weird failures of rescue_from in all my specs. They still rescue in actual usage, just not in my specs. Made a pastie of the code: http://pastie.org/257399 This is with latest [as of 1:00 PM Eastern time zone] rspec/rspec-rails/edge. Thanks in advance for any replies on this. RSL -- Posted via http://www.ruby-forum.com/.
2007 Dec 30
0
Exception not caught while in view
I''m running Rails 2.0.2. My controller is subclassed from RetainController (which is subclassed from ApplicationController). Retain Controller has: rescue_from Retain::LogonFailed, :with => :logon_failed rescue_from Retain::FailedMarkedTrue, :with => :failed_marked_true It works if the exception occurs before I start processing the view. If I get the exception while in
2008 Aug 01
1
rescue_from ActionController::MethodNotAllowed
Hello, I''m having some trouble handing ActionController::MethodNotAllowed errors. Basically, the following is defined in my controllers, but obviously I''m missing something. Thanks in advance for any light you can shed. - - - - - - - - - - - - - - - - - - - - class UsersController < ApplicationController rescue_from ActionController::MethodNotAllowed, :with =>
2005 Sep 24
0
IPSpeedDial has just been released
IPSpeedDial creates speed dial numbers for Asterisk. Download from: <http://ipsoftware.thorben.dk/> http://ipsoftware.thorben.dk Use this to create speed dial numbers that can be used by all extensions on your Asterisk server. This program will create entries in the asterisk database which you then can lookup in you dial plan get the number to dial. All extensions can now dial