How’s that for being helpful?

 1 $ rake db:migrate --trace
 2 (in /Users/francois/Documents/work/family_budget)
 3 ** Invoke db:test:prepare (first_time)
 4 ** Invoke environment (first_time)
 5 ** Execute environment
 6 ** Invoke db:abort_if_pending_migrations (first_time)
 7 ** Invoke environment 
 8 ** Execute db:abort_if_pending_migrations
 9 You have 13 pending migrations:
10      1 CreateFamilies
11      2 CreatePeople
12      3 CreateAccounts
13      4 CreateTransfers
14      5 CreateTransferMembers
15      6 AddFamilyToPeople
16      7 DestroyTransferMember
17      8 AddDebitAccountIdCreditAccountIdAndAmountToTransfers
18      9 CreateBudgets
19     10 AddAdminFlagToPerson
20     11 DefaultBudgetAmountToZeroFromNull
21   20081103020010 CreateTransactions
22   20081103020142 CreateBankAccounts
23 Run "rake db:migrate" to update your database then try again.

Hmm, I’m trying to run migrations, stupid…

I finally traced the problem (using git bisect !) to this:

lib/tasks/cucumber.rake
 1 $:.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
 2 require 'cucumber/rake/task'
 3 
 4 namespace :test do
 5   desc "Runs the Cucumber features tests (integration tests)"
 6   Cucumber::Rake::Task.new(:features) do |t|
 7     ENV["RAILS_ENV"] = RAILS_ENV = "test"
 8     Rake::Task["db:test:prepare"].invoke
 9     Rake::Task["db:fixtures:load"].invoke
10     t.cucumber_opts = "--format pretty"
11   end
12 end

Can you spot the error? The problem originates with setting RAILS_ENV in this code block. But isn’t the block supposed to be executed later? When the block is #call’ed? Very strange. At the moment, I simply commented out the line, but that’s going to bite me in a couple moments when I’m ready to test my features again… Oh joy of debugging!

Search

Your Host

A picture of me

I am François Beausoleil, a Ruby on Rails and Scala developer. During the day, I work on Seevibes, a platform to measure social interactions related to TV shows. At night, I am interested many things. Read my biography.

Top Tags

Books I read and recommend

Links

Projects I work on

Projects I worked on