sur says ajax :on => rails

Thursday, September 14, 2006

RAILS_CONF.include?('VINSOL')


Marcel Molina, Manik Juneja and DHH
DHH and Marcel were surprised to know that there were Rails programmers in India.

RailsConf2006

VINSOL IS RAILING ....

RailsConf2006 marked the presence of Rails based Indian company Vinsol.
Vinsol's chief Manik Juneja is attending the conference. The 1st day of conference was shining with good sessions by DHH, Marcel, Jamis Buck, Thomas Fuchs and David Black.


There was a very interesting discussion between DHH, Marcel and Jamis Buck about what should go into functional testing and what should go into integration testing.
DHH believes testing for permission should go into integration.

Wednesday, September 06, 2006

How to prepare test database environment from migrations.

Usually we build our test database by using


To use your migrations for preparing test database create a file testdb.rake
in the directory lib/tasks.
Now add the following code in the lib/tasks/testdb.rake file.



module Rake
module TaskManager
def redefine_task(task_class, args, &block)
task_name, deps = resolve_args(args)
task_name = task_class.scope_name(@scope, task_name)
deps = [deps] unless deps.respond_to?(:to_ary)
deps = deps.collect {|d| d.to_s }
task = @tasks[task_name.to_s] = task_class.new(task_name, self)
task.application = self
task.add_comment(@last_comment)
@last_comment = nil
task.enhance(deps, &block)
task
end
end
class Task
class << self
def redefine_task(args, &block)
Rake.application.redefine_task(self, args, &block)
end
end
end
end

def redefine_task(args, &block)
Rake::Task.redefine_task(args, &block)
end

namespace :db do
namespace :test do

desc 'Prepare the test database and migrate schema'
redefine_task :prepare => :environment do
Rake::Task['db:test:migrate_schema'].invoke
end

desc 'Use the migrations to create the test database'
task :migrate_schema => 'db:test:purge' do
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
ActiveRecord::Migrator.migrate("db/migrate/")
end

end
end





Now from command prompt run this command to view all the rake tasks


You will c a task as rake db:test:migrate_schema
To prepare the test database run this command