padrino-framework: Padrino has a problem with Rake when using RSpec

Hi. I’m enjoying my development with Padrino thank you.

Using RSpec as testing framework, rake command (not “padrino rake”) seems to have a problem. And it causes “heroku rake” failure.

I’m using below.

  • Padrino 0.9.26
  • Ruby 1.9.2 p188
  • MacOSX (Snow Leopard).

Appears by the following.

$ padrino g project test-project -t rspec -b
$ cd test-project

Save below as “Rakefile”.

require File.dirname(__FILE__) + '/config/boot.rb'
require 'thor'
require 'padrino-core/cli/rake'

PadrinoTasks.init

padrino rake

$ padrino rake -T
=> Executing Rake -T ...
rake routes[query]    # Displays a listing of the named routes within a project, optionally only those matched by [query]
rake routes:app[app]  # Displays a listing of the named routes a given app [app]
rake secret           # Generate a secret key
rake seed             # Load the seed data from db/seeds.rb
rake spec             # Run complete application spec suite

Normal rake

$ rake -T
(in /Users/yuya/dev/ruby/test-project)
=> Located unlocked Gemfile for development
rake aborted!
no such file to load -- rspec/core/rake_task
/Users/yuya/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.26/lib/padrino-core/cli/rake.rb:21:in `load'
(See full trace by running task with --trace)

About this issue

  • Original URL
  • State: closed
  • Created 13 years ago
  • Comments: 15 (12 by maintainers)

Most upvoted comments

Quick fix for deploying to heroku:

spec/spec.rake

if ENV['PADRINO_ENV'] == 'test'
  require 'rspec/core/rake_task'

  spec_tasks = Dir['spec/*/'].map { |d| File.basename(d) }

  spec_tasks.each do |folder|
    RSpec::Core::RakeTask.new("spec:#{folder}") do |t|
      t.pattern = "./spec/#{folder}/**/*_spec.rb"
      t.rspec_opts = %w(-fs --color)
    end
  end

  desc "Run complete application spec suite"
  task 'spec' => spec_tasks.map { |f| "spec:#{f}" }
end

Could the rake tasks in spec/ and test/ be ignored unless env is test?