[rspec-devel] [ rspec-Bugs-6555 ] should_have_tag does not match documentation

noreply at rubyforge.org noreply at rubyforge.org
Wed Nov 8 04:21:26 EST 2006


Bugs item #6555, was opened at 2006-11-08 09:21
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6555&group_id=797

Category: expectation module
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jerry West (jjw)
Assigned to: Nobody (None)
Summary: should_have_tag does not match documentation

Initial Comment:
http://rspec.rubyforge.org/documentation/rails/writing/views.html says should_have_tag takes symbols as arguments.  Should_have_tag says otherwise.

require File.dirname(__FILE__) + '/../spec_helper'

class TestController < ActionController::Base
  def index() render :inline => '<h1>Hello<h1>'; end
end

context 'Test Controller' do
  controller_name :test
  integrate_views

  specify 'presents h1' do
    get :index
    response.should_have_tag :h1, :content => 'Hello'
  end
  
end

spec -fs spec/controllers/test_controller_spec.rb
Creating sqlite in memory database...

Test Controller
/home/jjw/work/northants/vendor/plugins/rspec/lib/spec/rails/tag_expectations.rb:28:in `find_tag':  (SyntaxError)

SyntaxError in should_have_tag(tag, *opts)
* tag should be the name of the tag (like 'div', or 'select' without '<' or '>')
* opts should be a Hash of key value pairs

        from /home/jjw/work/northants/vendor/plugins/rspec/lib/spec/rails/tag_expectations.rb:5:in `should_have_tag'
        from /home/jjw/work/northants/vendor/plugins/rspec/lib/extensions/action_controller/test_response.rb:22:in `should_have_tag'
        from ./spec/controllers/test_controller_spec.rb:13:in `__instance_exec0'
        from ...

Whereas strings work fine...

    response.should_have_tag 'h1', :content => 'Hello'

spec -fs spec/controllers/test_controller_spec.rb
Creating sqlite in memory database...

Test Controller
- presents h1

Finished in 0.007113 seconds

1 specification, 0 failures

Either the docs or the code should be adjusted.


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6555&group_id=797


More information about the rspec-devel mailing list