similar to: Rails Helpers

Displaying 20 results from an estimated 20000 matches similar to: "Rails Helpers"

2006 Nov 22
3
Controller Isolation
Hi, I have a project that I had running under rspec 0.6.x and recently upgraded to 0.7.2. I am trying to isolate my controllers from the database as I go through and change all the specs to run under 0.7.2. I am having a problem where I need to make the create! method return the mocked object as well as raise RecordInvalid exception. Is this at all possible? I use the rescue statement in my
2010 Aug 18
2
RSpec 2/Rails 3 - content_for in view specs
My main layout includes separate content_for/yield sections for my header, sidebar, footer, and content. However, when running a view spec, the `rendered` variable seems to only contain a string of just the primary content and ignores the header/footer/sidebar as well as the rest of my layout file (the "render" call just returns my primary content wrapped in generic <html> and
2007 Jan 09
6
rcov seg fault
Hi Trying to get rcov going (has been working), but with the following context and specs it fails. context ''/account POST with invalid attendee'' do controller_name :account setup do Attendee.stub!(:create!).and_raise(ActiveRecord::RecordInvalid.new( Attendee.new)) end specify ''should raise on create'' do Attendee.should_receive(:create!).with({
2008 Jan 29
3
I thought the RSPec community might be interested
in my latest blog posting :http://talklikeaduck.denhaven2.com/articles/2008/01/29/why-i-dont-mind-using-rspec-in-fact-ive-come-to-love-it -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/
2007 Apr 13
4
mock out render call in helper
Hello, Does someone know where I can hook in to mock out a render call from a helper in Rails? I know I can do this in view specs with the following @controller.template.stub!(:render) but template doesn''t seem to be attached to @controller in a helper context. Thanks. -Chris
2007 May 20
9
How to test for exceptions
Hi folks, I''m in the process of converting a Test::Unit functional test to RSpec, but I''ve run into a slight problem. I tried looking through the documentation but I still don''t know what I missed. Thanks in advance, Blake describe VenuesController, "on update" do before(:each) do @venue = mock("venue")
2007 Dec 20
3
How-to spec this helper method?...
Hey gang, I have this dead-simple method defined in a helper: def add_category_link(name) link_to_function name do |page| page.insert_html :bottom, :categories, :partial => ''category'', :object => Category.new end end Where, and mostly how, would I spec this? I haven''t been able to find how to stub the rjs in a helper spec, so
2005 Jun 15
1
Old but Gold
Everyone, Im sure you've seen this error a million times, but Ive looked everywhere I can think of & still haven't found a solution that works. I'm trying to make an outside call, I can call the physical phone from a xlite on another pc (and vice versa) but whenever I try to make a call to the outside world, this happens: on the CLI: Jun 15 08:45:20 NOTICE[10390]:
2011 Jan 22
1
uninitialized constant ActionView::Helpers::TagHelper::ERB (NameError)
I am a new to ruby and rails and am trying to refactor some code with rspec and have run into a problem that has stumped me for a few days and I have searched google and ruby/rails forums to no avail so I really hope somebody can help me out with this problem which I think may be caused by a rails config problem. Anyway, I used ''rails new myapp'' to make a new rails project and
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
2007 May 17
4
How to mock helpers in view specs ?
Hi all, I am mocking the following Rails view (inside a partial): <%= render :partial => "forums/forum", :collection => forum_category.forums.readable_by(current_user? ? current_user : nil) %> My spec fails with the following message: 1) ActionView::TemplateError in ''forum_categories/index (anonymous user) should only render forums accessible to anonymous
2007 Jun 01
1
redirect_to a relative path
In a controller spec, doing something like: response.redirect_url.should == omglolsrofls_path ... fails, as so: expected "/omglolrofls", got "http://test.host/omglolrofls" (using ==) You can see that the http://test.host is prepended to the path. My controller is indeed redirecting to the omglolrofls path, and not the url. Is this expected ? Oh... and that''s an
2010 Mar 10
0
How to test helpers in a Sinatra app?
I am using rspec and trying to test some helpers, but for some reason can''t get rspec to read my methods in my helpers.rb file. I include the helpers file in the helpers spec...in the spec I run a test with a method from my helpers file and I get an error saying: undefined method for my_method Any ideas suggestions, that''d be great. -- Posted via http://www.ruby-forum.com/.
2005 Jun 15
1
phantom answer
People, My goal is to get asterisk dialing out via my landline (POTS) from a sip softphone. Ive got the phone, The TDM400p is installed and working. (See below) When ever I dial a number that is directed to the outgoing port on my card (fxs/fxo?) I get no ringing, then it claims its been answered. the CLI reports the following: Executing Dial("SIP/301-f97a",
2007 Mar 15
5
rake spec:views no transaction error
Hello, I have recently upgraded to the 0.8.2 release of rSpec, and I am receiving the following message with each view spec execution: WARNING: there is no transaction in progress I have upgraded the rspec_on_rails plugin as well, and both the model and controller tests are working flawlessly. Is there some simple step I missed? thanks for the input. -Chris -------------- next part
2006 Nov 16
0
helpers not rendered in views?
https://rubyforge.org/tracker/index.php? func=detail&aid=6713&group_id=797&atid=3150 I''m not sure if this is true of all helper methods but it is for the following. In this case the forn_remote_tag is rendered as an empty line. Apprently helpers are not rendered in view tests... template _xyz: <div> <% form_remote_tag :update => "some_div", :url
2007 Dec 09
0
Writing Specifications for Custom Form Builders (and Helpers)
Hello all, Long time reader, first time poster! I am a relative newcomer (no idea what on earth I am doing) to Ruby, Rails and Rspec and have a feeling I am probably trying to run before I know how to walk. I had imagined a cool way of outputting a div around some form stuff which would have a class on it if the related field had errors, something a bit like: <%
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. #
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 Apr 19
5
Best practice thoughts: Model helpers, mocks
Hello! I''m pretty new to unit testing, and have only been using RSpec for a few weeks. I found that for my controller specs, my setup methods were getting very long building mocks/stubs for all the model objects I needed to work with. I''ve started creating helpers like the following for each of my models. The "min_" methods are short for "minimum", and