search for: assert_select

Displaying 20 results from an estimated 56 matches for "assert_select".

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 mi...
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 the following combinations as well: assert_select "textarea", :name...
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/p...
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 arguments (6 for 2) It''s defnitely the assert-select line that''s...
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...
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 differe...
2011 Nov 18
1
What does :count actually mean in assert_select?
...elper'' describe "categories/index.html.erb" do before(:each) do assign( :categories, [ FactoryGirl.create(:category_intakes), FactoryGirl.create(:category_audio), ] ) end it "renders a list of categories" do render assert_select "tr>td", :text => "intakes and filters".to_s, :count => 1 assert_select "tr>td", :text => "audio".to_s, :count => 1 end end I noticed that the index view spec above passes but when I change the count to 2, it fails saying that only...
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.gma...
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 Apr 26
2
assert_select with respond_to JS or xhr?
...:action ''list_emails'' } type.js { render :partial => ''list_emails'' } end [..] The partial returns html code such as [..]<ul><li>email1</li></li></ul> [..] In my controller functional test I do [..] xhr :get,:list_emails assert_select "ul" [..] But `assert_select'' did not find anything. However if i changed my controller action (remove the respond_to and replace with xhr?) [..] if request.xhr? render :partial => ''list_emails'' else render :action ''list_emails'' end [.....
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
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 "<boxes" as the start of a tag. The only way I have found to get round it is to add a javascript comment "// </boxes>" to the end of the line....
2007 Jan 23
1
assert_select issue
I''d like to do an assert_select where only ONE of the matching elements needs to match the :text. It seems counterintuitive to me to require them *all* to match, which precludes me from testing the existence of a particular tag (h1) with some particular text if other instances of the same tag exist. I know that I can narrow dow...
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 May 23
9
undefined method `assert_select'
...ogether, and I''ve resolved some issues, but still see this error: $ spec vendor/plugins/openlaszlo_plugin/spec/swfobject_view_helper_spec.rb FFFFFFF 1) NoMethodError in ''ActionView::Helpers::SwfObjectHelper swfobject_tag should call swfobject.embedSWF'' undefined method `assert_select'' for #<ActiveSupport::TestCase::Subclass_1::Subclass_1:0x2281278> ./vendor/plugins/openlaszlo_plugin/spec/swfobject_view_helper_spec.rb:17: line 17 is: html.should have_tag(''script'', /swfobject.embedSWF/) Can anyone give me a hint? Thanks, Sarah -- Posted...
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 the Beastie boys testing XML with assert_select? Wouldn''t an assertion that didn''t expect HTML work better there? -- Phlip http://flea.sourceforge.net/EAP_1.h...
2007 Jul 06
0
Test XML Documents Using assert_select
Have you ever wanted to test your API output without those pesky assert_select error messages? Well now you can! http://dev.rubyonrails.org/ticket/8173 The patch has been sitting there quietly with no comment for a couple months now. I think it should be pretty easy to apply. It won''t affect standard HTML output or even XHTML given IE''s inability unders...
2007 Feb 07
0
assert_select '[foo|=bar]' bug?
just for the record, i tried searching the archives on this one but would get an application error when i tried entering |= in the search field. assert_select ''[foo|=bar]'' behaviour does not seem to jive with the css specs: http://www.w3.org/TR/CSS21/selector.html#q1 http://www.w3.org/TR/css3-selectors/#selectors is there some reason i don''t know about for this or is it a genuine bug? _c -- Posted via http://www.ruby-forum...
2007 Jun 27
1
rspec_on_rails: assert_select wrapper doesn''t play nice with XML
...he wrong solution. Cheers Ian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070627/845633e7/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: rspec_on_rails_assert_select_xml_play_nice.patch Type: application/octet-stream Size: 1068 bytes Desc: not available Url : http://rubyforge.org/pipermail/rspec-users/attachments/20070627/845633e7/attachment.obj
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 R...