similar to: RSpec 2/Rails 3 - content_for in view specs

Displaying 20 results from an estimated 1000 matches similar to: "RSpec 2/Rails 3 - content_for in view specs"

2007 May 23
4
content_for
Any ideas how I would go about writing specs for views which make use of content_for? I''d like, for example, to be able to specify that ABC view places XYZ in the sidebar, which I do using content_for(:sidebar). Am I missing something obvious? Kyle
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=?]",
2010 May 05
2
Add method to get at captured content_for
In Rails 3 the only way to get for content captured with the content_for method in a view is to call yield from within a view. However, sometimes is it useful to get to this data from within a helper (for instance to provide a default value). Calling yield from within the helper method won''t work, and accessing the @_content_for variable directly is not encouraged. Proposed solution: add
2007 Jul 16
4
Accessing content_for html in view specs?
Hi All, Hope all is going well. I''ve got a few views that create some content using ''content_for'' blocks <% content_for :blah do %> ..... <% end %> Has anyone worked out a way to be able to access the html that''s generated inside those blocks? Since they''re not part of the view, have_tag('''') seems to miss them,
2008 Jan 24
3
Help to spec a rails helper method that uses content_for
Hi guys, I am a Rspec newbie and am having problems creating a spec for a RoR helper method. I have in fact already implemented the helper method and am trying to create retrospective specs. I know its the wrong way to do it but I am still learning Rspec. In my view I have a call to a helper method. <% body_class "users" %> which sets a CSS class declaration in the content_for
2008 Sep 17
2
Layouts and content_for
when i studied the tutorial about layouts & content_for from railscast.I need a clarification as per their tutorial. url:http://railscasts.com/episodes/8-layouts-and-content-for <!- projects/index.rhtml -> <% content_for :head do %> <= stylesheet_link_tag ‘projects’ %> < end %> <!- layouts/application.rhtml -> <head> <title>Todo List</title>
2006 Feb 27
1
@content_for_sidebar?
Okay, I see this instance variable places, but I can not determine if it is real or where the content comes from. I''ve tried views/<controller>/sidebar.rhtml, _sidebar.rhtml, views/layouts/sidebar.rhtml and views/layouts/_sidebar.rhtml. Does this actually exist? What''s the Rails Way to make a good sidebar? http://www.google.com/search?q=content_for_sidebar Thanks,
2006 May 23
11
adding layouts within layouts
Hi, I want to be able to have several layouts within each other so that I don''t have to keep repeating the layout code for one, in another. An example would be having a layout for the title of your web page and then having an embedded layout for the body portion in which the HTML for whatever view gets displayed. Is this possible? Thanks. -------------- next part -------------- An
2006 Apr 27
0
partials and content_for
let''s say i''ve got a partial that looks like this: <% content_for :foo do -%> partial.id <% end -%> then the following works: <%= render :partial => "partial", :collection => @collection %> <%= @content_for_foo %> but this does not: <%= @content_for_foo %> <%= render :partial => "partial", :collection =>
2010 Apr 30
0
Content_for & Capture helper
Hi, Whether content_for and capture helpers will work on ajax updates or in ajax pagination. Please help us. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from
2008 May 19
0
How to fetch a block provided by content_for in a helper?
Hi, I got a title_tag helper that renders default page title or title provided by content_for block, if such block is present. Currently I call this method like this: "title_tag(yield(:title))". Is it possible to fetch :title block inside the helper without explicitly passing it as a parameter to this helper? --~--~---------~--~----~------------~-------~--~----~ You received this
2006 Feb 25
2
How do templates get access to controller variables?
This is probably more of a Ruby question than a Rails question. I''ve always wondered exactly how controller instance variables are being made accessible to the ERb code in the views. In the Agile Rails book on pages 38, there''s a sidebar at the top that hints at what''s going on: "Rails does some Ruby magic so that the instance variables of the controller
2006 Jul 13
5
Generic page element display initializer in a layout?
All, I''ve run into a snag. I need to handle the display of elements on my page and I want to use my Javascript event handlers on page load. However, my BODY tag is trapped in my generic layout. I''m thinking that I can put an onLoad on the BODY tag that will just call a Javascript method called initializePage() and then provide this initializePage() call in my specific page
2009 Apr 19
19
Controller spec: testing that scope is set
In a Rails controller I set the scope on a model class in an around filter. I have defined expectations on the model classes, and ideally, I would add a further expectation for the scope. Is this already possible in some way? How would I go about adding support a scope expectation? Michael -- Michael Schuerig mailto:michael at schuerig.de http://www.schuerig.de/michael/
2005 Aug 22
8
Observing changes to a text field
I''ve noticed that using several TimedObservers (prototype.js) on a page to watch for changes to text fields (haven''t tried forms) can have a non-negligible effect on the CPU cycles used by the browser process. Nothing dramatic, to be sure, but unnecessary. Autocompleter.Base (controls.js) follows a smarter strategy to watch for changes. Currently this functionality is tied
2005 Aug 13
4
Timing out ajax requests?
Has someone come up with a generic way to handle ajax requests that exceed a certain time? In my concrete case, I have several select boxes for drilling down a hierarchy. When the user clicks an option, the next deeper level is retrieved. To avoid multiple concurrent requests, I disable the select box. As the request may take too long or cause an error, I set a timeout that re-enables the
2006 Jul 27
9
Introspecting validates_presence_of
Hello people, I''d like to detect whether an attribute of a model has vaildates_presence_of applied to it so I can automatically apply a mandatory (*) to the field...it doesn''t look easy...any ideas? Cheers, -- Dan Webb http://www.danwebb.net
2005 Jun 29
2
Unit testing
Recently, I''ve started to write unit tests for some of my scripts. In general,it''s no worse in JavaScript than in Ruby or Java. I didn''t have the courage to try Selenium, but had a look at JsUnit. Unfortunately, in Konqueror it produces unfathomable errors and in Firefox it is slow beyond imagination. Anyway, writing tests for functions that are computational or
2005 Sep 06
4
url_for: :overwrite_params went missing
Somewhere between 0.13.1 and the current SVN version the :overwrite_params option to url_for (and related methods) went missing. I can''t tell whether this was deliberate or by mistake, and I have no idea how to get the same functionality in some other way either. Michael -- Michael Schuerig Life is what happens
2006 Aug 08
7
Useful plugins for RadRails
Hi Friends, Could anybody suggest me some nice and useful plugins for RadRails! It would be very great if we make list of all such plugins! 1)________ 2)________ 3)________ 4)________ 5)________ 6)________ 7)..... Please fill above blanks and lets make a big list of it! -- Don''t live to geek; geek to live. http://anilw.info -------------- next part -------------- An HTML attachment