davetron5000 / optparse-plus

Start your command line scripts off right in Ruby
http://davetron5000.github.com/optparse-plus
Apache License 2.0
521 stars 54 forks source link

Feature Tests Failing on Ruby 2.2.3 #99

Closed Luminus closed 6 years ago

Luminus commented 8 years ago

Hey @davetron5000,

Thanks for the amazing work here.

I'm having an issue with the feature tests.

Running the app using bundle exec works, but the tests keep failing so I won't know if something messes up and I can't go TDD with it behaving this way.

Here's the output I get when I run the tests.

Feature: My bootstrapped app kinda works
  In order to get going on coding my awesome app
  I want to have aruba and cucumber setup
  So I don't have to do it myself

  Scenario: App just runs
    When I get help for "fullstop"
    Then the exit status should be 0
      expected that command "fullstop --help" has exit status of "0", but has "1".  (RSpec::Expectations::ExpectationNotMetError)
      features/fullstop.feature:8:in `Then the exit status should be 0'
    And the banner should be present
    And the banner should document that this app takes options
    And the following options should be documented:
      | --version |
    And the banner should document that this app takes no arguments

Failing Scenarios:
cucumber features/fullstop.feature:6

1 scenario (1 failed)
6 steps (1 failed, 4 skipped, 1 passed)
0m0.473s

I have methadone 1.9.2, ruby 2.2.3, rbenv 0.4.0

davetron5000 commented 8 years ago

I think you commented on another issue with this same problem. Can you add announce to your Scenario tag and past what happens? Something is causing your app to exit with 1 instead of 0. Also, pasing your bin/fullstop (or sharing on github) might help.

Luminus commented 8 years ago

Hey Dave,

Thanks for getting back to me on this.

Here’s the relevant bit of the output from adding announce to the Scenario.

STDERR
  @announce
  Scenario: App just runs
    When I get help for "fullstop"
<<-STDOUT

STDOUT
<<-STDERR
/Users/luminus/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- fullstop (LoadError)
    from /Users/luminus/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/luminus/Desktop/methadone_test/fullstop/bin/fullstop:5:in `<main>'

STDERR
    Then the exit status should be 0
      expected that command "fullstop --help" has exit status of "0", but has "1". (RSpec::Expectations::ExpectationNotMetError)
      features/fullstop.feature:9:in `Then the exit status should be 0'
    And the banner should be present
    And the banner should document that this app takes options
    And the following options should be documented:
      | --version |
    And the banner should document that this app takes no arguments
<<-STDOUT

STDOUT
<<-STDERR
/Users/luminus/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- fullstop (LoadError)
    from /Users/luminus/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/luminus/Desktop/methadone_test/fullstop/bin/fullstop:5:in `<main>'

STDERR
<<-STDOUT

STDOUT
<<-STDERR
/Users/luminus/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- fullstop (LoadError)
    from /Users/luminus/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/luminus/Desktop/methadone_test/fullstop/bin/fullstop:5:in `<main>'

STDERR

Failing Scenarios:
cucumber features/fullstop.feature:7

1 scenario (1 failed)
6 steps (1 failed, 4 skipped, 1 passed)
0m0.487s

From what I can see, this is pretty much the same thing that happens when I try to run the app without using bundle exec

Here’s the output for that:

bin/fullstop --help
/Users/luminus/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- fullstop (LoadError)
    from /Users/luminus/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from bin/fullstop:5:in `<main>’

Does this give you any insight into what’s going on or do I need to provide more information?

Thanks again.

davetron5000 commented 8 years ago

Interesting. The configuration should account for this, but that seems to be the problem.

Can you try making your features/support/env.rb look more like this: https://github.com/davetron5000/methadone/blob/master/features/support/env.rb Wondering if something odd is going on with the generated one?

Luminus commented 8 years ago

Hey Dave,

Thanks for getting back to me.

I just replaced the old features/support/env.rb file with the contents of the one you linked to and there’s no difference. I get the exact same errors.

Here’s the one that was originally generated

require 'aruba/cucumber'
require 'methadone/cucumber'

ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')

Before do
  # Using "announce" causes massive warnings on 1.9.2
  @puts = true
  @original_rubylib = ENV['RUBYLIB']
  ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
end

After do
  ENV['RUBYLIB'] = @original_rubylib
end
davetron5000 commented 8 years ago

Any chance you can post your WIP as a github repo somewhere?

Luminus commented 8 years ago

Hey Dave,

I haven’t really done anything, but I’ve setup a github repo here https://github.com/Luminus/fullstop

davetron5000 commented 8 years ago

Hmmm. I cloned this repo and the only failure I get is in the feature “And the banner should document that this app takes no arguments” because your version does add an argument. If I comment out this line: https://github.com/Luminus/fullstop/blob/master/bin/fullstop#L33 the tests pass.

I'm on Ruby 2.2.3:

> ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]

RVM 1.26.11:

> rvm -v
rvm 1.26.11 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

And using a clean gemset with these gems after doing a bundle install:

> bundle exec gem list

*** LOCAL GEMS ***

aruba (0.11.2)
builder (3.2.2)
bundler (1.10.6)
childprocess (0.5.8)
contracts (0.12.0)
cucumber (2.1.0)
cucumber-core (1.3.1)
diff-lcs (1.2.5)
event-bus (0.2.1)
ffi (1.9.10)
fullstop (0.1.0)
gherkin3 (3.1.2)
json (1.8.3)
methadone (1.9.2)
multi_json (1.11.2)
multi_test (0.1.2)
power_assert (0.2.6)
rake (10.4.2)
rdoc (4.2.1)
rspec-expectations (3.4.0)
rspec-support (3.4.1)
test-unit (3.1.5)
thor (0.19.1)

I'm on OS X, El Capitain. I'm trying to think of other things that could affect this, but nothing is popping into my head?

Luminus commented 8 years ago

I’m so confused right now.

I’m running El Capitan as well.

I’m on Ruby 2.2.3:

❯ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]

Rbenv 0.4.0

❯ rbenv -v
rbenv 0.4.0

And here’s my gems as well

❯ bundle exec gem list

*** LOCAL GEMS ***

aruba (0.11.2)
builder (3.2.2)
bundler (1.10.6)
childprocess (0.5.8)
contracts (0.12.0)
cucumber (2.1.0)
cucumber-core (1.3.1)
diff-lcs (1.2.5)
event-bus (0.2.1)
ffi (1.9.10)
fullstop (0.1.0)
gherkin3 (3.1.2)
json (1.8.3)
methadone (1.9.2)
multi_json (1.11.2)
multi_test (0.1.2)
power_assert (0.2.6)
rake (10.4.2)
rdoc (4.2.1)
rspec-expectations (3.4.0)
rspec-support (3.4.1)
test-unit (3.1.5)
thor (0.19.1)
Luminus commented 8 years ago

Hey @davetron5000,

Any news on this front?

Thanks.

davetron5000 commented 8 years ago

I'm not sure what else to try. The only difference is you are using rbenv and I'm using rvm. I use rvm so I can create pristine gemsets, and maybe that's the difference?

Luminus commented 8 years ago

I've run gem pristine --all Still no joy.

davetron5000 commented 8 years ago

This is really tricky. I don't know what else to check at this point. Do you have rvm installed and can try that? I can't imagine what the difference would be…

yozlet commented 8 years ago

@Luminus I was having the same problem, pretty much identical setup (including rbenv). However, invoking the tests using bundle exec rake (instead of just rake) fixed it for me.

davetron5000 commented 8 years ago

Yeah, if you are using rbenv, you pretty much have to use bundle exec to pick up the precise gems in the bundle. Otherwise you get the latest of whatever's installed.

davetron5000 commented 6 years ago

Closing as old/unclear if still an issue. When #121 is merged, cucumber won't be supported any longer as I could not get the updated versions of Aruba to work.