Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8203041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:24:20+00:00 2026-06-07T07:24:20+00:00

Ruby on Rails sometimes gives you annoying Ignoring attempts to close x with y

  • 0

Ruby on Rails sometimes gives you annoying “Ignoring attempts to close x with y” warnings arising from assert_select. Often these warnings are the result of invalid HTML, but sometimes they appear even if the HTML is valid. The error in my case looks like this while running ruby test/functional/my_controller_test.rb :

..ignoring attempt to close div with h2
  opened at byte 8551, line 207
  closed at byte 9554, line 243
  attributes at open: {"class"=>"my_css_class", "id"=>"object_1"}
  text around open: "  \r\n  \r\n  \r\n  \r\n\r\n  <div class=\"my_css_class"
  text around close: "</a>\r\n      </h2>\r\n\r\n      <span"

But there is no attempt to close a div with a h2 tag. I tried a HTML validator, but without success. The -W0 parameter mentioned by Giles seems to help – ruby -W0 test/functional/my_controller_test.rb gives no longer a warning, but this does not work for rake test:whatever. What does -W0 do, and how can you avoid using it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:24:23+00:00Added an answer on June 7, 2026 at 7:24 am

    There are various command line options for Ruby unit tests. -W does not belong to them, it is a command line option for pure Ruby. As ruby --help says, the ruby -W[level] command line option sets the warning level for Ruby; 0=silence, 1=medium, 2=verbose (default). ruby -W0 sets the warning level to silence.

    $ ruby --help
      [...]
      -w              turn warnings on for your script
      -W[level]       set warning level; 0=silence, 1=medium, 2=verbose (default)
    

    The -W flag also activates the “verbose” mode of Ruby. Mislav has a good explanation of the verbose mode. From within Ruby code, verbosity can be set and tested with the value of the $VERBOSE global variable, which can have 3 states: nil (“0”), false (“1”), and true (“2”). So you can suppress warning for your Test::Unit test by setting

    $VERBOSE = nil 
    

    in your test_helper.rb. For running RSpecs test you can suppress ruby warning similarly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Ruby on Rails, I sometimes get an error on the page as: compile
I have a ruby on rails app running a server and sometimes it needs
I'm working on a Ruby on Rails project and sometimes I need to run
I'm using devise gem to implement authentication in my Ruby On Rails application. Sometimes
Is it possible in ruby/rails to order a result set after doing a find?
Possible Duplicate: Ruby on Rails scalability/performance? I'm aware from the twitter shortages that Ruby
Quite often, Git and Ruby on Rails looks like magic... such as in the
I'm moving to ruby/rails from php, and one of the things I've always been
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
What are the best Ruby / Rails book available right now ? Note :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.