similar to: [TDD] [Rails] - Rspec test for application_helper.rb fails when trying to access application_controller method.

Displaying 20 results from an estimated 2000 matches similar to: "[TDD] [Rails] - Rspec test for application_helper.rb fails when trying to access application_controller method."

2007 Jul 24
4
spec''ing helpers that use controller
Hi all, I''m in the process of creating rspecs for my helpers. One of the helpers in app/helpers/application_helper.rb looks like this: def page_name @page_name || "Define @page_name in #{controller.controller_name}::#{controller.action_name}" end The rspec is simply: it "should something" do page_name end
2005 Dec 19
1
Application.rb / Application_Helper.rb / DRY help
Hi all, I have defined the following method in both application.rb and application_helper.rb: def still_logged_in? !session[:user_id].nil? end This method is called in a before_filter in my application.rb, as well as in my layout/application.rhtml and view/user/login.rhtml (for showing a login / logout button, etc.) I had to put it both places, otherwise I would get an
2005 Jul 22
3
testing application_helper.rb
I am trying to run some functional (or are they unit?) tests on my application_helper.rb. So far, I''ve not had any success in being able to call the methods defined in application_helper.rb. Here is my app/test/functional/helpers.rb require File.dirname(__FILE__) + ''/../test_helper'' require File.dirname(__FILE__) +
2007 Oct 02
0
Rails 2.0 & rspec edge - not protected_against_forgery?
The new forgery protection is throwing of rspec: NoMethodError in ''ApplicationHelper login-logout when logged in should show the name of the current user'' undefined method `protect_against_forgery?'' for #<#<Class:0x3219118>: 0x34e1f94> /Users/jcf/dev/work/sim/vendor/plugins/rspec_on_rails/lib/spec/rails/ dsl/behaviour/rails_example.rb:41:in
2006 Nov 27
2
ActionMailer & application_helper.rb
Hi, I''m trying to send some emails with the same formatting as my pages & I can''t seem to access my display routines in application_helper.rb. I''m trying a hack to bypass this. At the top of my ActionMailer notifier script I''ve included application_helper.rb - my understanding is that this should arrive as a module and should be able to be used
2006 Mar 16
1
application_helper.rb vs application.rb
I find that I want to put the same methods into both of these files. Whats the best way to get away with a single implemenation? Gareth -- Posted via http://www.ruby-forum.com/.
2005 Aug 16
1
Best way to access constants in application_helper.rb from views?
Hi, I''m using the application_helper.rb file to create some useful functions for generating links by name. I understand that functions defined in this file are available to all views, but what about constants defined in that module? Is there a best practice approach for doing this other than accessing each constant via ApplicationHelper::FOO? Stu
2006 Jun 07
0
Problem with file_column plugin path and application_helper.rb
Hello, I upgraded my Rails app from 1.0 to 1.1.2. Basically everything worked on my development box. When I uploaded the changes (including the frozen 1.1.2 gems) to my webhost most things worked. However I had a problem with my application_helper.rb file. It wasn''t able to find the url_for_image_column method from the file_column plugin. Here''s the relevant code in
2006 Feb 26
0
ActionMailer view templates don''t pick up application_helper.rb?
It seems that helper methods defined in application_helper.rb aren''t available in ActionMailer views. Is that intentional? -- - Adam ** Expert Technical Project and Business Management **** System Performance Analysis and Architecture ****** [ http://www.everylastounce.com ] [ http://www.aquick.org/blog ] ............ Blog [ http://www.adamfields.com/resume.html ].. Experience [
2006 Jun 26
5
using application_helper.rb
I have a simple Yes/No selection list that I am using in a number of places. Thinking that I could DRY things out a bit, I added it to application_helper.rb ... YES_NO = [ [ "Yes", true ], [ "No", false ] ].freeze So I figured I would use it there instead of in each model.rb where needed. anyway, in webrick screen, I am continually seeing this...
2007 Jul 31
11
helper spec not finding rails core helpers
Hi, My helper specs were going ok until I added a call to a rails DateHelper method in one of my helpers http://api.rubyonrails.com/classes/ActionView/Helpers/ DateHelper.html#M000574 The helper runs fine from my view templates, just dies in the spec test. I boiled my question down to a simple (not too useful) example. I''m not sure what I''m missing. #
2006 Mar 04
2
application_helper can "include" another helper ?
My "application_helper.rb" become to large. I have basic functions that I use for all projects. Is it possible to define thoses functions inside an external "basic_helper.rb" and include it in "application_helper.rb" ?
2009 Jun 05
6
rails 2.3.2
Hi all, I am using rails v.2.3.2 and if I put following line to my ApplicationController: include LoginSystem and I moved my login_system.rb to lib folder: module LoginSystem protected def is_logged_in? @logged_in_user = User.find(session[:user]) if session[:user] end def logged_in_user return @logged_in_user if is_logged_in? end def logged_in_user=(user) if
2008 Jul 03
0
Testing HAML in helper rspec
Thought I''d post this under its own heading so others can find it. Thanks to David for the pointers to solve this. Here is the incantation needed to use HAML 2.0 under RSpec 1.1.5 (Needs the .5 for a fix) # application_helper_spec.rb under spec/helpers ... before :each do helper.extend Haml helper.extend Haml::Helpers helper.send :init_haml_helpers end it
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
2007 Aug 27
2
issue with edge rails and urls
I just switched our project over to Edge Rails, and I''m running into this problem with all of my helper methods that call _url methods: NoMethodError in ''ApplicationHelper home_link should generate a valid home link when User.current and Profile.current is not set'' You have a nil object when you didn''t expect it! You might have expected an instance of
2007 Feb 06
2
Login systems : stubbing accounts and AR association proxies
My Rails site has a fair amount of login and ''ownership'' logic. For instance, we have a number of clients (companies), each of which has several accounts. A client owns a number of different types of resources, and shouldn''t see any other clients'' resources, so, for example, our ScenesController contains a lot of references to
2006 Aug 08
1
Suggestion: environment.rb Includes
I like the idea of "instant functionality" Engines can offer, but practical implementation issues make adding and removing more tedious than it should be. The process typically requires: - manual modifications to environment.rb ( e.g., adding engine configuration and "Engine.start :myengine" - manual modification to app/controllers/application_controller.rb This should be
2006 Jul 31
0
MY worker won''t stop working
> On Jul 30, 2006, at 5:11 PM, Chris H wrote: > >> Hi Ezra, >> >> thanks for the reply. >> >> There''s a ruby process that appears in top when I fire off the do_work >> method. >> It uses around 30-50% cpu and disappears once all processing has >> completed. >> >> When I try to stop processing using delete_worker I was
2003 Dec 21
2
ToIP (TDD over IP)
I didn't know if it would work or not, but I figured I'd try slow-speed half-duplex TDD over GSM & Vonage. I called a AGI script I have that speaks to TTYs, by calling from Vonage to one of my Voicepulse lines. I don't control the Vonage codec, so I have no idea what it uses, but I am using GSM for the Voicepulse line. Everything worked fine - echo canceling didn't cause any