assumption of default task blows up rake #377

Closed
jackdempsey opened this Issue May 21, 2011 · 2 comments

Projects

None yet

2 participants

@jackdempsey

In a new rails 3.1.beta app, rspec-rails 2.6 is trying to delete the default task 'test'. Only problem is that it's not found, so we call prerequisites on nil, and boom goes the dynamite.

Here's the small fix:

-Rake.application.instance_variable_get('@tasks')['default'].prerequisites.delete('test')
+if default = Rake.application.instance_variable_get('@tasks')['default']

  • default.prerequisites.delete('test') +end

Things run smoothly after that.

Gemfile for reference:

source :rubygems

#gem 'rails', '~> 3.0.6'
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'arel', :git => 'git://github.com/rails/arel.git'
gem "rack", :git => "git://github.com/rack/rack.git"

#gem "sprockets", :git => "git://github.com/sstephenson/sprockets.git"
gem "sprockets", "2.0.0.beta.5"
gem 'rake', '0.8.7'

gem 'sqlite3'

gem 'json'
gem 'sass'
gem 'coffee-script'
gem 'uglifier'

gem 'jquery-rails'

group :development, :test do
gem 'rspec-rails'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'database_cleaner'
end

If you'd like a proper pull request, happy to put one together, just wanted to get this out there given the simple nature.

@dchelimsky
RSpec member

Pull request is better because I want your name in the commit log :)

@dchelimsky
RSpec member

Moved to #378

@dchelimsky dchelimsky closed this May 21, 2011
@kaiwren kaiwren pushed a commit to c42engineering/rspec-rails that referenced this issue May 24, 2011
@jackdempsey jackdempsey guard against calling prerequisites on nil
- Closes #377.
- Closes #378.
8bc247d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment