#173 open
Rick Lee-Morlang

fix warning: already initialized constant

Reported by Rick Lee-Morlang | February 21st, 2009 @ 09:49 PM | in 0.5

Noisy output from autotest:

panther ~/workspace/project(fix_cucumber) $ AUTOFEATURE=true autotest loading autotest/cucumber_rails /usr/bin/ruby1.8 /usr/lib/ruby/gems/1.8/gems/cucumber-0.1.16/bin/cucumber features --format progress --format autotest --color --out /tmp/autotest-cucumber20090221-31876-nwrizb-0 /home/rick/workspace/project/vendor/plugins/webrat/lib/webrat.rb:10: warning: already initialized constant VERSION ............................................

Comments and changes to this ticket

  • Rick Lee-Morlang

    Rick Lee-Morlang February 21st, 2009 @ 09:52 PM

    I wish Lighthouse had a preview. Attempting reformatting:

    panther ~/workspace/project(fix_cucumber) $ AUTOFEATURE=true autotest loading autotest/cucumber_rails /usr/bin/ruby1.8/usr/lib/ruby/gems/1.8/gems/cucumber-0.1.16/bin/cucumber features --format progress --format autotest --color --out /tmp/autotest-cucumber20090221-31876-nwrizb-0/home/rick/workspace/project/vendor/plugins/webrat/lib/webrat.rb:10: warning: already initialized constant VERSION ............................................

  • Rick Lee-Morlang
  • Rick Lee-Morlang
  • gaffo

    gaffo May 7th, 2009 @ 03:31 PM

    • State changed from “new” to “awaiting-merge”
    • Milestone set to 0.5

    Seems reasonable

  • Bryan Helmkamp

    Bryan Helmkamp June 14th, 2009 @ 08:52 PM

    • State changed from “awaiting-merge” to “open”

    Hey Rick -- Thanks for the ticket and patch.

    The "Already initialized constant" warning is rooted in the webrat.rb file being required twice. The real solution to this issue is to ensure the library isn't required twice, rather than silencing the warning. The dangers of silencing the warning are you could load two different versions of the same library in the same process, and end up running a Frankenstein version of the library (this has happened to me at work).

    If there's something Webrat can do to help avoid being loaded twice, we'd happily apply that patch. Often though, and unfortunately, these issues are project-specific. To track it down, it can be helpful to throw a debugger in the file and look at the stack trace each time it's required.

    Cheers,

    -Bryan

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

Pages