search for: find_account

Displaying 4 results from an estimated 4 matches for "find_account".

2008 Jan 30
2
Stubbing controller methods vs model methods
...e that was made works and why what existed before didn''t. Here is the initial post when I had the error: ---------------------------------- In the controllers/application.rb file I have a method that finds the account based on the subdomain. This method is stubbed out for the tests. def find_account @account = Account.for(request.host.split(".").first) #TODO: find out why request.subdomains returns [] end In my controller tests I would like to stub this method. So I created a method within the authenticated_test_helper.rb (I am using RESTful Authentication plugin) def login...
2007 Dec 04
1
spec''ing shared controller methods
...t finds the Account specified in params[:account_id], which may be used by any number of other controllers in my app. As you can see, the filter is still getting spec''d and has pending examples. ## application.rb class ApplicationController < ActionController::Base ... def find_account @account = Account.find_by_id( params[:account_id]) # TODO: check account status is suspended, closed, different flash message? return( error_redirect_gracefully( "Account not found")) unless @account end ... end ## application_controller_spec.rb require File.d...
2006 Jun 05
0
route help using accounts but not with subdomain
...map.connect ''account/list'', :controller => ''account'', :action => ''create'' map.connect '':account_name/:action'', :controller => ''account'' and in the account_controller I have a function before_filter find_account, :except => [:create, :list] I seem to always get into the account/list and can never get into the account/create. Any ideas for the proper routes to get this to work? (hopefully this made sense...) Thanks, Brent __________________________________________________ Do You Yahoo!? Tired of s...
2008 Mar 14
15
Am I off track on my testing?
...? Take the simple example of a controller test for an index action that shows all the forum posts for a user account. The controller code would be something like what is shown below, and on a bad day may take a minute to do (a really bad day) ========= before_filter :login_required before_filter :find_account def index @posts = @account.posts end ========= Now the controller tests are as following, and with the make it fail, make the update, make it pass strategy would could take about 10 minutes. ========= describe PostsController, "index" do before :each do @posts = mock("po...