cucumber / cucumber-rails

Rails Generators for Cucumber with special support for Capybara and DatabaseCleaner
https://github.com/cucumber/cucumber-rails
MIT License
1.02k stars 327 forks source link

minitest warning #279

Closed andriytyurnikov closed 10 years ago

andriytyurnikov commented 10 years ago

be rake cucumber /Users/andriytyurnikov/.rbenv/versions/2.1.1/bin/ruby -S bundle exec cucumber --profile default Warning: you should require 'minitest/autorun' instead. Warning: or add 'gem "minitest"' before 'require "minitest/autorun"' From: /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/2.1.0/test/unit/assertions.rb:1:in require' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/2.1.0/test/unit/assertions.rb:1:in<top (required)>' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/rb_support/rb_language.rb:17:in require' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/rb_support/rb_language.rb:17:inrescue in rescue in <top (required)>' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/rb_support/rb_language.rb:12:in rescue in <top (required)>' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/rb_support/rb_language.rb:9:in<top (required)>' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/cli/options.rb:3:in require' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/cli/options.rb:3:in<top (required)>' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/cli/configuration.rb:2:in require' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/cli/configuration.rb:2:in<top (required)>' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/cli/main.rb:12:in require' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/lib/cucumber/cli/main.rb:12:in<top (required)>' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/bin/cucumber:11:in require' /Users/andriytyurnikov/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/cucumber-1.3.11/bin/cucumber:11:in<top (required)>' /Users/andriytyurnikov/.rbenv/versions/2.1.1/bin/cucumber:23:in load' /Users/andriytyurnikov/.rbenv/versions/2.1.1/bin/cucumber:23:in

' Using the default profile...

Kosmas commented 10 years ago

Hi @andriytyurnikov , thanks for reporting this.

It has not been tested with ruby 2.1, which I presume is the issue here. Did you have the same with ruby 2.0 ?

andriytyurnikov commented 10 years ago

Warning is there for 1.9.3-p545... Edge rails 4.2 may be the source of warning :) BTW 2.1 is a stable release for 2 months - time to update CI matrix ;)

Kosmas commented 10 years ago

Which version are you using? Have you tried with the master branch?

andriytyurnikov commented 10 years ago

rails master, cucumber-rails master no rspec

mattwynne commented 10 years ago

My guess is that we need to update http://github.com/cucumber/multi_test to deal with Ruby 2.1

mattwynne commented 10 years ago

On 4 Mar 2014, at 16:08, Andriy Tyurnikov notifications@github.com wrote:

BTW 2.1 is a stable release for 2 months - time to update CI matrix ;)

Looking forward to your pull request ;)

frgooall commented 10 years ago

I had the same issue...Rails 4.1.0-rc1 and Ruby 2.1. I used Ruby 2.0.0-p353 and got the same error. I read on stack overflow that cucumber 1.3.3 is a fix...see

http://stackoverflow.com/questions/17483143/cucumber-minitest-error

Hope this helps!

DanielKehoe commented 10 years ago

I am getting the warning when running Cucumber with Rails 4.1.0.rc1 and Ruby 2.1.1. I've tried both the Cucumber stable version and the version from the master branch. No problem with Rails 4.0.3 and Ruby 2.1.1 and the Cucumber stable version.

Here's details.

$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
$ rails -v
Rails 4.1.0.rc1
$ rails new myapp
$ cd myapp

Add to Gemfile:
group :test do
  gem 'cucumber-rails', require: false, :git => 'git://github.com/cucumber/cucumber-rails.git'
  gem 'database_cleaner'
end

$ bundle install
$ rails generate cucumber:install
$ rake cucumber
/Users/danielkehoe/.rvm/rubies/ruby-2.1.1/bin/ruby -S bundle exec cucumber  --profile default
Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
From:
  /Users/danielkehoe/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/test/unit/assertions.rb:1:in `require'
  /Users/danielkehoe/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/test/unit/assertions.rb:1:in `<top (required)>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/rb_support/rb_language.rb:17:in `require'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/rb_support/rb_language.rb:17:in `rescue in rescue in <top (required)>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/rb_support/rb_language.rb:12:in `rescue in <top (required)>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/rb_support/rb_language.rb:9:in `<top (required)>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/cli/options.rb:3:in `require'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/cli/options.rb:3:in `<top (required)>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/cli/configuration.rb:2:in `require'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/cli/configuration.rb:2:in `<top (required)>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/cli/main.rb:12:in `require'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/lib/cucumber/cli/main.rb:12:in `<top (required)>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/bin/cucumber:11:in `require'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/gems/cucumber-1.3.11/bin/cucumber:11:in `<top (required)>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/bin/cucumber:23:in `load'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/bin/cucumber:23:in `<main>'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/bin/ruby_executable_hooks:15:in `eval'
  /Users/danielkehoe/.rvm/gems/ruby-2.1.1@rails4.1/bin/ruby_executable_hooks:15:in `<main>'
Using the default profile...
0 scenarios
0 steps
0m0.000s
frgooall commented 10 years ago

The "fix-rails-requiring-mini-test" branch cleared the warning for me...here is my test group

group :test do gem 'capybara' gem 'cucumber-rails', :git => "https://github.com/cucumber/cucumber-rails.git", :branch => "fix-rails- requiring-mini-test", :require => false gem "minitest", "~> 5.3.0" gem 'rspec-rails', '2.11.0' gem 'database_cleaner' gem 'factory_girl', '3.5.0' end

DanielKehoe commented 10 years ago

Thanks Fritz!

frgooall commented 10 years ago

You are welcomed!

andriytyurnikov commented 10 years ago

@frgooall warnings are still there (no rspec though)

DanielKehoe commented 10 years ago

@frgooall I still get the warnings with your suggested fix. Are you using Rails 4.1.0.rc1 and Ruby 2.1.1?

In any case, it'd be good to see a fix in the released gem before Rails 4.1 is released.

frgooall commented 10 years ago

Humm sorry to hear that...see below, run a quick test and I provided a link to my complete gemfile

https://gist.github.com/frgooall/9538016

[recruitsimply (master)]$ rails -v
Rails 4.1.0.rc1
[recruitsimply (master)]$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
[recruitsimply (master)]$ bundle exec cucumber
Using the default profile...
Feature: Account Registration
  For secruity and tracking purposes, a user must have a account to use the system. The user can choose to create a new account or use facebook or twitter for their account creditals.

  In order to register for an account
  As a new user
  I want to create a new account or use my facebook/twitter account.

  Scenario: New Account                                        # features/registration.feature:9
    Given I am on the sign up page                             # features/step_definitions/webrat_steps.rb:6
    And I fill in "user_email" with "email@place.com"          # features/step_definitions/webrat_steps.rb:22
    And I fill in "user_password" with "password"              # features/step_definitions/webrat_steps.rb:22
    And I fill in "user_password_confirmation" with "password" # features/step_definitions/webrat_steps.rb:22
    And I press "Sign Up"                                      # features/step_definitions/webrat_steps.rb:14
    Then I should see "You have signed up successfully"        # features/step_definitions/webrat_steps.rb:97

1 scenario (1 passed)
6 steps (6 passed)
0m0.173s
[recruitsimply (master)]$
andriytyurnikov commented 10 years ago

...@frgooall which make rspec a dependency

to others here is fix - warnings are there, but at last assertions do work:

# in features/support/minitest.rb
require 'minitest'
module MiniTestAssertions
  def self.extended(base)
    base.extend(MiniTest::Assertions)
    base.assertions = 0
  end

  attr_accessor :assertions
end
World(MiniTestAssertions)
tooky commented 10 years ago

I believe this is fixed by cucumber 1.3.12.

andriytyurnikov commented 10 years ago

@tooky - confirmed, cucumber update fixed stuff

linojon commented 10 years ago

i still needed this fix, with cucumber 1.3.15, cucumber-rails 1.4.1, rails 4.1.1, ruby 2.1.1

Kosmas commented 10 years ago

@linojon are you saying that you still have a problem, or it's fixed now?

nemesis commented 10 years ago

Try exec-ing the command in the bundle's context with bundle exec #{command} This solved the problem for me. Sorry if I'm missing something.

Cheers