similar to: should have_tag outside Rails

Displaying 20 results from an estimated 2000 matches similar to: "should have_tag outside Rails"

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 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 13
22
Specifing methods in a steps_for block
Hey list, I''m refactoring some much-used functionality into a common_steps step group. Methods like this are in there: steps_for :common do Given "a number of existing $types?" do |type| @initial_item_count = type.singularize.classify.constantize.count end When "the user adds an invalid $type" do |type| post
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 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 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
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:
2008 May 20
4
mock_model not stubbing model attribtues in view spec
Hi -- I am just getting to grips w/ view specs, and am having an issue with mock_model not stubbing the mocked model''s attributes. For instance, I have the following: <CODE> before do @input_timesheet = mock_model( InputTimesheet ) assigns[:input_timesheet] = @input_timesheet end it "should display a table element" do render
2008 May 21
1
Testing REST webservices? (Not Rails)
Hi, I am new to RSpec and BDD. I was wondering if RSpec specifications are a good solution for testing REST webservices (not implemented in Rails). If so, what would be a good way to test something like the API described below? =========== GET http://localhost/workflow text/xml Result: 200 OK <?xml version="1.0"?> <workflows>
2008 Nov 04
18
Can I do foo.should (be_nil || be_empty) in rspec
Is there any way to do foo.should (be_nil || be_empty) in rspec. Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081104/ee43c9c9/attachment.html>
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
2008 Dec 02
11
Any plans for Before-feature or Before-all steps in Cucumber?
Hi The code I''m working on now is a server daemon that talks to Twitter, an RSS feed, and some web pages. I''ve got mock implementations of Twitter and the web stuff, which I start and stop with daemon_controller[1]. I do all the setup in a Before block, but this makes the feature runs agonisingly slow due to the time waiting for everything to restart. I''m
2007 May 23
4
content_for
Any ideas how I would go about writing specs for views which make use of content_for? I''d like, for example, to be able to specify that ABC view places XYZ in the sidebar, which I do using content_for(:sidebar). Am I missing something obvious? Kyle
2008 May 27
8
new --pattern option
Hello. You''re saying that: To get rspec to behave as it did before this change, use this: --pattern "**/*.rb" I tried like this (rspec 1.03) and it wasn''t same as before (rspec 1.08). Now it also loads all other files in current directory and in all subdirectories and not only from directory and subdirectories given to spec as a parameter. So, for example, I have
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
2009 Oct 14
14
spec-ing private methods?
On Wed, Oct 14, 2009 at 5:49 PM, Scott Taylor <scott at railsnewbie.com> wrote: > > On Oct 14, 2009, at 3:36 PM, Joaquin Rivera Padron wrote: > > hello there, > how do you tipically spec private methods? The thing is ? have something > like this: > > def some_method > ?? complex_method + other_complex_methods > end > > private > def complex_method...
2008 Apr 29
5
Sharing: dont_repeat_yourself plugin custom RSpec matcher
I wrote a Rails plugin which uses simian to look for duplicates lines in your code and reports in html format, Textmate or Netbeans. I wrote it using RSpec and I have included a RSpec custom matcher: it { rails_application. with_threshold_of_duplicate_lines(4). should be_DRY } If you use Autotest, your specs will fail the next time you do a nasty copy-paste !!! More details in
2008 May 18
2
Using Hash to mock classes that respond to :
Hi I''ve been doing this a while now. If I have a class that responds to : [], and all I''m interested in stubbing is that method, then instead of using a mock I just create a hash. (Similarly, you could create an array when you are testing an Enumerable object.) Example from code I just worked on, where uses MigrationGraph#[] looks up graph vertices by name: