Displaying 17 results from an estimated 17 matches similar to: "Is it still possible to use should_have_rjs"
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 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
2007 Jun 27
2
Controller specs not shareable?
Hi
I just wondered if there was a reason why Rails controller specs are
not shareable? eg
describe "All XHR POSTs to /gap/calculate_quote", :shared => true do
controller_name :gap
# ...
end
describe "XHR POST /gap/calculate_quote with valid details" do
it_should_behave_like "All XHR POSTs to /gap/calculate_quote"
# ...
end
blows up with
2008 Apr 01
2
Functional Testing - page actions
Pretty simple question, I''ve tried to ajaxify some actions and the first
one I did was a delete -
def delete_job
.....
render :update do |page|
page.remove "job_#{id}"
end
....
end
and in my functional test I call this function via post
def test....
post :delete_job, :id => 1
assert_response :success
......
end
after the assert_response, how do I test that the page
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:
2012 May 13
1
is assert_select_rjs deprecated in Rails 3.1 ?
I have seen it in 3.0.9 doc (
http://apidock.com/rails/v3.0.9/ActionDispatch/Assertions/SelectorAssertions/assert_select_rjs
)
but it''s not mentioned in the latest guide (
http://guides.rubyonrails.org/testing.html#integration-testing-examples)
if deprecated how can I check the view from an Ajax call
( assert_match + gsub could work ? ... )
am I missing any doc ?
xhr :get, :change_area,
2007 May 11
2
spec a replace_html with a partial
I wanted to use ARTS to add RJS in a behaviour driven way to my
application, but I''m having some trouble asserting a replace_html with
a partial.
I''ve created a pastie (http://pastie.caboo.se/60694) which contains
the RJS I want to spec, the spec which I already wrote and its failure
message.
I''m currently using RSpec-0.9.2
2007 Aug 21
1
Render template not matching absolute path
Hi
I have a simple controller method like this:
class StylesheetsController < ApplicationController
layout nil
session :off
def gap
site = Site.find_by_hostname(request.host)
@colours = site.colours
respond_to do |accepts|
accepts.css { render :file => "#{RAILS_ROOT}/app/views/
stylesheets/gap.rcss" }
end
end
end
And I want to test that
2007 Dec 20
19
Story runner rake task
What''s the status on a rake task for the story runner. If nothing is
in progress, where could I start to try and build one?
JD
2007 May 01
2
Problem validating boolean
Hi
I''ve got a problem validating a boolean and I can''t see what the
problem is. Here''s my model:
class FinanceAgreement < ActiveRecord::Base
belongs_to :asset
validates_presence_of :finance_company
validates_inclusion_of :balance, :in => 0.01..10_000_000
validates_inclusion_of :term, :in => 1..600
validates_numericality_of
2007 Feb 13
1
RJS specs
Hi again...
This is wierd spec problem no. 3. I''ve got a simple one line RJS
file that renders a partial specified by the controller
page.replace_html("product_info", :partial => @product_partial)
The partials in question will contain purely static content - the
idea is to have some dynamic links, so you hit
http://localhost:3000/gap/product_info/product_1
2007 Jan 25
0
Testing RJS select method
Hi
How can I test this kind of RJS code?
page.select ''#id .class''.each do |element|
element.removeClassName(''whatever'')
end
I know that should_have_rjs admits a block, but i don''t know exactly
which is its purpose.
And I can test that the "select" part is beign called, but I don''t
know hot to test the "removeClassName"
2007 Oct 25
0
specs for RJS
What''s the current best practice for spec''ing (and stubbing) RJS?
response.should have_rjs(*args, &block) from rspec_on_rails works well
for things that
assert_select_rjs supports. But for other things, like say
page[:elm].add_class_name :class_name, it''s not clear to me the best
way to test for this.
I''d love to be able to do something like
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 =>
2006 May 30
0
The ARTS Plugin: Another RJS Testing System
If you missed it, I''ve written a plugin for testing RJS that uses
(basically) the same syntax as the RJS templates themselves. Here''s a
taste:
assert_rjs :alert, ''Hi!''
assert_rjs :assign, ''a'', ''2''
assert_rjs :call, ''foo'', ''bar'', ''baz''
assert_rjs :draggable,
2007 Feb 06
0
assert_select_rjs with on a page with "page.select" in it
I''m having a bunch of testing an RJS action. The action updates a DIV if it
exists, but it isn''t always necessarily present on the page so I use a
page.select in the RJS to check if it exists. (Is there a better way to do
that?)
Let''s say we have an RJS page containing:
page.select("some_element_that_may_or_may_not_exist").each do |value|
2007 Oct 25
0
How to spec a render:update call
Hi folks.
I''m trying to work out how to verify that a controller has called a
render:update block similar to:
render :update do |page|
page.replace_html ''edit'', :partial => ''form'', :locals => { :operation
=> ''edit'', :submit_button_value => ''Update'' }
end
We used to test this with something