[RUBY 1.9.2] Minitest options error being thrown when running cucumber

1,160 views
Skip to first unread message

jgeiger

unread,
Sep 20, 2010, 11:46:29 AM9/20/10
to Cukes
When I run cucumber I'm getting an error from minitest that is an
invalid option. I'm not worried about that since I've looked up the
options and such, but I'm wondering what is running minitest in the
first place? I assume it's cucumber since it's using the same command
option.

Thanks.

COMMAND:
bundle exec /Users/user/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I "/Users/
user/workspace/webapp/vendor/bundle/ruby/1.9.1/gems/cucumber-0.8.5/
lib:lib" "/Users/user/workspace/webapp/vendor/bundle/ruby/1.9.1/gems/
cucumber-0.8.5/bin/cucumber" --profile default
Using the default profile...

ERROR:
/Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:
566:in `block in process_args': invalid option: --profile
(OptionParser::InvalidOption)
from /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:545:in `new'
from /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:545:in `process_args'
from /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:576:in `run'
from /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:492:in `block in autorun'

aslak hellesoy

unread,
Sep 20, 2010, 4:09:25 PM9/20/10
to cu...@googlegroups.com
On Mon, Sep 20, 2010 at 5:46 PM, jgeiger <jge...@gmail.com> wrote:
When I run cucumber I'm getting an error from minitest that is an
invalid option. I'm not worried about that since I've looked up the
options and such, but I'm wondering what is running minitest in the
first place? I assume it's cucumber since it's using the same command
option.

I'm assuming you only want to use minitest's assertion methods, and not its runner.

Do you require 'minitest/autorun' anywhere? Don't.
I can't see from your trace where the autorun method is called from. Did you cut some of it away?
What if you run cucumber with --backtrace ?

Aslak
 

Thanks.

COMMAND:
bundle exec /Users/user/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I "/Users/
user/workspace/webapp/vendor/bundle/ruby/1.9.1/gems/cucumber-0.8.5/
lib:lib" "/Users/user/workspace/webapp/vendor/bundle/ruby/1.9.1/gems/
cucumber-0.8.5/bin/cucumber"  --profile default
Using the default profile...

ERROR:
/Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:
566:in `block in process_args': invalid option: --profile
(OptionParser::InvalidOption)
       from /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:545:in `new'
       from /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:545:in `process_args'
       from /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:576:in `run'
       from /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:492:in `block in autorun'

--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.


jgeiger

unread,
Sep 21, 2010, 11:41:31 AM9/21/10
to Cukes
I'm not really using minitest in any format which is why it's odd that
it's running. I don't require it anywhere in my project, but it's
required by nokogiri. (commenting out that line and re-running has no
effect)

$ grep -r "minitest" .
./vendor/bundle/ruby/1.9.1/gems/nokogiri-1.4.3.1/Rakefile:
self.extra_dev_deps << ["minitest", ">= 1.6.0"]
./vendor/bundle/ruby/1.9.1/gems/nokogiri-1.4.3.1/Rakefile:
self.testlib = :minitest
./vendor/bundle/ruby/1.9.1/gems/nokogiri-1.4.3.1/test/
helper.rb:require 'minitest/autorun'
./vendor/bundle/ruby/1.9.1/specifications/
nokogiri-1.4.3.1.gemspec:
s.add_development_dependency(%q<minitest>, [">= 1.6.0"])
./vendor/bundle/ruby/1.9.1/specifications/
nokogiri-1.4.3.1.gemspec: s.add_dependency(%q<minitest>, [">=
1.6.0"])
./vendor/bundle/ruby/1.9.1/specifications/nokogiri-1.4.3.1.gemspec:
s.add_dependency(%q<minitest>, [">= 1.6.0"])

The backtrace is everything that I'm getting which is why I'm looking
for help to see where it might be called from. Adding --backtrace to
my cucumber.yml had no effect and the same backtrace was produced.
When I run bundle exec rake cucumber it gives me the backtrace. If I
run bundle exec script/cucumber the action completes without issue.


OUTPUT:
$ bundle exec script/cucumber
Using the default profile...

... output snipped ...

21 scenarios (21 passed)
138 steps (138 passed)
0m22.352s
Loaded suite script/cucumber
Started

Finished in 0.002972 seconds.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips

Test run options: --seed 16197
Coverage report generated for Cucumber Features to /Users/jgeiger/
workspace/web_app/coverage




$ bundle exec rake cucumber --trace
(in /Users/jgeiger/workspace/web_app)
** Invoke cucumber (first_time)
** Invoke cucumber:ok (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Execute cucumber:ok
bundle exec /Users/jgeiger/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I "/
Users/jgeiger/workspace/web_app/vendor/bundle/ruby/1.9.1/gems/
cucumber-0.9.0/lib:lib" "/Users/jgeiger/workspace/web_app/vendor/
bundle/ruby/1.9.1/gems/cucumber-0.9.0/bin/cucumber" --profile default
Using the default profile...

... output snipped ...

21 scenarios (21 passed)
138 steps (138 passed)
0m22.055s
/Users/jgeiger/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:566:in `block in process_args': invalid option: --profile
(OptionParser::InvalidOption)
from /Users/jgeiger/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:545:in `new'
from /Users/jgeiger/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:545:in `process_args'
from /Users/jgeiger/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:576:in `run'
from /Users/jgeiger/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/
unit.rb:492:in `block in autorun'
Coverage report generated for Cucumber Features to /Users/jgeiger/
workspace/web_app/coverage
** Execute cucumber






Here's my Gemfile.lock

GIT
remote: git://github.com/bmabey/database_cleaner.git
revision: 04ba63bfeee185480c29c3f0d742ec15852f117b
specs:
database_cleaner (0.6.0.rc.2)

GIT
remote: git://github.com/jnicklas/capybara.git
revision: d584bb34e9782101aabe1c68a7dd68ed2aafb02a
specs:
capybara (0.3.9)
celerity (>= 0.7.9)
culerity (>= 0.2.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.27)
xpath (>= 0.1.0)

GIT
remote: git://github.com/plataformatec/devise.git
revision: d6084ab1f7d8b2f07f5a2a9ddd702cc99ce62b3a
specs:
devise (1.2.0)
bcrypt-ruby (~> 2.1.2)
warden (~> 0.10.7)

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.0)
actionpack (= 3.0.0)
mail (~> 2.2.5)
actionpack (3.0.0)
activemodel (= 3.0.0)
activesupport (= 3.0.0)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4.1)
rack (~> 1.2.1)
rack-mount (~> 0.6.12)
rack-test (~> 0.5.4)
tzinfo (~> 0.3.23)
activemodel (3.0.0)
activesupport (= 3.0.0)
builder (~> 2.1.2)
i18n (~> 0.4.1)
activerecord (3.0.0)
activemodel (= 3.0.0)
activesupport (= 3.0.0)
arel (~> 1.0.0)
tzinfo (~> 0.3.23)
activeresource (3.0.0)
activemodel (= 3.0.0)
activesupport (= 3.0.0)
activesupport (3.0.0)
addressable (2.2.1)
agraph (0.1.1)
arel (1.0.1)
activesupport (~> 3.0.0)
bcrypt-ruby (2.1.2)
builder (2.1.2)
celerity (0.8.2)
closure-compiler (0.3.2)
configuration (1.1.0)
cucumber (0.9.0)
builder (~> 2.1.2)
diff-lcs (~> 1.1.2)
gherkin (~> 2.2.2)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
cucumber-rails (0.3.2)
cucumber (>= 0.8.0)
culerity (0.2.12)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
factory_girl (1.3.2)
factory_girl_rails (1.0)
factory_girl (~> 1.3)
rails (>= 3.0.0.beta4)
fakeweb (1.3.0)
faraday (0.4.6)
addressable (>= 2.1.1)
rack (>= 1.0.1)
ffi (0.6.3)
rake (>= 0.8.7)
gherkin (2.2.3)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
trollop (~> 1.16.2)
haml (3.0.18)
i18n (0.4.1)
jammit (0.5.3)
closure-compiler (>= 0.1.0)
yui-compressor (>= 0.9.1)
json (1.4.6)
json_pure (1.4.6)
launchy (0.3.7)
configuration (>= 0.0.5)
rake (>= 0.8.1)
mail (2.2.6.1)
activesupport (>= 2.3.6)
mime-types
treetop (>= 1.4.5)
mime-types (1.16)
multi_json (0.0.4)
mysql2 (0.2.4)
nokogiri (1.4.3.1)
oauth2 (0.0.13)
faraday (~> 0.4.1)
multi_json (>= 0.0.4)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
rack-test (0.5.4)
rack (>= 1.0)
rails (3.0.0)
actionmailer (= 3.0.0)
actionpack (= 3.0.0)
activerecord (= 3.0.0)
activeresource (= 3.0.0)
activesupport (= 3.0.0)
bundler (~> 1.0.0)
railties (= 3.0.0)
railties (3.0.0)
actionpack (= 3.0.0)
activesupport (= 3.0.0)
rake (>= 0.8.4)
thor (~> 0.14.0)
rake (0.8.7)
rdf (0.2.3)
addressable (~> 2.2.0)
rest-client (1.6.1)
mime-types (>= 1.16)
rspec (2.0.0.beta.22)
rspec-core (= 2.0.0.beta.22)
rspec-expectations (= 2.0.0.beta.22)
rspec-mocks (= 2.0.0.beta.22)
rspec-core (2.0.0.beta.22)
rspec-expectations (2.0.0.beta.22)
diff-lcs (>= 1.1.2)
rspec-mocks (2.0.0.beta.22)
rspec-core (= 2.0.0.beta.22)
rspec-expectations (= 2.0.0.beta.22)
rspec-rails (2.0.0.beta.22)
rspec (= 2.0.0.beta.22)
rubyzip (0.9.4)
selenium-webdriver (0.0.28)
ffi (>= 0.6.1)
json_pure
rubyzip
simplecov (0.3.6)
simplecov-html (>= 0.3.7)
simplecov-html (0.3.8)
spork (0.8.4)
term-ansicolor (1.0.5)
thor (0.14.1)
treetop (1.4.8)
polyglot (>= 0.3.1)
trollop (1.16.2)
tzinfo (0.3.23)
warden (0.10.7)
rack (>= 1.0.0)
webrat (0.7.1)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
will_paginate (3.0.pre2)
xpath (0.1.0)
yui-compressor (0.9.1)

PLATFORMS
ruby

DEPENDENCIES
agraph
bcrypt-ruby
capybara!
cucumber
cucumber-rails
database_cleaner!
devise!
factory_girl_rails
fakeweb
haml
jammit (>= 0.5.3)
launchy
mysql2
oauth2
rails (>= 3.0.0)
rdf
rest-client
rspec (>= 2.0.0.beta.22)
rspec-rails (>= 2.0.0.beta.22)
simplecov
spork
warden
webrat
will_paginate (>= 3.0.pre2)



Stewart

unread,
Oct 12, 2010, 5:02:46 AM10/12/10
to Cukes
Same issue here. I dont even know what mini test is although some how
its causing this issue. Is there a solution/workaround you came up
with?

aslak hellesoy

unread,
Oct 12, 2010, 6:13:33 AM10/12/10
to cu...@googlegroups.com
On Tue, Oct 12, 2010 at 11:02 AM, Stewart <stewart....@gmail.com> wrote:
Same issue here. I dont even know what mini test is although some how
its causing this issue. Is there a solution/workaround you came up
with?


Like I have said - you have to try to identify where minitest is loaded from. -Probably one of your dependencies.

The brute force way to do that is to add 

raise "WTF"

inside your minitest/autorun.rb file

HTH,
Aslak
 

Stewart

unread,
Oct 12, 2010, 7:32:32 AM10/12/10
to Cukes
Ah ok well digging in to this a little more it seems that minitest/
autorun.rb is not getting loaded as "WTF" does not get raised while
running the test. Putting raise "WTF" in minitest/unit.rb does
however. At the end of this message is that stack trace. It seems that
ruby test unit is calling mini test. I was convinced that I was using
rspec so I am not quite sure why test/unit would be called to call
minitest????

/Users/stewartmatheson/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/
minitest/unit.rb:6:in `<top (required)>'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block
in require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:227:in
`load_dependency'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/test/
unit.rb:3:in `<top (required)>'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block
in require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:227:in
`load_dependency'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
railties-3.0.0/lib/rails/test_help.rb:5:in `<top (required)>'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block
in require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:227:in
`load_dependency'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/cucumber-
rails-0.3.1/lib/cucumber/rails/world.rb:10:in `<top (required)>'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block
in require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:227:in
`load_dependency'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/cucumber-
rails-0.3.1/lib/cucumber/rails/rspec.rb:1:in `<top (required)>'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block
in require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:227:in
`load_dependency'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
/Users/stewartmatheson/code/rails/london/features/support/env.rb:11:in
`<top (required)>'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/lib/cucumber/rb_support/rb_language.rb:141:in `require'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/lib/cucumber/rb_support/rb_language.rb:141:in
`load_code_file'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/lib/cucumber/step_mother.rb:108:in `load_code_file'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/lib/cucumber/step_mother.rb:100:in `block in
load_code_files'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/lib/cucumber/step_mother.rb:99:in `each'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/lib/cucumber/step_mother.rb:99:in `load_code_files'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/lib/cucumber/cli/main.rb:53:in `execute!'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/lib/cucumber/cli/main.rb:25:in `execute'
/Users/stewartmatheson/.rvm/gems/ruby-1.9.2-p0@london/gems/
cucumber-0.8.5/bin/cucumber:8:in `<main>'


On Oct 12, 11:13 am, aslak hellesoy <aslak.helle...@gmail.com> wrote:
> > "Cukes" group.> To post to this group, send email toc...@googlegroups.com.
> > To unsubscribe from this group, send email to>cukes+un...@googlegroups.com<cukes%2Bunsu...@googlegroups.com>.
> > For more
>
> ...
>
> read more »

aslak hellesoy

unread,
Oct 12, 2010, 7:44:37 AM10/12/10
to cu...@googlegroups.com
On Tue, Oct 12, 2010 at 1:32 PM, Stewart <stewart....@gmail.com> wrote:
Ah ok well digging in to this a little more it seems that minitest/
autorun.rb is not getting loaded as "WTF" does not get raised while
running the test. Putting raise "WTF" in minitest/unit.rb does
however. At the end of this message is that stack trace. It seems that
ruby test unit is calling mini test.

Yes. In Ruby 1.9.x, the old test/unit codebase has been deleted in favour of minitest, which is much leaner. There are still test/unit files for backwards compatibility reasons, but they just delegate to minitest.
 
I was convinced that I was using
rspec so I am not quite sure why test/unit would be called to call
minitest????


Some library (rails) seems to be loading test/unit (and thereby minitest) still.

The problem seems to be that Minitest::Unit.autorun is called, which sets up an at_exit hook in Ruby.

Add a raise "WTF" to that method to find out where this is done from. (Around line 490 in minitest/unit.rb)

That should give you a new trace we can analyse.

Aslak

aslak hellesoy

unread,
Oct 12, 2010, 8:04:12 AM10/12/10
to cu...@googlegroups.com
On Tue, Oct 12, 2010 at 1:44 PM, aslak hellesoy <aslak.h...@gmail.com> wrote:


On Tue, Oct 12, 2010 at 1:32 PM, Stewart <stewart....@gmail.com> wrote:
Ah ok well digging in to this a little more it seems that minitest/
autorun.rb is not getting loaded as "WTF" does not get raised while
running the test. Putting raise "WTF" in minitest/unit.rb does
however. At the end of this message is that stack trace. It seems that
ruby test unit is calling mini test.

Yes. In Ruby 1.9.x, the old test/unit codebase has been deleted in favour of minitest, which is much leaner. There are still test/unit files for backwards compatibility reasons, but they just delegate to minitest.
 
I was convinced that I was using
rspec so I am not quite sure why test/unit would be called to call
minitest????


Some library (rails) seems to be loading test/unit (and thereby minitest) still.

The problem seems to be that Minitest::Unit.autorun is called, which sets up an at_exit hook in Ruby.

Add a raise "WTF" to that method to find out where this is done from. (Around line 490 in minitest/unit.rb)

That should give you a new trace we can analyse.


test/unit.rb calls MiniTest::Unit.autorun - which causes all the mayhem.

2 Solutions:

1) Find out where test/unit is loaded from in your stack. Try to disable it, or submit a patch if loading it can be considered a bug.
2) Add a hack to Cucumber that loads MiniTest::Unit *before* test/unit does it, and set the @@installed_at_exit var to trye in MiniTest::Unit so that the at_exit hook never gets installed. (I'd happily take a patch for this).

Aslak

Stewart

unread,
Oct 12, 2010, 10:31:32 AM10/12/10
to Cukes
Aslak,

Thanks for the heads up. Option 2 sounds better and I would love to
submit a patch and help out. How ever my knowledge in this area of
ruby is not great. I figured the best way to do option 2 would be to
override the class and set the option.

require 'minitest/unit'
module SurpressAutorun
def self.autorun
attr_accessor :installed_at_exit
end
end
MiniTest::Unit.extend SurpressAutorun
MiniTest::Unit.installed_at_exit = false

I had this code starting in world.rb around line 10 before the test
helper gets loaded. Will test/unit.rb re-requiring this code make my
code not work? I was assuming that ruby does not re-require anything
that has already been loaded there for my changes would stand. However
when I trace @@installed at exit from MiniTest::Unit.autorun its set
to false. Is there something that is setting it back to false or is
there an issue with the code I have written?

On Oct 12, 1:04 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
> On Tue, Oct 12, 2010 at 1:44 PM, aslak hellesoy <aslak.helle...@gmail.com>wrote:
> ...
>
> read more »

Stewart

unread,
Oct 12, 2010, 10:34:09 AM10/12/10
to Cukes
Sorry typo in the code above. It should read:

require 'minitest/unit'
module SurpressAutorun
attr_accessor :installed_at_exit
end
MiniTest::Unit.extend SurpressAutorun
MiniTest::Unit.installed_at_exit = false

> ...
>
> read more »

aslak hellesoy

unread,
Oct 12, 2010, 10:51:00 AM10/12/10
to cu...@googlegroups.com
On Tue, Oct 12, 2010 at 4:34 PM, Stewart <stewart....@gmail.com> wrote:
Sorry typo in the code above. It should read:

 require 'minitest/unit'
 module SurpressAutorun
   attr_accessor :installed_at_exit
 end
 MiniTest::Unit.extend SurpressAutorun
 MiniTest::Unit.installed_at_exit = false


You were almost there - these @@ vars behave a little differently. This should do it:


Thanks for helping sort this issue out!

Aslak
 
> ...
>
> read more »

Stewart

unread,
Oct 12, 2010, 11:02:41 AM10/12/10
to Cukes
Yea just saw your patch. Will make a note of that one for the future.
One more thing I know about ruby :).

On Oct 12, 3:51 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
> On Tue, Oct 12, 2010 at 4:34 PM, Stewart <stewart.mathe...@gmail.com> wrote:
> > Sorry typo in the code above. It should read:
>
> >  require 'minitest/unit'
> >  module SurpressAutorun
> >     attr_accessor :installed_at_exit
> >  end
> >   MiniTest::Unit.extend SurpressAutorun
> >  MiniTest::Unit.installed_at_exit = false
>
> You were almost there - these @@ vars behave a little differently. This
> should do it:
>
> http://github.com/aslakhellesoy/cucumber/commit/00db9be57031f7d688169...
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages