#176 ✓resolved
Kieran P

Fix test suite in Kete 1.3 (Rails 2.3)

Reported by Kieran P | March 24th, 2009 @ 11:19 AM | in 1.3 (closed)

At the moment, the test suite is failing in several places. I suspect one of the reasons is that along the way, it messes with the development environment. Might need to check if our hack for db:bootstrap is still valid in this version.

Comments and changes to this ticket

  • Kieran P

    Kieran P March 24th, 2009 @ 06:47 PM

    I spent 3 hours looking for the testing issue in rails 2.3. Despite everything around migrations running in the test env, and all variables properly set (ENV['RAILS_ENV'], RAILS_ENV, and Rails.env all 'test'), the migrations continue to run in development mode.

    No one on #rubyonrails has an answer (I got flamed for even talking about overwriting the method like kete does)

    The only solution is to do 'RAILS_ENV=test rake test:units' (with RAILS_ENV before the rake command).

    I committed some checks to bugfix_176_testing_affects_development which make sure the env is set (for now, its better than having your development environment messed up).

  • Walter McGinnis

    Walter McGinnis March 24th, 2009 @ 09:15 PM

    I actually picked up the technique originally as coded by Jeremy Kemper of Rails Core Team fame and the bootstrapping idea comes indirectly from Mephisto as written by Rick Olsen also a Core Team member.

    That said, I wouldn't say that overriding Rails (or other tools) methods should be done without forethought and there is always a risk of having your patch break which is what has happened. I did explore other methods and nothing else (Factory Girl and other fixture replacements didn't exist yet) seemed to suit. So there you go. If someone has a better solution, I'm happen to read up on it and see if it is right for Kete.

    Personally, I wouldn't take being flamed on IRC too much to heart. Chances are they don't fully understand your situation. That medium often encourages quick uninformed judgements (and those that like to make them).

    There is actually a chance that this is a bug in Rails, by the way.

  • Walter McGinnis

    Walter McGinnis March 24th, 2009 @ 10:24 PM

    It looks to me like Rails db namespace tasks now call a task found under railties/lib/tasks/misc.rake like so.

    task :rails_env do unless defined? RAILS_ENV

    RAILS_ENV = ENV['RAILS_ENV'] ||= 'development'
    
    

    end end

    This wasn't the case before. It looks like what now takes precedence over ENV['RAILS_ENV']. At any rate, adding a reassignment of that constant in our redefinition of db:test:prepare along with the existing ENV['RAILS_ENV'] setting made it so that specifying it when calling 'rake test' is no longer necessary.

    See 225f0ddef11b0284f6e6b12b200ae947ea96d724.

    Note that despite the correct database being migrated and bootstrapped, rake tests still fail with this:

    /Users/walter/Development/apps/kete_review/vendor/plugins/active_scaffold/lib/active_scaffold/configurable.rb:24:in send': undefined methodt' for ChoicesController:Class (NoMethodError)

    That looks to me like we need to get active_scaffold playing nicely with I18n.translate or as configured by the ChoicesController.

  • Kieran P

    Kieran P May 8th, 2009 @ 10:31 AM

    • State changed from “new” to “resolved”

    This ix works and tests are running in 1.3. Resolving ticket.

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 ยป

Kete was developed by Horowhenua Library Trust and Katipo Communications Ltd. to build a digital library of Horowhenua material.

People watching this ticket

Pages