similar to: stub sub partials when testing partial with rspec

Displaying 20 results from an estimated 400 matches similar to: "stub sub partials when testing partial with rspec"

2008 Mar 23
6
Locals do not appear in partial unless collection is explici
Maybe I''m misunderstanding something but it appears as if <%= render :partial => @items, @locals => { :this => ''that'' } %> does not give the local variable this but this one does: <%= render :partial => ''items/item'', :collection => @items, @locals => { :this => ''that'' } %> Shouldn''t they mean
2006 Dec 13
4
RSpec and simply_helpful
Hi All I''m having some problems running my view specs when using simply_helpful. I have it semi-working via the following: module SimplyHelpfulHelper def self.included(base) base.send :include, SimplyHelpful::RecordIdentificationHelper base.send :include, SimplyHelpful::RecordTagHelper end end context "The index template" do setup do @shift =
2011 Apr 06
1
Time to fix PartialRenderer#partial_path
For the longest time PartialRenderer#partial_path has prefixed the prefix of the current controller when it is nested in a module. This hasn''t been a problem (because nesting controllers wasn''t that common) but with 3.1 striving for better engine support, this problem is now larger because all of your controllers for an engine will be nested and it makes doing <%= render
2006 Mar 12
0
ERB and Builder template engines shouldn''t be so heavily wired in ActionView::Base
Problem: 1. ERB and Builder template engines are heavily wired in ActionView::Base 2. Should be optional. If we use different engine - why load all their stuff if not needed? 3. There are template engines which expect files in their own locations and cache them in their own way. For instance a template engine may store templates in a database. These engines don''t need any central source
2010 Jan 19
0
best way to set default for an optional local in a partial?
What''s the best way to set the default value of an optional local variable in a partial template? In the past I''ve used <% foo = default_value unless (defined? foo) %> But http://api.rubyonrails.org/classes/ActionView/Base.html says *not* to use (defined? foo) and instead use (local_assigns.has_key? :foo) thus <% foo = default_value unless (local_assigns.has_key?
2005 Dec 19
1
Preserving fallback with RJS
Hi guys, I really like RJS. I think they''ll replace partials in alot of instances. Unfortunately, because they''re automatically used like .rhtml and .rxml and are hard to specifically specify it makes it messy to preserve fallbacks when using them. For instance, using partials instead of rjs, my create method might look like: def create post = Post.new(params[:post]) ...
2008 May 29
2
Render partial yields "dynamic constant assignment"
I''m getting a syntax error when rendering a partial. This is a simple html partial with one instance variable inside it. Rendering as a "template" instead of as a partial works just fine. The error occurs 3 lines after the last line of HTML code in the partial. There is no line 72! Here is the error: SyntaxError in Building_blocks#preview Showing
2006 Jan 03
3
render :partial stops setting local variables.
I''m not sure what happened, or what change has caused this to happen, but render :partial (or any render for that matter, doesn''t seem to let me set local variables via the local_assigns argument hash. for example <%= render :partial ''edit'', :username => @user.username %> used to allow that username was a local variable in my _edit.rhtml partial
2007 May 28
1
Rails matcher render_template is wrong when using GetText, looking for flexible solution
I have a problem with a mismatch between RSpec Rails and the actual behavior when using GetText, and would be glad for suggestions how to best solve this. When using GetText a failure is reported for the following simplified specification: describe SamplesController, "when requesting /samples" do it "should render index " do get ''index''
2007 Aug 14
12
expect_render, why does there need to be a warning
There is a warning on the web site about expect_render and stub_render: "WARNING: expect_render and stub_render, while very useful, act differently from standard Message Expectations (a.k.a. mock expectations), which would never pass calls through to the real object. This can be very confusing when there are failures if you''re not aware of this fact, because some calls will be
2006 Mar 22
3
Rendering partials in ActionMailer?
Hello, Is anyone out there rendering partials successfully in ActionMailer templates? I am having trouble with this, and wasn''t sure if it was my configuration or something with a version of Rails I''m running. We''ve got over 15 mailer templates, all working like a charm. But we have a piece of shared code, that we''d really like to not have to copy &
2010 Feb 12
2
How to source files from a search path?
Suppose some environment variable (say MY_R_INC) has a number of paths. I want to source some file relative to some path in $MY_R_INC (just as #include in C++ does, which looks for header file in a number of directories). I RSiteSearch'ed, but I don't find any function that satisfies my need. Could somebody let me know if I overlooked something?
2006 Aug 05
1
form_for and partials
I''m getting an error in the partial when i try <% form_for :name do |form| %> <%= render_partial "#{@current_stage}" %> <% end %> So I assume that form_for does not have scope in the partial? If that is the case what are my solutions... Do I have to stick a <% form_for in every partial, or do i just change all my inputs back to text_field
2009 Feb 03
1
Passing args to generator
I have some default_options in generator and when I wish to change they value with --option_name I get only logical true instead of string ... default_options :option_name => "Some string" ... def add_options!(opt) opt.separator '''' opt.separator ''Options:'' opt.on("--option_name","Some Text") { |v| options[:option_name] = v
2006 Jun 26
0
Using a partial multiple times in a view
Hi, im trying to execute multiple cmds in a method that use the same view which has multiple calls to the same partial inside it. However i cant get it to work correctly, so any help here would be appreciated heres the controller code def index cmd_df = "df -Ph" exec_cmd(cmd_df) cmd_sys = "uname -a" exec_cmd(cmd_sys) end private def exec_cmd(cmd)
2007 May 05
0
integration with movtable
Hi, I''m trying to integrate movtable to display some data. The file that lists out the partials to display the data looks like this: <html> <head> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <title>Movtable - List</title> <%= stylesheet_link_tag
2009 Oct 28
2
render :file cached?
In my application I have a controller/view that displays the contents of an audit log file def audit_log render :layout => ''table'', :file => AUDIT_LOG end The audit log is updated frequently but the render call does not re- read the file so it gets stale. Is there a way to tell render to check the file timestamp and reload as needed?
2007 Nov 03
1
Specs for Helpers that call render
The helper spec I am writing tests a helper method that calls render. ## module HelperHelper def render_partial render :partial => ''partial'' end end ## The helper spec. ## describe HelperHelper do it "should render partial" do render_partial.should_not == nil end end ## The output generated ## $ spec spec/helpers/home_helper_spec.rb .F 1)
2006 Aug 01
2
Partial Naming Madness
Hi, I am having the following issue with a partial. During initial page load, I am doing a "render_partial_collect ''foo'', @foos", and all goes well. Each foo partial makes use of a variable inside called ''foo'' (and can get foo.id etc). After all the partials are loaded, I need to :update a div corresponding to one of the partials (ie re-load the
2005 Apr 13
2
render_partial & RXML
Does render_partial work within a RXML file? I am attempting the following: xml.users do for user in @users render_partial ''user'', user end end All that is output is: <user> </user> Without any exception or anything to indicate that I''m doing something wrong. Does anyone have any experiece with this? Josh