search for: have_tag

Displaying 20 results from an estimated 59 matches for "have_tag".

2007 Aug 02
2
Do the :attributes and :content matchers work
...1.0.5] Hi, I am looking for some guidance. When working on a partial which looks like this <div class="bug" style="width: 100%;" /> I have some examples which should fail - I think - but do not: it '' should fail'' do response.should have_tag( ''div.bug'', :content => ''There is no content!'' ) end it '' should fail since there is no bug attribute with a value of "here"'' do response.should have_tag( ''div'', :attributes => {:bug => &quo...
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()" /> </div> I want to test...
2007 Jul 22
2
have_tag for href with specific link?
...erson 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 action. How would my have_tag (or whatever I should be using) look like? Thanks, Edward
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&qu...
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'')...
2007 Oct 01
1
have_tag and line numbers
When I''ve got a view example like this: 1: response.should have_tag "fieldset#children" do 2: with_tag "child" 3: end If it can''t find ''child'', the error seems to come back as my_spec.rb:1 instead of my_spec.rb:2. Has anyone else experienced this? I just spent a while tracking down what I assumed was a problem in...
2008 Mar 17
8
should have_tag outside Rails
Hi Google has not helped me here. I''m looking for a way to use the have_tag assert_select wrapper outside RSpec on Rails (but in a Rails project) so I can use it to check text strings. Has anyone managed this? Thanks Ashley -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080317/9eeff...
2007 Oct 05
4
have_xml_tag
Hi Was just using have_tag on an xml response and found the problem outlined and resolved here http://weblog.jamisbuck.org/2007/1/4/assert_xml_select Just wondered if there is any support in rspec? Cheers Shane Shane Mingins ELC Technologies (TM) PO Box 247 Santa Barbara, CA 93102 Phone: +64 4 568 6684 Mobile: +64 21...
2010 Jun 28
1
have_tag matcher in rspec 2?
I always assumed have_tag was part of rspec, but it''s not in rspec 2, and looking now I don''t see it in rspec 1 either. Webrat defines it, but that seems like a coincidence (I tried requiring webrat/core/matchers to no avail). Is it depricated, not yet implemented, or does it work for everyone else? My p...
2009 May 23
9
undefined method `assert_select'
...::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 via http://www.ruby-forum.com/.
2009 Apr 16
6
Cucumber - step negating another expecting step
...uld not see the people search form$/ do > people_search_form_exists "not" > end > > and then the method: > > def people_search_form_exists negation = "" > neg = "_not" unless negation.blank? > response.send "should#{neg}".to_sym, have_tag(''form#frmSearch'') > end > > this is a simple case, but what do you think about this? any blog > post or so Yeah this is an annoying one isn''t it. I sometimes get around it by going old-skool and pulling out the Test::Unit assertion methods instead:...
2007 Oct 22
1
View spec response has no content?
...ching. If I run in the browser the page renders fine. Is there a way to output what the response contains? Here are my tests: describe ''backoffice layout implementor'', :shared => true do it ''should render the backoffice stylesheet'' do response.should have_tag(''link'', :attributes => {:rel => ''stylesheet'', :href => ''/stylesheets/backoffice.css''}) end it ''should display menu options'' do response.should have_tag(''a'', :attributes => {:href => c...
2007 Apr 27
2
Newlines breaking "should have_tag :text =>" specs
Hi I''ve got an RJS spec that is failing. It looks like this: specify "should have list of prooducts for particular provider" do @provider.products.each do |product| response.should have_tag("#product_name_#{product.id}", :text => "#{product.name}") end end It fails when it renders a partial containing this: <td id="product_name_<%= product.id%>"> <%= product.name %> </td> and gi...
2007 Oct 01
15
how to spec views
...e expectations for partials similar to above? When your specing views are you testing for the outputted results? it "should render signup propaganda for annon users trying to view games" do render "/games/index.rhtml" @logged_in?.should eql(false) response.should have_tag(div, "class=/"signup_propaganda/"") end How should I be writing my spec? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071001/86fc22d4/attachment.html
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
2007 Jun 29
12
testing instance variables that are set inside views
Hi all, In my view specs (for Rails), how can I get at instance variables that are set within my view? For example, if my view looks like this: <% @header = "My Header" -%> <div>some content</div> How can I get to @header from within my view spec? I''ve tried @header and assigns[:header] to no avail. TIA, Jeremy -- Jeremy Stephens Computer Systems
2007 Sep 25
2
Testing for particular CSS (i.e. display: none)
I have a page that hides elements using CSS display: none. I don''t expect RSpec to test any changes made by Javascript; I just want to test how the page loads initially: what is visible and what is not. Can I test this in RSpec? Or do I need to use something like Selenium? -------------- next part -------------- An HTML attachment was scrubbed... URL:
2007 Jul 16
4
Accessing content_for html in view specs?
...ve got a few views that create some content using ''content_for'' blocks <% content_for :blah do %> ..... <% end %> Has anyone worked out a way to be able to access the html that''s generated inside those blocks? Since they''re not part of the view, have_tag('''') seems to miss them, and at the moment I can''t find a way to be able to access the generated content? Any thoughts, ideas appreciated. Cheers, Marcus
2007 Nov 30
4
Rendering a view and passing a variable
...In my test, I''m trying to set the value of the variable first, but that just doesn''t seem to work : it "should display in english when @language is equal to ''E''" do @language = "e" render "/search/index" response.should have_tag("a[href=?]", "/search/index/f") end I get the error message saying that no tag was found. Any help would be appreciated Thank you in advance Olivier Dupuis -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-us...
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