Displaying 20 results from an estimated 1000 matches similar to: "How to spec a render:update call"
2007 Sep 27
1
using @variables in an ''it'' block
Hi folks,
I''m somewhat new to the current RSpec release - at work we are still
using 0.8.something, with "context ''blah'' do ... specify ''should
thing'' ..."
We have some helper code to automatically mix-in selenium:
module SeleniumHelper
include SpecHelper
...
def initialize(arg)
@selenium = SeleniumHelper.selenium
end
(selenium.rb
2008 Jan 23
4
expect_render(...).and_return(''x'')
Hi,
I''m trying to spec a controller method which renders some rjs as part
of a render :update block. The problem I''m having is that stub_render
or expect_render don''t seem to allow and_return to work.
The controller method does:
if @thing.save
render :update do |page|
page.insert_html :bottom,
2008 Mar 05
3
having trouble specing an ajax request
Do I need to spec an AR. If yes, what is the best way to spec this.
here is the code -
def index
@deals = Deal.paginate(:all, :conditions =>
prepare_search_conditions, :order
=> ''created_at DESC'', :page => params[:page]
)
if request.xhr?
render :update do |page|
page.replace_html "table", :partial =>
2008 Mar 04
3
rspec vs. test::more
Hey all,
you HAVE to read this blog post:
http://blog.jrock.us/articles/RSpec%20vs.%20Test::More.pod#comments
My favorite parts are:
1)
... some rspec code ...
> For the sake of comparison lets translate this directly into perl:
... some perl code ...
2)
>First, notice that the rspec-version isn''t actually ruby code. It''s
not any real language.
For the sake of
2007 Jul 14
3
expect_render twice in views
I found this:
controller.expect_render(:partial => ''thing'', :collection => things).once
but I am trying to expect_render twice in my view spec:
template.expect_render(:partial => ''order_details'').twice
This doesn''t work as the template.expect_render call seems to be
returning an array. Is it possible to expect the rendering of a
partial
2008 Jun 13
1
shallow over http or ftp not supported
I am trying to install a custom plugin in my Rails app:
script/plugin install http://git.eyequeue.net/plugins/mt_capistrano.git
Instead of installing the plugin, I get the following error:
shallow over http or ftp not supported
Any ideas on how to fix this? Is it OK to do a git clone in my vendor/
plugins directory?
--~--~---------~--~----~------------~-------~--~----~
You received
2008 Mar 12
2
RSpec view test for :partial with :locals?
I''m currently working on some RSpec view tests and I''m having problems
with expect_render. Most of the expect_render''s work fine, but in one
of my views I have:
<%= render :partial => "user_cloud", :locals => {:user =>
@featured_user} %>
I see that expect_render supports ":object" or ":collection" for the
second
2007 Sep 14
5
controller.expect_render has me beat!
Hi,
A controller has a method with the following
def update
...
if @config.update_attributes( params[:new_config] )
redirect_to :action => :index
else
* render :action => :edit, :id => params[:id] # this line here*
end
...
end
The example has the following
it ''should render the "edit" config url on an unsuccessful save''
2008 Jan 22
0
Trying to spec ExceptionNotifiable behavior
Hello List.
I''m trying to overwrite part of ExceptionNotifiable
(ExceptionNotification plugin) to render customized error 500 pages
based on browser agents.
For this, I''ve created a fake controller that inherits directly from
ActionController::Base:
class FooExceptionController < ActionController::Base
include ExceptionNotifiable
# this action should not fail, used for
2007 Aug 13
8
How to use expect_render?
Hi:
I am a rspec beginner. I have scratched my head for the whole afternoon,
trying to figure out a way of writing render expectation in controller spec.
However, I failed. It kept telling me that the ''expect_render'' was an
undefined method. I have installed rspec 1.0.8 and rspec_on_rails as well.
Below is the controller to be tested.
Controller
def index
pre
2006 Jul 24
0
Ajax page.replace_html model validation render partial errors
Hi; I have the following setup:
A model: that validates using helpers like: validates_presence_of, etc..
A view: called ''new'' which renders a partial
The partial: _form which has error_messages_for and a
form_remote_tag , submit_tag and end_form_tag
An action ''create'': that gets executed via the submit_tag in the
_form and which
in case it can''t
2007 Jun 27
3
template.expect_render
Trunksters,
I just added a couple of methods to ActionView::Base in Spec::Rails
(as of r2136) that lets you do this in view examples:
describe ''/things/index.html.erb'' do
it "should render _thing with a collection of things" do
assigns[:things] = things = [Object.new]
template.expect_render(:partial => ''thing'', :collection => things)
2005 Dec 26
0
[rjs] How can I render a action template instead of partial
Hi,
I want to render a action template with rjs, so instead of doing this:
page.replace_html ''maincontent'', :partial => ''list'' I want to do this:
page.replace_html ''maincontent'', :action => ''list'' but the render (that
is called by replace_html, outputs to the reponds_body), so it doesn''t work.
Is there a
2009 Mar 05
3
How to render :partials *before* the :action has finished ?
Hi there,
I''m sure a lot of you guys have come across this question:
How can we render several :partials on a page *before* the called
:action has finished?
Basically, my situation is this:
When I click on a certain button, 3 things are supposed to happen:
- INSTANTLY: the button should become disabled (either by setting
":disabled" to "true" by updating the
2007 Aug 14
12
expect_render, why does there need to be a warning
There is a warning on the web site about expect_render and stub_render:
"WARNING: expect_render and stub_render, while very useful, act
differently from standard Message Expectations (a.k.a. mock
expectations), which would never pass calls through to the real
object. This can be very confusing when there are failures if you''re
not aware of this fact, because some calls will be
2008 Dec 10
3
rspecing rjs - form.reset(''form'')
Hello,
>
> I couldn''t find much info on this.
>
> How do you rspec this: page.form.reset("form")
>
> I looked in the have_rjs source code and I can''t find anything on form
> reset.
>
> Thanks,
>
> --
> Andrei
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Aug 17
0
confused about scoping in controller when using render
Hi. Can anyone tell me why I cannot access the testmethod inside my
change controller? Thanks very much for any help. I get an undefined
method error. If I call the method outside the render :update (as in
the comments) it works fine. Thanks very much.
---- view ----
<%= javascript_include_tag :defaults %>
<div id="result">testing</div>
<%= link_to_remote
2010 Jul 25
0
render :update with different controller does nothing
Hi!
I want to render 2 different actions - in different controller - when
the user clicks on a button.
I solved this with JS calls (Ajax.Updater) within the view,
but wanted to take the app logic out of the view and into the
controller.
So I created a new controller action, calling the 2 updates from there
like this:
render :update do |page|
page.replace_html ''Browser'',
2008 Aug 08
2
template.expect_render fails when partial is rendered from a helper
My spec;
describe ''subnav rendering while logged in'' do
before do
template.stub!(:logged_in?).and_return(true)
template.stub!
(:current_profile).at_least(:once).and_return(mock_profile)
end
def do_render
render "/homepages/show.html.erb"
end
it "should render the logged in partial for homepages" do
2006 Jul 26
0
page.replace_html render(:action => ''other_action'')
I want to be DRY. I have a controller action, component, that renders
html.
I have another controller action, component_update, that returns RJS:
This what I''d like for ''component_update.rjs'':
page[params[:scaffold_id]].replace_html render(:action => "component",
:layout => false)
page[params[:scaffold_id]].visual_effect :highlight
But, the render is