similar to: template.expect_render fails when partial is rendered from a helper

Displaying 20 results from an estimated 200 matches similar to: "template.expect_render fails when partial is rendered from a helper"

2006 Mar 15
4
sub-selection with $
Hello, I have 2 navigations ( mainnav and subnav ) with 2 lists List have same names ( li0 li1 li2 ) What is the best way to select li1 of subnav with prototype 1.4 in this case ? I just want to hide/show it Thanks <div id="mainnav"> <ul> <li name="li0"><li name="li1"><li name="li2"> </ul> </div> <div
2010 Sep 26
2
Rails 3 - Loading a Subnav with Ajax… Which controller owns a subnav?
Once my Rails 3 app is loaded, a user can click an item which needs to then load a dynamic subnav. My thinking is (since it needs to be dynamic) is onClick to make a jQuery AJAX call to the server and then to inject the HTML response into a DIV on the page... What I''d like your advice on is how/where the subnav logic should live in the rails app, as I don''t have a navigation
2007 May 17
4
How to mock helpers in view specs ?
Hi all, I am mocking the following Rails view (inside a partial): <%= render :partial => "forums/forum", :collection => forum_category.forums.readable_by(current_user? ? current_user : nil) %> My spec fails with the following message: 1) ActionView::TemplateError in ''forum_categories/index (anonymous user) should only render forums accessible to anonymous
2008 Apr 19
4
Is testing output within content_for possible?
I wanted to test that the links below were being rendered in the views. - content_for :sidebar do %ul.links %li= edit_link edit_admin_contact_url(@contact), "Contact" # view test it "should have the correct side bar links" do do_render response.should have_tag("ul.links") do with_tag("a[href=?]",
2007 Jul 14
3
expect_render twice in views
I found this: controller.expect_render(:partial => ''thing'', :collection => things).once but I am trying to expect_render twice in my view spec: template.expect_render(:partial => ''order_details'').twice This doesn''t work as the template.expect_render call seems to be returning an array. Is it possible to expect the rendering of a partial
2007 Sep 14
5
controller.expect_render has me beat!
Hi, A controller has a method with the following def update ... if @config.update_attributes( params[:new_config] ) redirect_to :action => :index else * render :action => :edit, :id => params[:id] # this line here* end ... end The example has the following it ''should render the "edit" config url on an unsuccessful save''
2008 Jan 23
4
expect_render(...).and_return(''x'')
Hi, I''m trying to spec a controller method which renders some rjs as part of a render :update block. The problem I''m having is that stub_render or expect_render don''t seem to allow and_return to work. The controller method does: if @thing.save render :update do |page| page.insert_html :bottom,
2007 Dec 04
0
shared behaviour for all views
Is there a way I can write something like a shared behaviour for all views that just checks the page responds with a 200 status and has a title, meta tags, and an h1? Here''s an idea for a shared behaviour (that only applies if I set views to use it manually with it_should_behave_like "a standard layout"): describe "a standard layout", :shared => true do
2007 Jun 27
3
template.expect_render
Trunksters, I just added a couple of methods to ActionView::Base in Spec::Rails (as of r2136) that lets you do this in view examples: describe ''/things/index.html.erb'' do it "should render _thing with a collection of things" do assigns[:things] = things = [Object.new] template.expect_render(:partial => ''thing'', :collection => things)
2007 Aug 13
1
expect_render not?
hi, I have a template that conditionally renders a partial. Is there a way to test that a partial is NOT rendered? :)
2007 Dec 13
3
rsync 3.00pre6 segfault in add_dirs_to_tree
Hi All I run rsync in an automated environment and it sometime will crash and leave a core dump file. from core dump, gdb shows that gdb) bt #0 add_dirs_to_tree (parent_ndx=-1, from_flist=0x56c590, dir_cnt=1) at flist.c:1422 #1 0x0000000000409eab in send_file_list (f=16, argc=-1, argv=0x56c238) at flist.c:2068 #2 0x0000000000419052 in client_run (f_in=16, f_out=16, pid=-1, argc=1,
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
2007 Aug 13
8
How to use expect_render?
Hi: I am a rspec beginner. I have scratched my head for the whole afternoon, trying to figure out a way of writing render expectation in controller spec. However, I failed. It kept telling me that the ''expect_render'' was an undefined method. I have installed rspec 1.0.8 and rspec_on_rails as well. Below is the controller to be tested. Controller def index pre
2007 Jul 14
8
Specing Layouts
Hi, I''ve just started to try and spec my application.html.erb layout as one of the view specs but it totally barfs. I''m guessing that it''s due to the yield statements in the layout. Any clues as to how to proceed? Cheers Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL:
2007 Sep 25
12
Problems with expect_render
Hi there, I''ve been working with RSpec for about a week now, and the process of moving from a Test::Unit + Mocha setup to an RSpec + Mocha environment has been pretty straightforward. Except, I''m having problems with using template.expect_render. I have Mocha enabled with: > config.mock_with :mocha in spec_helper. And then I have a view spec which looks like this:
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
2007 Jun 03
3
should_receive.again
Hi, It appears that if I have 2 should_receives in a row, the latest one overrides the previous one(s). If there isn''t one, could we add a way to accumulate them, such as @thing.should_receive(:method).and_return(@value) @thing.should_receive(:method).again.and_return(@value) @thing.should_receive(:method).again.and_return(@value) would be equivalent to
2008 Jun 12
10
Ajax.Updater not working in IE, tried everything
hi, i am basically using a button, Prototype/AJAX, and PHP to update a user''s location. something simple as typing ''Chicago, IL''. After the script, it rewrites the result in a div tag. here is the form i''m using: <div id="hometown_result">Aurora, IL</div> <form action="" method="post"
2008 Mar 18
6
Problem with mocking a simple has_many relationship
Hi there all. Sorry if the question sounds silly but i''m rather new at the ''mocking'' stuff... So here is my problem (code helps more than talking): the model: class Item < ActiveRecord::Base ... has_many :images, :dependent => :destroy ... protected def validate errors.add(:images, "cannot be empty") if self.images.count end end the
2007 May 09
4
UI testing framework? (w/o selenium)
Hey all, I am currently working on coming up w/ an easy to use, developer-centric web testing framework to test a J2EE app with. (I have 3 rails apps in production, love rspec, and am currently at a java shop). I''ve looked at selenium, and it just doesn''t seem like it is ready for prime time, and the target audience is developers. So, having said that, does the rspec