similar to: spec''ing helpers that use controller

Displaying 20 results from an estimated 700 matches similar to: "spec''ing helpers that use controller"

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. #
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
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
2011 Mar 21
1
Getting user session object in cucumber
Hi, I am learning cucumber. I have integrated the Devise with my rails 3 application. My problem is I have to write a test which will create a project. For that I have to make sure that user should be logged in. So I have written the user login feature first which is working fine. After that I have written the creation of project scenario. Whenever I am running that scenario we are getting an
2006 Apr 26
2
Retrieving :id without passing it
Ok, I have read most of Agile Web Dev... so I had a question about beautifying URLs using routes.rb. I''m trying to architect a content management system in which a user can create template pages. This way, when a user creates a template page nested within, it displays it as though it''s displaying a folder structure, much like a directory tree (using acts_as_tree). I have a
2006 Apr 03
1
Helpers for ActiveMailer templates
What helpers, if any, should be available to a view for ActionMailer? Even ApplicationHelper methods don''t seem to be available. This is on Rails 1.0. David
2007 Jun 09
11
authentication, controller specs. I think I''m missing something simple ....
Hi all, I feel like I''m missing something really easy and I''m just not seeing it. I''m using the restful_authentication plugin and have a User model. Uesr has_many :things and Thing belongs_to :user. That''s it. I did a "script/generate rspec_scaffold thing" to generate all the necessary bits. The "rake db:migrate" to create the db. At
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 Mar 09
6
AssertSelect for strings?
Hi, Is there a way to use the have_tag matcher on a string instead of the response body from a view? I have a helper in a method rails project that returns an html fragment which I would like to test. Like this: module SomeHelper def some_helper_method "<p>foo</p>" end end context "The SomeHelper" helper_name :some specify do
2006 Jul 25
2
Model relationship confusion ...
Hi all, I''m thinking this must be pretty straightforward, but I''m finding myself kind of going in circles in trying to model a simple "private messaging" app. I have two models: user and message User has many messages Message has a sender (User) has many recipients (Users) I''m at a bit of a loss as to how best define the relationships that occur in
2006 Jul 14
5
Acts_As_Taggable Plugin multiple controllers.
I have Acts_As_Taggable Plugin working. I have a HR controller and a sales controller. I have a document in hr tagged whitepaper and a differnent document in sales tagged whitepaper when I am in hr I see the hr document tagged with whitepaper and not the sale document (what I want). but if I click on the tag whitepaper I return two documents, hr and sales. I just want to return the hr document
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
2010 Nov 29
0
[TDD] [Rails] - Rspec test for application_helper.rb fails when trying to access application_controller method.
In a method named logo in my application helper, I reference an application controller method (current_account) that has been marked as a helper method with the following syntax: helper_method :current_account When I test out the setup in the browser (without rspec), rails is happy with this setup. However, when I run the spec, the spec won''t pass and gives me the following error:
2009 May 06
0
Cucumber, Webrat, RSpec and Mechanize for Non-Ruby Apps
The folks here have given me the task of figuring out if cucumber can be used successfully to test some of our apps. I have the latest versions of rails, mechanize, cucumber webrat and rspec installed. #/cuketest/features/google.feature Feature: New PC In order to get a sweet new PC As a apple nerd I want to find apple.com Scenario: Get a sweet new computer Given I visit
2007 Aug 17
4
should_receive, used in the wrong place?
What do you guys think of this: if someone calls should_receive outside of an "it" block, it warns you. before(:each) do @foo = Foo.new @foo.should_receive(:monkeys) end would warn you that you''re setting an expectation in the wrong place, and that "stub" is correct when setting up objects. Opinions? courtenay
2008 Mar 19
3
ApplicationHelper
When working with views, I use instance methods of ApplicationHelper: # app/helpers/application_helper.rb: module ApplicationHelper def distribute(total, min, cutof, list) [1,2,3] end end # app/views/planner/_mta_colors.rhtml: <td> <% ... dist = distribute(total_v_px, 4, 0, colors.collect{|color| color[1]}) ... %> So to test the distribute method in ApplicationHelper, I have
2006 Mar 25
3
Rails Plugins: Why to register your own functionality with send()?
Hi there, I have seen in the file column plugin ( http://www.kanthak.net/opensource/file_column/) from Sebastian Kanthak or David''s acts_as_taggable plugin that to register my functionality I need to do something like this: ApplicationHelper.send(:include, InPlaceEditAssociations) I am wondering why not: (a) module ApplicationHelper include InPlaceEditAssociatons end or: (b)
2011 Apr 08
5
How to extend a helper using plugin?
Hello, I''m facing this problem while trying to extend the parse_redmine_links helper method in Redmine-1.1.0 (Rails-2.3.5) from my plugin. My idea is to use alias_method_chain so the extended version could call the original version and adjust the result to it''s liking. Anything I''ve tried so far exposes this behavior: the first render of a page uses the extended
2009 Apr 12
4
Can't get an Array function to be visible inside ApplicationHelper
Folks, I seem to be missing something basic here. I am trying to call a function from my application layout that will return me a hash of the roles for the user currently signed in. Here is the simplified code I have in ApplicationHelper module class Array def to_h Hash[*enum_with_index.to_a.flatten] end end def get_cur_user_roles ["school_admin",
2007 Jun 12
3
rspec 1.0.x and liquid?
Is anyone else using liquid with the > 1 rspec? This seems to fail: it ''should render show'' do response.should render_template(''buyers/show'') get :show, :id => 1 end with an error like 1) NoMethodError in ''/buyer GET should render show'' You have a nil object when you didn''t expect it! The error occurred