similar to: ''lazy'' url generation in view specs

Displaying 20 results from an estimated 10000 matches similar to: "''lazy'' url generation in view specs"

2006 Apr 04
6
Console for Testing Routes?
Hi, when the "Agile Web Development" book talks about routes, there are what looks like console transcripts like the following: URL> store @params = {:controller => ''store'', :action = ''index''} Is there something like a console for testing routes (where you could put in a url and see how rails would route it)?? Ingo -- Posted via
2007 Jul 27
5
File.stub!
Hi, I''m trying to stub File.open and whenever I do, rspec blows up with the following error message (undefined method `add'' for nil:NilClass), which seems to happen because method __add in class Proxy is calling #add on global $rspec_mocks, which in turn is nil. Can someone explain what I''m doing wrong, as I can''t seem to stub anything out! Here''s
2007 Oct 01
0
View Spec - Misbehaving
I''m trying to write my first view spec; I''ve done some controller specs with integrated views, but thought that isolating the views for some of these tests might be nice. So I wrote this: > describe PlayerContainer, "show" do > > PARENT_ID = 12 > CHILD_NAME = ''Child Name'' > PARENT_NAME = ''Parent Name'' > >
2006 Apr 17
7
Serve static XML files how?
Hi, a Javascript in one of my Rails templates needs to load a static XML file. I tried several places to put the actual XML file, and I also tried to make the file a rails template (tried both .rhtml and .rxml) and access it via a controller action. None of these ways worked. Does the lighttpd server know how to serve XML files, or do I need to configure it first? Or, is there a good workaround?
2007 Jan 16
2
Links in view specs
Hi I have this simple view (used by the Gap controller): <h1>Gap#index</h1> <%= link_to "Get a GAP quote", :action => "get_quote" %> And this spec: context "A rendered gap/index" do setup do render ''gap/index'' end specify "should have a link to the get_quote page" do
2006 Aug 31
2
Url rewriting for random urls
Hello, I have discovered the good use of stylesheet_link_tag and javascript_include_tag (I''m still learning) and it is very useful because I have to use the relative_url_root way. Now I wonder how I can use that for other URLs. I want a background image for a table cell so I have to write something like: <td align=''right'' valign=''bottom''
2011 Nov 10
1
url helper in model.js.erb.cofee (Sprockets::Context)
hello, I am writing a js/coffee file that gets erb handling and I need to use a url helper inside this file if write .. url: ''<%= url_for(:action => :index) %>'' I get an error: NoMethodError Exception: undefined method `url_for'' for #<#<Class: 0xbdbb068>:0xeed1eb8> >>self.class #<Class:0xbdbb068> < Sprockets::Context How do I
2007 Jun 15
6
problem getting started with stubbing in rails controller specs
Hello, Ingo! I''m copying your question to a new e-mail instead of replying to try to keep message threads separate. Have you tried setting up your expectation before issuing the get statement? For example, take this out of the setup block: get ''index'', :locale => ''en'' and move it after:
2009 May 28
1
[PATCH server] Change default flexchart view and increase vertical dimension of flexchart area.
--- src/app/views/graph/history_graphs.rhtml | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/views/graph/history_graphs.rhtml b/src/app/views/graph/history_graphs.rhtml index 9488367..7a7e1e1 100644 --- a/src/app/views/graph/history_graphs.rhtml +++ b/src/app/views/graph/history_graphs.rhtml @@ -7,10 +7,10 @@ $('#flex_history_chart').flash( {
2008 Mar 06
5
Setting :canvas => false for URL generation doesn''t always work?
I generate a lot of URL''s in my Facebook related code that point to our main site, not our FB app. My understanding was that the way to do this was to use ":canvas => false" as a parameter to url_for and link_to and so on. However, that doesn''t seem to generate the proper URL''s. The URL''s still point to apps.facebook.com (because they
2009 Jun 11
4
Using view helpers and route helpers in a model
Hi there, I am trying to get something working and its driving me crazy. I have been looking around for solutions to getting view helpers working in models and for the most part I find this solution. Add the following in the model you want to use them in include ActionView::Helpers::UrlHelper include ActionController::UrlWriter However, when I try something like
2006 Apr 07
3
How to consume XMLRPC/SOAP web services in Rails?
Hi, does anybody know of any good HowTo for consuming XML-RPC and/or SOAP web services in Rails? I found some for Ruby (via soap4r/xmlrpc4r), but I was wondering whether there is something built into Rails already. So far it looks like there are methods to create web services, but not to consume them. Ingo Weiss
2006 Apr 04
4
Find records based on associated table''s colums
Hello, Let''s say I have a model for a "house". Each house has_a "city", which in turn has_a "state" which in turn has_a "country". The objective is to retrieve all houses in a given state, say "Massachusetts". Being new to Ruby on Rails what I like is that things that should be simple usually are simple, and since we have easy access to
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone, I am relatively new to rspec and I am running into a wall in testing my views. I have a RESTful resource Contracts with a nested resource of Line_items. I am trying to figure out how to test the "edit" form of the Line_items. What complicates this is the nested routing and how to account for it, and that there is a partial form (_form.haml) that both the edit.haml and
2007 Sep 30
9
Problems with testing nested routes using mocking
Hello forum I have there to files #----- virtual_host_controller.rb class VirtualHostsController < ApplicationController before_filter :capture_domain # GET /domain/1/virtual_hosts/1 def show @virtual_host = @domain.virtual_hosts.find(params[:id]) respond_to do |format| format.html # show.rhtml end end private def capture_domain if
2007 Nov 14
3
absolute urls in url_for vs. link_to
In both url_for and link_to, the :only_path param can be used to determine whether the link url used is complete with hostname and path, or just has the path (a kind of relative url). However, in url_for it defaults to false (urls with hostnames), and in link_to it defaults to true ( urls without hostnames, just paths). Is there any reason for this discrepency? To me, it violates the principle
2006 Jan 12
3
url_for in tests
Hi there, I''ve added an extra bunch of testing features for doing in-browser testing with Selenium, and am having quite a time figuring out how to use url_for with having a controller object present. I''ve tried using ActionController::Base.url_for and ActionView::Helpers::UrlHelper.url_for but haven''t been able to get something that works. What I want to be able
2007 Aug 31
48
Deprecating the mocking framework?
I saw in one of Dave C.''s comments to a ticket that "our current plan is to deprecate the mocking framework." I hadn''t heard anything about that, but then again I haven''t paid super close attention to the list. Are we planning on dumping the mock framework in favor of using Mocha (or any other framework one might want to plug in?). Pat
2006 Sep 07
5
url_for always escape string.
according to the documentation, only the url_for from ActionView escape the URL. which happens on this line escape ? html_escape(url) : url and can be prevented by passing :escape => false to url_for. still according to the documentation, the url_for from ActionController is not supposed to escape the url. BUT IT DOES. at the moment of this line escape ? html_escape(url) : url url has
2006 Jun 16
1
diff (to html) for Rails?
Hi, I am looking for a way to compare to pieces of text, and mark up the differences with html. Basically the way Basecamp Writeboards do it. I was wondering whether this is available as a plugin (my initial search didn''t turn up anything). Ingo Weiss -- Posted via http://www.ruby-forum.com/.