Displaying 20 results from an estimated 900 matches similar to: "Issues with Functional Tests"
2008 Feb 12
0
button_to problem http://localhost:3000/art/151470;edi
hi all,
now i am facing problem with button_to , it shows the path like
http://localhost:3000/art/151470;edit instead of
http://localhost:3000/art/edit/151470
the path is not displaying problem, so i got the error , no route found.
in application_helper :
def button_to(name, options = {}, html_options = nil)
html_options = html_options.stringify_keys
2007 Sep 04
2
How can i add a confirmation dialog to a submit_tag?
When i use button_to or link_to, i can easily request a confirmation
dialog with (for example)
<%= button_to "Delete this story",
{ :controller => "story", :action => "delete", :id => @story.id },
:confirm => "Delete story: are you sure?" %>
I also want to do this for the submit buttons on my forms, which are
2007 Jun 22
5
assert_select trying to verify the presence of a textarea
Hello,
One of my functional tests looks like this:
def test_presence_of_free_text
profile = Profile.find :first
post :edit, {:id => profile.id}
assert_select "textarea", :name => "record[free_text_ec]"
end
The test results in a failure, because the element cannot be found.
I''m pretty sure the element should be there, and I''ve tried
2007 Jan 26
0
Problems with assert_select in integration tests
I''ve been battling with assert_select in my integration tests for
several evenings now. I''m testing a multi-step form, and after
submitting the first step, my assert_selects fail on the attempts to
find the form on the next page. However if I print out the response
object, it has the exact text of what I''m trying to match.
Here is the complete integration test. The
2007 Jan 28
0
assert_select alternative
Hey guys,
I was having issues with some of the way assert_select worked, so I
wrote an alternative to assert_select using hpricot.
The major differences:
* You get full support for CSS3 and limited XPath
* It uses hpricot, which is fast; plus you get improvements to hpricot
for
free in assert_elements as long as you update the gem.
* Blocks work a bit differently (assert_elements tests whether
2007 Feb 24
2
RESTful PUT and button_to
I''m working on a RESTful app, and I''ve hit a snag. Here''s a
simplified example of the problem. (Excuse me if this example code
isn''t strictly correct; I''m typing from memory.)
Suppose I have a table which models a simple counter. It has a single
column, "count":
class CreateCounters < ActiveRecord::Migration
def self.up
2008 Jun 15
11
[PATCH] helper to create fb css stylized table
I attached a rails helper implementation of the fb_table described here:
http://wiki.developers.facebook.com/index.php/Facebook_Styles
I included testing and comments. I hope you find it useful.
Curiously, it''s really a small extension of FBML.
Richard
-------------- next part --------------
Index: test/rails_integration_test.rb
2006 Jan 20
1
form_tag and multiple buttons inside problem
Hi, I have a bit of a problem with a form in rails. Well, the problem really is
me not fully understanding the mechanism of the form_tag, so here''s what i try
to do:
The idea is to present a some edit fields for some @product attributes and then
present a table showing the @product.pieces (pieces for every @product) and to
include a "Edit Piece" and "Delete Piece"
2007 Jan 24
7
Differences between assert_tag and assert_select
Hi all,
I can't seem to make assert_select work for the more complex cases for me.
Here's a sample:
# View
<%= link_to_remote 'Add new', :url => new_phone_url, :submit => 'phones_head' %>
# Generated code:
<a href="#" onclick="new
Ajax.Request('http://test.host/admin/parties/phone/new',
{asynchronous:true, evalScripts:true,
2011 Nov 18
1
What does :count actually mean in assert_select?
Hi guys,
I tried reading up the RSPEC Book (Dec 2010) and googled a bit but I
could not find anything.
I''m using Rspec2.
Example:
spec/factories/categories.rb
======================
FactoryGirl.define do
factory :category_intakes, :class => ''category'' do
name ''intakes and filters''
description ''airfilters and
2010 Aug 27
6
assert_select for <p><b>text</b>value</p>
I have the following html
<p><b>text</b>value</p>
I can use
assert_select "p>b", "text"
to check the text portion, and
assert_select "p", "value"
to check that the value appears in a <p>. I cannot work out how to
check that the two are in the same <p>. I have used assert_select for
much more complex tasks but my mind
2006 Jul 24
2
:disable_with for button_to ???
With form_tag submit buttons I use the " :disable_with => ''button label while processing'' " option so that visitors with slow connections aren''t able to submit forms twice.
How do I do the same thing with button_to?
I''ve got several pages where there are multiple forms on the page being updated with Ajax so I can''t wrap the whole
2007 Jun 25
1
Functional tests and active scaffold: unexpected assertion failure.
Hello,
I''m writing a functional test for a controller that uses active
scaffold.
def test_presence_of_field
login_as(:peter)
profile = Profile.find :first
get :edit, {:id => profile.id}
assert_response 200
assert_select "textarea#record_free_text_ec"
end
I was expecting the first ''assert 200'' to give me a green bar,
but added it for
2006 Mar 25
5
button_to with image?
I''m trying to use button_to and have it use an image in place of the
submit button. I had figured it would work the same as link_to like so:
button_to(image_tag("editicon", :size => "16x16", :border => 0), :action
=> ''edit'', :id => person.id)
but this instead displays the image code as the button name. Surely
there is a simple way to
2008 Feb 18
0
is assert_select indicated for XML?
Railsers:
I''m playing with the Beast, and this test fails:
def test_should_show_topic_as_rss
get :show, :forum_id => forums(:rails).id, :id => topics(:pdi).id,
:format => ''rss''
assert_response :success
assert_select ''channel''
end
It emits "ignoring attempt to close channel with link".
So why are
2007 Apr 26
2
assert_select with respond_to JS or xhr?
Hi everyone,
I am a bit confused with xhr? and respond_to.
I have the folloing code in my view to update the ''emails'' ID
link_to_remote(image_tag("refresh"), :update => "emails",
:url => { :action => "list_emails" })
in the controller side i have somthing like :
[..]
respond_to do |type|
type.html { render :action
2012 Aug 10
1
button_to with image
I''m calling button_to in my page, and it renders a form with a submit
button just fine. But what I''d really like is
<input type="img" src="myimage.png" .....>
instead of
<input type="submit...>
button_to doesn''t seem able to do this, :type and :src parameters get
ignored. Is there a way to do it?
--
Tim Slattery
2008 Dec 13
3
Bug with assert_select and javascript?
Hi, I am using Rails 2.2.2 and have some javascript in my html.erb file
in the body of the document, inside script tags. The script (which works
as intended) contains the line
for(var i=0; i<boxes.length; i++)
In my functional tests I use assert_select and it is generating a
warning "ignoring attempt to close boxes with script". It appears to be
interpreting the text
2007 Mar 19
3
Assert_select
Hi all
This is my first post here. I ave been using Rails for a couple of
months, and am starting to put together a test suite. But I''m having a
problem with assert_select in my functional tests.
According to the documentation, it should be fine with two arguments -
a CSS selector and a string to test it against. But no matter what I
do I keep getting the exception:
wrong number of
2009 Mar 26
0
assert2-0.4.6 provides assert_xhtml, an alternative to assert_select
Rubyists:
Consider the following monstrosity, coded using assert_select:
assert_select "div#logo_box img[src=/0000/0001/logo.gif][alt=My Company]"
Now, behold it rewritten to use assert_xhtml:
assert_xhtml do
div.logo_box! do
img :src => /logo.gif$/, :alt => ''My Company''
end
end
That sample contains more Ruby; it''s not just