Unable to remove task "db:test:prepare" #9931

Closed
jlxw opened this Issue Mar 26, 2013 · 2 comments

Projects

None yet

2 participants

Contributor
jlxw commented Mar 26, 2013

I remove the 'db:test:prepare' task through lib/tasks/test.rake and this worked until recently, I believe probably due to the move to running test via 'rails test'.

My test.rake file:

    Rake::TaskManager.class_eval do
      def delete_task(task_name)
        @tasks.delete(task_name.to_s)
      end
      Rake.application.delete_task("db:test:prepare")
    end
    namespace :db do
        namespace :test do
            task :prepare do
              puts "Hello"
            end
        end
    end

I tried to verify that the test.rake file is being run and the task is correctly being removed:

    Rake::TaskManager.class_eval do
      def delete_task(task_name)
        @tasks.delete(task_name.to_s)
      end
      def show_tasks
        pp @tasks
      end
      Rake.application.delete_task("db:test:prepare")
    end
    namespace :db do
        namespace :test do
            task :prepare do
              puts "Remember to run 'chmod 666 db/structure.sql; sudo -u nobody rake db:test:clone_structure; sudo -u nobody rake salsasan:prepare_test RAILS_ENV=test'"
            end
        end
    end
    Rake.application.show_tasks

This showed that the test.rake file is indeed being run and the task is correctly removed at least at that stage.

Any ideas?

I am on 078bfbf

Owner
senny commented Mar 26, 2013

I think the new test runner no longer uses db:test:preapre but accesses db:test:load directly.

Contributor
jlxw commented Mar 27, 2013

@senny you are right, I modified it to replace db:test:load and it works, it doesn't seem like it should change the expected behaviour like that though...

@jlxw jlxw closed this Mar 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment