Osny Netto
Osny Netto

Reputation: 572

Test Unit error when running rake tasks

I upgrade my app from rails2 to rails3. Now every time I run a task I get this error:

➜  cimm git:(master) ✗ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin13.0.0]
➜  cimm git:(master) ✗ rails -v
Rails 3.0.20
➜  cimm git:(master) ✗ bundle exec rake sitemaps:servicos --trace
** Invoke sitemaps:servicos (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sitemaps:servicos
/Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: sitemaps:servicos (ArgumentError)
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:146:in `map!'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:146:in `non_options'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:207:in `non_options'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:52:in `process_args'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:21:in `run'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
    from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'

I don't know why is loading something about Test Unit if I'm using Rspec. I tried change rake version, changing the require 'rails/all' but none fixed this issue.

But my tasks are loaded, so seems this is kind of a warning. But I'd to know how to fix this.

Update 1

These errors only appear when my task interact with Model/Controllers.

My Rakefile:

require File.expand_path('../config/application', __FILE__)
require 'rake'

CIMM::Application.load_tasks

Upvotes: 0

Views: 593

Answers (2)

Seuros
Seuros

Reputation: 131

Check your Rakefile. it probably loading TestUnit

You should show the custom task if you want more help.

Upvotes: 1

Osny Netto
Osny Netto

Reputation: 572

➜  cimm git:(master) ✗ rake -T
rake about                                    # List versions of all Rails frameworks and the environment
rake airbrake:deploy                          # Notify Airbrake of a new deploy.
rake airbrake:heroku:add_deploy_notification  # Install Heroku deploy notifications addon
rake airbrake:test                            # Verify your gem installation by sending a test exception to the airbrake service / Verify your gem instal...
rake db:create                                # Create the database from config/database.yml for the current Rails.env (use db:create:all to create all d...
rake db:drop                                  # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load                         # Load fixtures into the current environment's database.
rake db:migrate                               # Migrate the database (options: VERSION=x, VERBOSE=false).
rake db:migrate:status                        # Display status of migrations
rake db:rollback                              # Rolls the schema back to the previous version (specify steps w/ STEP=n).
rake db:schema:dump                           # Create a db/schema.rb file that can be portably used against any DB supported by AR
rake db:schema:load                           # Load a schema.rb file into the database
rake db:seed                                  # Load the seed data from db/seeds.rb
rake db:setup                                 # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db...
rake db:structure:dump                        # Dump the database structure to an SQL file
rake db:version                               # Retrieves the current schema version number
rake doc:app                                  # Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-t...
rake log:clear                                # Truncates all *.log files in log/ to zero bytes
rake middleware                               # Prints out your Rack middleware stack
rake notes                                    # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom                             # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template                           # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update                             # Update both configs and public/javascripts from Rails (or use just update:javascripts or update:configs)
rake rails:upgrade:backup                     # Backs up your likely modified files so you can run the Rails 3 generator on your app with little risk
rake rails:upgrade:check                      # Runs a battery of checks on your Rails 2.x app and generates a report on required upgrades for Rails 3
rake rails:upgrade:configuration              # Extracts your configuration code so you can create a new config/application.rb
rake rails:upgrade:gems                       # Generates a Gemfile for your Rails 3 app out of your config.gem directives
rake rails:upgrade:routes                     # Create a new, upgraded route file from your current routes.rb
rake routes                                   # Print out all defined routes in match order, with names.
rake secret                                   # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie se...
rake sitemaps:servicos                        # Cria sitemap para servicos
rake spec                                     # Run all specs in spec directory (excluding plugin specs)
rake spec:controllers                         # Run the code examples in spec/controllers
rake stats                                    # Report code statistics (KLOCs, etc) from the application
rake time:zones:all                           # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter,...
rake tire:import                              # Import data from your model using paginate: rake environment tire:import CLASS='MyModel'.
rake tire:index:drop                          # Delete indices passed in the INDEX environment variable; separate multiple indices by comma.
rake tmp:clear                                # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sock...
rake tmp:create                               # Creates tmp directories for sessions, cache, sockets, and pids

Upvotes: 0

Related Questions