similar to: Speccing a respond_to block outside of a request

Displaying 20 results from an estimated 9000 matches similar to: "Speccing a respond_to block outside of a request"

2007 Apr 20
1
speccing a call to break
How can I spec that a method calls break? As far as I can see from ri, break is a pure syntax element (not a method from Kernel or Object), so I''m not sure what to mock... E.g.: class SomeClass def a_method loop do break end end end Scott P.S. Sorry for the annoying questions, but I just want to know! P.P.S: What is the right form of the verb "to spec" in
2008 Jan 17
5
unusual challenges speccing external software
This is something I''ve come up against twice. First, I have an interactive editor which calls vi, emacs, or TextMate (etc.) via Unix, and then loads the file handed to the editor back into IRB after it''s edited and saved. I guess that makes it a special case of a more general question, which is how do you spec external processes, with a slightly more complicated version of the
2008 Sep 24
3
caches_page :if not executing (but caches_action :if) does
Hi folks - Seeing a weird problem and would love some help. It''s documented in http://pastie.org/278310 to be more readable. In short, I have a caches_page "action", :if => {stuff} but the :if is never being called - the action is just caching every time. (If I put a debugger call in the :if block, it never stops.) If I replace caches_page with caches_action, the if
2007 Aug 14
1
Upgrade to 1.0.8 broke Rake
Hello Guys. I''m upgrading a project from 0.9.8 to 1.0.8, following this procedure: * Removed vendor/plugins/rspec* completely. * installed rspec and rspec_on_rails from svn://rubyforge.org/var/svn/rspec/tags/REL_1_0_8 * Run script/generate rspec to update spec_helper and spec.opts Now, when running rake, get the following error: superclass mismatch for class Annotation The following
2007 Oct 16
6
respond_to API
I''ll probably do my respond_to API rewrite, as discussed here: http://rubyforge.org/pipermail/merb-devel/2007-September/000275.html sometime this week, unless someone has come up with a better API. I''ll also work in http://merb.devjavu.com/ticket/227 at the same time. Any serious objections?
2007 Sep 20
11
Proposed API change for respond_to
Ez (or someone) asked on #merb tonight whether respond_to was the right API for what it does. After some discussion and pasties, I offer the following proposed API for content negotiation and response format selection: First, what does respond_to do right now? I see at as performing 3 distinct operations: 1. parse params[:format] and the accepts header to find out what format the
2006 Apr 08
2
respond_to causes DoubleRenderError?
I have a custom authentication plugin that redirects users to a login site if they aren''t already authenticated and their session hasn''t timed out. I had things working fine with straight http requests, but wanted to add support for ajax requests. I thought this would be a simple matter of replacing all of my "redirect_to <blah> and return false" calls with
2008 Apr 20
1
Why is respond_to always rending the RXML view?
I''m having a problem in Rails 2 where respond_to is always rendering the RXML view even in the HTML rendering response. Can anyone tell me why this might be happening? Here''s a code snippet: respond_to do |accepts| accepts.html accepts.xml { render :action => ''show.rxml'', :layout => false} end If I change this to the following it works fine:
2006 Aug 14
1
respond_to? in acts_as_ferret results
acts_as_ferret''s search results use #method_missing to forward method calls to the underlying result object. However, those methods are represented in #respond_to? Here''s a simple fix for that: module FerretMixin module Acts module ARFerret class SearchResults def respond_to?(name) self.methods.include?(name) || @results.respond_to?(name)
2007 Apr 26
2
assert_select with respond_to JS or xhr?
Hi everyone, I am a bit confused with xhr? and respond_to. I have the folloing code in my view to update the ''emails'' ID link_to_remote(image_tag("refresh"), :update => "emails", :url => { :action => "list_emails" }) in the controller side i have somthing like : [..] respond_to do |type| type.html { render :action
2006 Nov 23
2
Some tips for testing respond_to block and making controller tests work with simply_helpful
Hi, Here''s two blog posts for those that need to test respond_to blocks and/or are currently using simply_helpful extensively. http://blog.methodmissing.com/2006/11/22/testing-different-content- types-with-rspec http://blog.methodmissing.com/2006/11/23/using-simply_helpful-with- rspec-controller-tests - Lourens
2006 Jun 08
0
custom mime types for respond_to
Is there a way to add a mime type of my own to respond_to ? There''s html, xml, js, ical etc ... But I want to be able to respond_to Excel. Excel has the following content-type header: application/vnd.ms-excel I want to use the new ?format=xml querystring parameters that respond_to can respond to. So I want to pass in ?format=xsl or ?format=ms-excel so that I can return my results
2008 Jun 24
2
wrong number of arguments (1 for 0) when using respond_to?
Trying to get an otherwise working app (in Rails 2.0.2) up to speed with Rails 2.1.0 and Ruby 1.8.7, I have some broken code I can''t seem to fix: module Pathmaker def self.append_features( base ) base.before_save do |model| model.path = model.name.downcase. gsub( /\ and\ /, ''-'' ). gsub( /\ on\ /, ''-'' ).
2006 Jun 28
2
respond_to and Accept headers
After reading: <http://www.loudthinking.com/arc/000572.html> I''m trying to experiment with respond_to in order to not repeat myself and create atom feeds out of a "browse" view. In application controller I created a before filter that checks for the extension of the current url and changes the accept header: [code] def check_headers @headers["Accept"]
2007 May 28
2
Rails, respond_to? over anonymous module (extend has_many).
Hello List, I''m trying to generate examples for some list-helpers I have coded which use in my projects. Basically, the Playlist class uses one anonymous module in has_many that acts as helper between acts_as_list and my desired API: class Playlist < ActiveRecord::Base # associations go here has_many :playlist_items, :order => :position, :dependent => :destroy has_many
2010 Aug 21
1
Rendering a different Javascript file in respond_to
Hi everyone, I am stuck in an (apparently) simple problem. In my event_controller I have the i_like_it action: def i_like_it @event = Event.find(params[:id]) ... # logic respond_to do |format| format.js end end In my case "i_like_it" is called with :method => PUT (it is an Ajax call, "i_like_it.js.erb" will be returned as a script and it wil be
2012 Feb 20
1
respond_to format.json not being called
Hi all, I''m submitting a form using jQuery, but in the respond_to block only the format.html action is called. This is the javascrip: send_button.on(''click'', function(){ var form = $(this).closest(''.modal'').find(''form''); $.post(''/messages'', form.serialize(), function(data, status, xhr){
2006 Apr 15
0
respond_to issue
I''m having some trouble with respond_to to handle multiple request types from a single action. The action: def login return if request.get? #just show the login.rhtml page on HTTP GET self.current_user = User.authenticate(params[:login], params[:password]) respond_to do |type| type.js { render } # renders login.rjs type.html do #fallback for standard
2008 Jan 16
0
respond_to, mime types and excel
Hello All, I''m trying to figure out how respond_to actually works, especially with the increased focus on REST. After I set a MIME type for Excel Mime::Type.register "application/vnd.ms-excel", :xls In my index action''s respond_to block I have format.xls { @parts = Part.find(:all) headers[''Content-Type''] =
2007 Jan 20
0
Best way to force a respond_to format
I am playing around with the idea of adding to the HTTP_ACCEPT header method and trying to utilize WURFL for detecting mobile devices by USER_AGENT instead. I''m thinking I will set up some kind of before_filter in my controller, to intercept all requests and compare the USER_AGENT to some data source. If I detect that the USER_AGENT is a mobile device, then I''d like to force a