Displaying 20 results from an estimated 4000 matches similar to: "RSpec view test for :partial with :locals?"
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
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 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
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 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,
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)
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 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 =>
2007 Sep 25
12
Problems with expect_render
Hi there,
I''ve been working with RSpec for about a week now, and the process of
moving from a Test::Unit + Mocha setup to an RSpec + Mocha
environment has been pretty straightforward.
Except, I''m having problems with using template.expect_render.
I have Mocha enabled with:
> config.mock_with :mocha
in spec_helper. And then I have a view spec which looks like this:
2008 Oct 24
4
Correct way to spec partials
Hi everybody,
1) Does anybody have full working example of how to test partial templates?
2) What the correct place to test partials: controller or view spec? If
controller correct place,
should I use integrate_views?
3) Is it true that expect_render is deprecated and I have to
use should_receive(:render)
4) How to test that partial''s locals hash is correct?
Thx
-------------- next
2007 Aug 13
3
RSpec-1.0.8
The RSpec Development Team is pleased to announce the release of RSpec-1.0.8.
RSpec 1.0.6 is the "holy cow, batman, it''s been a long time since we
released and there are a ton of bug fixes, patches and even new
features" release. RSpec 1.0.7 and 1.0.8 deal with a regression
introduced in 1.0.6 and a hiccup in releasing 1.0.7, respectively.
== RSpec
RSpec is a Behaviour Driven
2008 Jun 02
1
Cherry-picking mocks?!
A colleague just came in and asked me about a problem he was having with
stub_render, which reminded me of another issue he had a week or so ago,
which seems related.
Let me start with the earlier issue.
He was trying to write specs for a method which sends the same message
possibly multiple times, but with different arguments under different
calling conditions. He wanted to write
2009 Mar 15
0
rspec-rails 1.2.0 Released
rspec-rails version 1.2.0 has been released!
* <http://rspec.info/>
* <http://wiki.github.com/dchelimsky/rspec>
* <http://wiki.github.com/dchelimsky/rspec/rails>
* <http://wiki.github.com/dchelimsky/rspec/upgrades>
Behaviour Driven Development for Ruby on Rails.
Changes:
### Version 1.2.0
IMPORTANT INFORMATION: Due to changes in Rails-2.3, there are some changes
in
2007 Sep 08
3
template.expects_render?
Hi All,
I''m trying to make use of template.expects_render, is outlined in
David''s post(http://blog.davidchelimsky.net/articles/2007/06/28/
template-expects_render). I get an undefined method error on
expects_render. I made sure I had the 1.0.8 gem as well as
reinstalling the plugin and redoing the bootstrap. Still no luck. So
I created a clean project, installed the
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 Jul 28
2
specing a call to render :layout => "some_layout"
I''m trying to specify that an action should be rendered with a given layout
one particular spec.
What I''ve got at the moment is this.
it "should render with the grabber layout" do
controller.should_receive( :render ).with( :layout => "my_layout" )
do_get
end
This doesnt work even though this call to render is being executed.
render :layout
2007 Oct 01
15
how to spec views
I''m trying to spec a view but haven''t done much view specing.
This view render different partials depending on authentication of the user:
annon, admin, player
So I I''ll write if conditionals in the view with the partials
it "should render signup propaganda for annon users trying to view games"
do
render "/games/index.rhtml"
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone,
I am relatively new to rspec and I am running into a wall in testing my
views. I have a RESTful resource Contracts with a nested resource of
Line_items.
I am trying to figure out how to test the "edit" form of the Line_items.
What complicates this is the nested routing and how to account for it,
and that there is a partial form (_form.haml) that both the edit.haml
and
2008 May 03
4
silly partial qu
hi all,
i''m just trying to check a partial has been rendered, by using:
response.template.should_receive(:render).with(:partial => "tasks/list")
this passes, even if I put something bogus in the partial name, such as:
response.template.should_receive(:render).with(:partial =>
"___tassdfsdfks/list")
does anyone know why this doesn''t fail?
is this the
2015 Sep 30
1
Re: [PATCH 2/2] ocaml: Improve ocamldoc.
On Wednesday 30 September 2015 10:19:10 Richard W.M. Jones wrote:
> Miscellaneous improvements to the ocamldoc:
>
> - Generate more sub-headings.
>
> - Document the object-oriented API.
>
> - Use a common function to generate the doc for module and OO APIs.
> ---
Mostly OK, except ...
> + let generate_doc ?(indent = "") f =
> + if is_documented f