mardi 26 avril 2016

test-unit automatic runner produce "invalid option" error on rake tasks?

Since I've installed gon, my rake tasks aren't working anymore.

I'm using:

Rails 3.2.22.2
ruby 2.2.0p0
gon-6.0.1
test-unit-3.0.8

I can't uninstall test-unit because:

$ rails c
/Users/me/.rbenv/versions/2.2.0/gemsets/project-gems/gems/activesupport-3.2.22.2/lib/active_support/dependencies.rb:251:in `require': Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'` (cannot load such file -- test/unit/testcase) (LoadError)

If I rake -T for example:

rake about                                       # List versions of all Rails frameworks and the environment
... (all rake tasks here) ...
rake tmp:create                                  # Creates tmp directories for sessions, cache, sockets, and pids
invalid option: -T
Test::Unit automatic runner.
Usage: /Users/me/.rbenv/versions/2.2.0/gemsets/project-gems/bin/rake [options] [-- untouched arguments]
    -r, --runner=RUNNER              Use the given RUNNER.
                                     (c[onsole], e[macs], x[ml])
        --collector=COLLECTOR        Use the given COLLECTOR.
                                     (de[scendant], di[r], l[oad], o[bject]_space)
    -n, --name=NAME                  Runs tests matching NAME.
                                     Use '/PATTERN/' for NAME to use regular expression.
        --ignore-name=NAME           Ignores tests matching NAME.
                                     Use '/PATTERN/' for NAME to use regular expression.
    -t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                     Use '/PATTERN/' for TESTCASE to use regular expression.
        --ignore-testcase=TESTCASE   Ignores tests in TestCases matching TESTCASE.
                                     Use '/PATTERN/' for TESTCASE to use regular expression.
        --location=LOCATION          Runs tests that defined in LOCATION.
                                     LOCATION is one of PATH:LINE, PATH or LINE
        --attribute=EXPRESSION       Runs tests that matches EXPRESSION.
                                     EXPRESSION is evaluated as Ruby's expression.
                                     Test attribute name can be used with no receiver in EXPRESSION.
                                     EXPRESSION examples:
                                       !slow
                                       tag == 'important' and !slow
        --[no-]priority-mode         Runs some tests based on their priority.
        --default-priority=PRIORITY  Uses PRIORITY as default priority
                                     (h[igh], i[mportant], l[ow], m[ust], ne[ver], no[rmal])
    -I, --load-path=DIR[:DIR...]     Appends directory list to $LOAD_PATH.
        --color-scheme=SCHEME        Use SCHEME as color scheme.
                                     (d[efault])
        --config=FILE                Use YAML fomat FILE content as configuration file.
        --order=ORDER                Run tests in a test case in ORDER order.
                                     (a[lphabetic], d[efined], r[andom])
        --max-diff-target-string-size=SIZE
                                     Shows diff if both expected result string size and actual result string size are less than or equal SIZE in bytes.
                                     (1000)
    -v, --verbose=[LEVEL]            Set the output level (default is verbose).
                                     (important-only, n[ormal], p[rogress], s[ilent], v[erbose])
        --[no-]use-color=[auto]      Uses color output
                                     (default is auto)
        --progress-row-max=MAX       Uses MAX as max terminal width for progress mark
                                     (default is auto)
        --no-show-detail-immediately Shows not passed test details immediately.
                                     (default is yes)
        --output-file-descriptor=FD  Outputs to file descriptor FD
        --                           Stop processing options so that the
                                     remaining options will be passed to the
                                     test.
    -h, --help                       Display this help.

Deprecated options:
        --console                    Console runner (use --runner).

Here's the culprit:

invalid option: -T
Test::Unit automatic runner.

With or without rspec, same error.

Current solution: I ended with those lines at the bottom of my application.rb:

Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)

first link

Test::Unit.run = true if defined?(Test::Unit) && Test::Unit.respond_to?(:run=)

second link

Anyone with a better idea?

Thank you!

ps: http://ift.tt/24hd4Bc

Aucun commentaire:

Enregistrer un commentaire