similar to: Rspec and restful routes

Displaying 20 results from an estimated 2000 matches similar to: "Rspec and restful routes"

2007 Nov 02
5
RSpec, RESTful nested routes and :path_prefix
Dear list, In the app we are making we have a rout something like this: map.resources :projects do |projects| projects.resources :pages, :controller =>"Wiki::Pages", :path_prefix => "/projects/:project_id/ wiki", :name_prefix => "project_wiki_" end But I can''t get RSpec(I''m very new to it) to accept this. It keeps throwing errors:
2009 Mar 11
3
[rspec, rails] Restful Routes in controller specs
Hi, how is it possible that I can use the restful routes helpers (e.g. new_user_path) in controller specs? I browsed the source code but I couldn''t find the magic. I''m just curious and would appreciate any hint... thanks Andi
2008 May 28
3
Newbie: Searcing database via user form input?
Does anyone have a tutorial on adding new parameters to the paramaters list and then creating find conditions around them? I''m wondering how I can get my index page to list only the items where some of the the databases fields match user form input. index.html.erb would be calling itself with a new parameter :searchdata So far the index.html.erb has... <% form_tag({ :action =>
2008 Jan 29
4
map.resources for controllers in a module
Hello- I''m giving RESTful development a shot. I''m running into some difficulty with controller I have grouped into modules. Specifically, I have a "admin" module with a "user" controller (created with "generate controller admin/user"). I managed to get map.resources wired up with this code: map.resources Admin::User, :path_prefix =>
2009 May 01
4
Can't get to an action in a RESTful controller
Folks, I am using the restful_authentication plugin. This creates the users controller which is declared as a resource in routes.rb as below map.resources :users Now in the UsersController I have created an action to resetpwd that I am trying to get to from the login page when the user clicks "forgot password". However, when I do that the log file tells me that the call to
2009 Dec 25
18
rescue_from ActionController::RoutingError II
OK ... so I''m not supposed to use it but ... Why doesn''t rescue_from ActionController::RoutingError work witht he code from http://www.rubyplus.org/episodes/20-Extended-RESTful-Authentication-Rails-2-App.html class ApplicationController < ActionController::Base helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details
2008 Feb 29
3
How to DRY REST admin path in URLs?
Hi everyone... For almost all of my objects I put a series of classic REST admin links in views. For example, for a ''user'', I have <%= link_to "Show", user_path(user) %> <%= link_to "Edit", edit_user_path(user) %> <%= link_to "Destroy", user_path(user), :confirm => "Are you sure", :method => :delete %> I am tired
2006 Feb 16
3
rescue_action_in_public question
I''m using the rescue_action_in_public example from the Agile book to handle errors and email serious ones to me. In my application.rb controller: def rescue_action_in_public(exception) logger.error("rescue_action_in_public executed") case exception when ActiveRecord::RecordNotFound, ActionController::RoutingError, ActionController::UnknownAction
2001 Feb 20
1
_PATH_STDPATH and @bindir@
Sorry if this is stuff that's been talked about before. If it is, just ignore me. I'm curious to know why Portable OpenSSH doesn't include @bindir@ in the _PATH_STDPATH. This would save most installers of portable OpenSSH from having to --with-default-path=$PREFIX/bin in order to ensure that scp will work properly. This would also, I imagine, save quite a lot of hassle for
2001 Feb 12
3
add scp path to _PATH_STDPATH
what do you think about this patch to add the path to scp to _PATH_STDPATH? is there a better or cleaner way to do this? i'm hoping to ward off 'scp doesn't work' questions for the next release. i did *not* add this to a --with-default-path path, because if a user specifies that, they should control its value completely. Index: Makefile.in
2007 May 21
4
Just upgraded to 1.0.0, should render_text isn''t working for me
I finally got around to upgrading from 0.8.2 (!!). I had a spec which looked like specify "should render abc123" do controller.should_render :text => "abc123" get :key end With 1.0.0, the new spec is it "should render abc123" do get :key response.should render_text("abc123") end However it doesn''t work, giving me the error: undefined
2007 Sep 04
2
specing helpers fails on restful routes
Hi, I am trying to spec helper methods in a Rails project, but it seems the specs fail with the error: You might have expected an instance of Array. The error occurred while evaluating nil.<< if the restful routes helper are used either in spec files, or the helper file. What can I be doing wrong? Or how can I fix this. Thanks! -- Surendra Singhi http://ssinghi.kreeti.com,
2007 Aug 08
5
Can''t seem to spec a ActiveRecord::RecordInvalid exception properly...
1 def create 2 @user = User.new(params[:user]) 3 @user.save! 4 self.current_user = @user 5 redirect_to user_path(@user) 6 flash[:notice] = "Thanks for signing up!" 7 rescue ActiveRecord::RecordInvalid 8 render :action => ''new'' 9 end I can''t seem to properly spec this out. I am trying numerous things, the latest one is
2007 Sep 22
1
Testing RESTful routes
Hi all, The app I am making right now uses restful routing entirely. I want to prevent people from accessing my actions without the proper HTTP verb so I commented out the :controller/:action/:id catch all routes that were used in pre-RESTful Rails apps. Like so: #map.connect '':controller/:action/:id.:format'' #map.connect '':controller/:action/:id''
2008 Mar 24
2
link_to_remote and restful routes/urls
is there a way to access a restful resource with mike''s new link_to_remote helper? something like: <%= link_to_remote h(user.name), :update => "div_id", :url => user_url(user) %> of course, that doesn''t work. i have also been trying things like: :url => controller.asset_host +
2013 Apr 28
3
Can't register to Asterisk 1.6 with old Aastra phones
We have a new customer with a lot of old phones like the 9133i. They won't register, and we see some very strange behavior with them. If the SIP peer exists, they simply fail silently, with no error in the CLI or the messages log. Nothing works, but no errors. If the peer does not exist, it's clear that it's registering improperly: [2013-04-28 13:34:31] NOTICE[3058] chan_sip.c:
2007 Jan 05
2
Using RESTful routes in controller tests
Why can''t I use the RESTful route helpers in my specs? In my controller I''m doing a redirect: redirect_to list_path(:id => @item.list_id) Now when I write: controller.should_redirect_to list_path(:id => 2) I''m getting the following error: NoMethodError in ''POST on /lists/2/items should redirect to index on succesful POST'' You have a nil object
2012 Aug 07
9
How do I force link_to/form helpers to use the superclass name in the path instead subclass?
I want my helpers to generate paths using a superclass instead of the subclasses. Assuming I have Owner and Member that both inherit from User, rails will use the current objects class name when generating paths: Let''s say current_user is a mod: <%= link_to current_user.name, current_user %> will generate "/mod/:id". I want to force it to generate
2006 Nov 17
6
RESTful routes and resulting urls
if I have the following in my routes.rb: map.resources :product_categories it provides urls such as: /product_categories /product_categories/1 /product_categories/1;edit etc. and uses the ProductCategories controller. how can I keep the same controller (and model) but set up the resources so that I can have any abitrary url point to the existing controller, much like specifying the controller
2010 Jun 21
4
Failing Routes in deployment
I have an app that has the following in the routes file: namespace "admin" do # ADMINISTRATIVE ROUTES ONLY root :to => ''home#index'' resources :comments do member do get :approve get :reject end end resources :users do member do get :block get :unblock end end end When browing to