similar to: render_to_string in a controller test?

Displaying 20 results from an estimated 800 matches similar to: "render_to_string in a controller test?"

2008 May 14
3
description method and test failures
Hi all, Hoping you can help. I have a project using rspec 1.1.3 and rails 2.0.2. I''ve run into a small problem. Said project has a method in application_helper.rb named "description". Whenever a spec test fails, I see a message like so: *snip*/vendor/plugins/rspec/lib/spec/runner/reporter.rb:37:in `description'': wrong number of arguments (0 for 2)
2008 Jan 11
5
Missing methods
We have a custom implementation of the Mother Object idea. It''s inside of a module, basically like this: module Factory %w(account friendship person invitation message asset email_address birth).each do |klass| eval <<-EOF def self.create_#{klass}(attributes = {}) default_attributes = valid_#{klass}_attributes #{klass.camelize}.create!
2008 Dec 04
3
Bad mime type reported for flac file
Hi all, It has recently come to my attention that the linux "file" utility reports some (but not all) of my flac files as having a mime type of "audio/mpeg". Obviously this is incorrect, but why is it reported as such? I've cut and paste a few commands below from my shell to illustrate what I'm seeing: black:/media/mildred/music/Tool/10,000 Days$ file -i *
2008 Jan 31
4
reby-debug and rspec
How do I use the ruby debugger with a specific test (not the whole spec file)? I want to do something like this. $ rdebug spec/models/user_spec.rb -s "should error if not new_record" ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search.
2008 Jan 31
1
RSpec and the Basecamp API
I realise that this is kind of a basic question but I''m new to rspec and still trying to work out how to do things. I''m working on a rails project that requires basecamp integration via the api, which is fairly trivial to use via the basecamp.rb wrapper: Connection: basecamp = Basecamp.new(APP_CONFIG[''api_host''], APP_CONFIG[''api_username''],
2008 Jan 27
8
Textmate RSpec Bundle ''it'' snippet
It seems to me that the RSpec bundle''s ''it'' snippet is in need of some love. By default, a newly inserted spec passes. This seems odd as it is misleading. It also makes it harder find what specs still need to be completed if you return to an RSpec module after a break. I propose that the ''it'' snippet is changed to the following: it
2008 Mar 08
10
rspec groups?
One of the things I really liked about TestNG was the grouping feature. Are there any plans for rSpec to incorporate that? Is there any way to emulate that functionality in rspec? Will.
2012 May 28
1
rendering a partial inside another using render_to_string and (:formats) in controller
I want to clean my code by moving the duplicated lines : partial = render_to_string( :partial => "#{file}", :formats => [:html] ) to the pagination_partials function. ================================================= WORKING CODE: ================================================= def render_format_search_partial(file, options={}) # TODO remove this line to use the one
2007 Nov 30
5
render_to_string in an after filter
I''m using render_to_string in an after_filter, which renders a partial that is sent to a web service. Here''s the code: class MyController < ApplicationController after_filter :post_to_webservice def show # show logic end def post_to_webservice stuff = render_to_string :partial => ''stuff'' webservice_post(stuff) end I get a DoubleRenderError in the
2007 Apr 19
4
render_to_string in a model ?
I have a batch job that will call script/runner, I would like in this call to create html formated email and save it to the database. This is easy enough in a controller with yournewhost.email = render_to_string :action => "email_newhost_ready", :layout => false But render_to_string is only available in controller action pack, is there a easy way to render_to_string in a Model? Or
2007 Nov 25
2
Fwd: Render_to_string from a worker
Hi, I am trying to generate a PDF from within a worker using PDF::Writer. In my controller I use render_to_string to create the pdf file however from what I understand render_to_string can only be used from a controller. Does anybody have any suggestions how I might be able to replicate this functionality in a worker? -- thanks, Felix -------------- next part -------------- An HTML attachment
2011 Mar 06
2
render_views and render_to_string
Hey guys. One of my controller actions uses #render_to_string to send back a JSON response. When I try to spec this, Ruby raises a NoMethodError, saying that #render_to_string doesn''t exist in my controller action. Here''s the controller action, spec, and output: http://pastie.org/1640962 Any idea what I''m doing wrong? Thanks, Nick -------------- next part
2010 Mar 17
3
rails+prawnto: setting :type to :prawn in a #render_to_string call not working
Hello, my question is rails related though it is also somewhat specific to the prawnto plugin (installed latest version as of 2010-03-15). I would ask on a prawnto forum/list if I knew where one was. Anyhow, I''m using rails 2.3.5 (with ruby 1.8.6 patchlevel 111) in an app that is successfully using the prawnto gem (with the prawn gem version 0.7.1). I''ve got a a
2011 May 17
1
rails render_to_string problem
Hi I`m trying to test my controller with rspec and always get an error. The error is in the render_to_string method call (without it test works fine). So could u please help me with that? users_controller.rb: def update @user.update_attributes!(params[:user]) redirect_to @user, :status => 202, :text => render_to_string(:partial => "users/show", :type =>
2006 Jul 05
3
Calling render_to_string from a view
I''m playing around with a list of todos, which I want to render as <ul>''s that can nest to an arbitrary level, so I wrote this as a helper method: def print_todo(t) str = "<ul>\n\t<li>" str += render_to_string(:partial => ''todo'', :object => t) + "\n" t.children.each { |c| str +=
2006 May 26
8
calling render_to_string outside of controller
How can I call render_to_string outside of a controller. I''m stuck on this. I''ve nearly got my plugin finished but I can''t seem to get this to work. The method is in ActionController::Base but it is protected. -- Posted via http://www.ruby-forum.com/.
2010 Aug 24
3
inflating tags from .flac
Hello, all. First - sorry for my English. I need help with transcoding .flac to .m4a. All my audio gadget support flac and ogg, except mobile phone. It only support mp3 and aac. I have more than 1 album in flac, and I wanted to write a script for this. But I don't now how to extract metadata from .flac file. I easy can decode flac to wav & wav to m4a, but all metadata is lost! It lost
2010 Nov 04
0
Re: Train wreck getting render_to_string to work from foreign controller [SOLVED]
Just for collective knowledge as I have found no info on this problem online: I solved this by adding an .html.erb file for the "missing template", since by design or bug Rails3 will not find or render another controllers view (in my experience). Then in the new html.erb file, I just put <%= render "comparisons/display" %> because the views *are* able to find templates
2006 Mar 08
0
render_to_string() in a controller that isn''t default route?
Is it possible to call render_to_string() in a controller that is not set as the default route? The content controller is set in routes.rb: map.connect '''', :controller => "content". The content controller is calling a template controller, and I would like to be able to call render_to_string() within the template controller, however I receive the error:
2009 Jun 23
0
render_to_string inside method shared across several controllers
I use render_to_string to generate short reports (in HTML) under certain conditions when users access my application. The reports are stored in the database and uses database information at the time they are generated (and can thus not be generated later, e.g; when you want to consult them). The reports are generated the same way regardless of which controller has been accessed. Conditions for