Displaying 20 results from an estimated 10000 matches similar to: "How to assert a simple link (testing)"
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,
2006 Dec 04
5
ruby on rails ecommerce tests are failing, but why?
i am working through the Beginning Ruby on Rails Ecommerce book and on
page 101 where it is talking about integration tests, i run
test/integration/book_test.rb and it fails giving me the following
error message:
1) Failure:
test_book_administration(BookTest)
[test/integration/book_test.rb:45:in `add_book''
test/integration/book_test.rb:11:in `test_book_administration''
2007 Jul 22
2
have_tag for href with specific link?
Hi folks,
I''m trying out this idea of "outside-in" and writing specs for my views
first. Being a person who generally starts with some scribbles of a user
interface and moves right to models, this has yet to be fun, but I''m
giving it a shot.
My question: I''m trying to specify that an index page should show a list
of things, each with a link to a delete
2007 Mar 09
6
AssertSelect for strings?
Hi,
Is there a way to use the have_tag matcher on a string instead of the
response body from a view? I have a helper in a method rails project
that returns an html fragment which I would like to test.
Like this:
module SomeHelper
def some_helper_method
"<p>foo</p>"
end
end
context "The SomeHelper"
helper_name :some
specify do
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
2006 May 04
6
second assert_tag failling in rails integration test
Hi all,
I''m fairly new to rails and ruby, but I''ve come across an interesting
glitch and I''m not sure whether I''ve just got something wrong with my
assumptions or if it really is an error in the underlying framework...
I''ve created a bare-bones set of tests to show you where the problem is.
What follows are the steps I went through to reproduce the
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 Jun 15
5
[Fwd: Functional test problem]
Anyone?
-------- Original Message --------
Subject: Functional test problem
Date: Wed, 14 Jun 2006 19:49:03 +0100
From: Chris T <ctmailinglists@gmail.com>
Reply-To: ctmailinglists@gmail.com
To: rails@lists.rubyonrails.org
Embarrassingly late (apps already well advanced), have decided top get
to grips with testing and am having a week hopefully covering everything
I''ve
2007 Feb 13
16
Error against latest trunk while testing via spec for model
Hi
I just did an update to lates trunk
=================
context "Given a generated venue_spec.rb with fixtures loaded" do
fixtures :venues
specify "fixtures should load two Venues" do
Venue.should have(2).records
end
end
==================
gives me
==========
1)
TypeError in ''Given a generated venue_spec.rb with fixtures loaded
fixtures should load two
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
2007 Nov 27
1
routing
Hi all,
My site uses subdomains to define an item. Eg http://itemname.mysite.com
I fetch the itemname and render the appropriate site from that
itemname. The subdomain is used everywhere (eg http://itemname.mysite.com/events,
http://itemname.mysite.com/products/show/11, ...)
I now want to give the user the possibilty to use a ''real'' domain like
www.itemname.com that should
2005 Nov 23
2
functional tests, assert_tag and tables
I''ve run into another functional testing issue. Odds are I''m taking the
wrong approach, so I''m back to this list again in the hopes of finding
the true path.
with assert_tag, I''d like to check the values of various table cells and
ensure that the proper values are placed in the appropriate places. I
written some tests that make good sense to me, and in
2006 Jul 07
2
Testing views with Hpricot
assert_tag smells bad. Hpricot smells nice (apricotty!).
Testing your views with Hpricot:
http://www.lukeredpath.co.uk/index.php/2006/07/07/testing-your-rails-
views-with-hpricot/
Big thanks to _why for a great little library!
Feedback is appreciated. rSpec integration coming soon (hopefully!).
Cheers,
Luke Redpath
contact@lukeredpath.co.uk
-------------- next part --------------
An HTML
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
2007 Sep 14
6
Need help in View Spec
Hello everyone:
I am kind of puzzled in writing spec on view partials. I can not find much
information about the "should have_tag" syntax in Rspec. Can rspec test a
particular attribute of a tag (e.g. input tag)? Let me put an example here:
#../view/group/_index
<div id="test">
<input type="button" value="update" onclick="update()"
2007 May 21
9
Ordering in view specs using have_tag and with_tag
When writing view specs is there any way to test not only for the
presence of tags (have_tag) and nested tags (with_tag), but also test
that they appear in a given order?
For example, consider the following:
it ''should display the login names, display names and email
address in alternating rows'' do
response.should have_tag(''div.odd>div'') do
2009 Dec 23
4
html parser / assertions in a model
I am using http.get in a model to parse html code returned from a Oracle
server.
My first try was to use assertions (assert and assert_select) to test
and parse the html code. But I have problems including the methods in
the model. Have tried both "include" and copy/paste to get assertion
methods into my model. Works as a model, but I get load errors when I am
using the model from a
2009 May 23
9
undefined method `assert_select'
I''m having trouble getting the specs to run for a plugin where I want to
fix a bug. (I''ve actually already found and fixed the bug, but I don''t
want to submit a fix without a test!) When I started the specs weren''t
running, but it may be that I''m using Rails 2.3.3 and the plugin has
been tested on 2.1 and earlier. I went through writing a spec for a
2007 Mar 23
2
assert_select VS assert_no_tag
Hi everybody.
Assert_no_tag will be deprecated soon. How can i use assert_select for
checking not existed tag?
Thanks.
Bye.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To
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