similar to: have_tag for href with specific link?

Displaying 20 results from an estimated 900 matches similar to: "have_tag for href with specific link?"

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
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:
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 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()"
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 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 435 586 Email: smingins at elctech.com AIM: ShaneMingins Skype:
2007 Aug 02
2
Do the :attributes and :content matchers work
[Rails plugin 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
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 my have_tag only to
2007 Jul 16
4
Accessing content_for html in view specs?
Hi All, Hope all is going well. I''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,
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 project is from scratch, rspec-rails 2b13, using generated spec_helper.
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 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 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
2007 Aug 30
7
mock_model in spec/lib
Has anyone else run into a problem with trying to use mock_model in spec/lib ? For some reason, I can take the same spec, put it in spec/models, have it run fine, but put it in spec/lib, and have it complain about not being able to find #mock_model Thanks, Edward
2007 Aug 19
4
describing a mock_model as being an instance
Is there a built-in way of describing a mock_model as being an instance, beyond stubbing the eval("Object.methods - Object.new.methods") methods to throw NoMethodErrors? Edward
2007 Aug 01
4
:render expects possible?
Hi, Is it possible to do the following in a controller spec? @controller.should_receive(:render).with(:layout => false) I''ve been trying this kind of thing and it looks like RSpec is messing with the render calls, and requires you to use render_template instead. Could we have at least a warning that mentions that parameters passed to :render expectations are going to be thrown
2007 Oct 12
6
locals in partials
hiya, in specing a partial, how can i assign a local var that is normally passed via :locals ? i tried adding :locals => to the render call but that doesnt seem to take linoj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071012/fd0acd92/attachment.html
2007 Feb 04
10
Spec''ing ActionMailer
Good morning (Pacific Time). I have a controller action that, as a side-effect, sends an email to an administrator. I want it to do something like this: specify "when someone successfully signs up, an email should be sent to the administrator with the person''s contact page" do post :signup, {...lots o'' params} response should_be success #
2007 Jun 13
3
standard location for spec helpers
Is there a standard location for spec helpers (as in bits of code that help write specs)? I''m mocking/stubing-out portions of ActiveSalesforce, a remote-database abstraction layer so my specs won''t have to rely on a remote connection, but I''m not sure where I should be putting this helper lib. I was thinking of just sticking it in spec/ but I was curious if
2007 Jun 28
7
Custom report outputting text, expected and actual on succes?
I would like to output the following information when running a spec (_also_ on success): - the description text - the expected value - the actual value After looking through the documentation I thought custom formatters might be the way to go, but unfortunately it does not look like all variables are accessible from there? I need this for an academic report where all testing needs to be