Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cucumber 2.0.1 - Windows - Unable to run from anywhere but C drive #885

Closed
janahanEDH opened this issue Jul 9, 2015 · 4 comments
Closed

Comments

@janahanEDH
Copy link

I'm using Cucumber 2.0.1, Ruby 2.1.5, Windows 7.
This used to work fine on Cucumber 2.0.0.

If you try to run tests from a drive other than the C drive (My workspace is on the D drive), you get this:

different prefix: "C:/" and "d:/cuke_test" (ArgumentError)
C:/Ruby21/lib/ruby/2.1.0/pathname.rb:503:in `relative_path_from'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/hooks.rb:32:in `location'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/filters/prepare_world.rb:28:in `test_case'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/filters/prepare_world.rb:11:in `test_case'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:in `describe_to'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/filters/apply_around_hooks.rb:8:in `test_case'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:in `describe_to'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/filters/apply_after_hooks.rb:5:in `test_case'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:in `describe_to'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/filters/apply_before_hooks.rb:5:in `test_case'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:in `describe_to'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/filters/apply_after_step_hooks.rb:8:in `test_case'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:in `describe_to'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/filters/activate_steps.rb:8:in `test_case'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:in `describe_to'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/filters/quit.rb:11:in `test_case'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:in `describe_to'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/filters/locations_filter.rb:17:in `block in done'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/filters/locations_filter.rb:16:in `each'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/filters/locations_filter.rb:16:in `done'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/filter.rb:61:in `done'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/test/filters/tag_filter.rb:18:in `done'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/compiler.rb:23:in `done'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core/gherkin/parser.rb:31:in `done'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core.rb:29:in `parse'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-core-1.2.0/lib/cucumber/core.rb:18:in `compile'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/runtime.rb:70:in `run!'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/lib/cucumber/cli/main.rb:38:in `execute!'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-2.0.1/bin/cucumber:9:in `<top (required)>'
C:/Ruby21/bin/cucumber:23:in `load'
C:/Ruby21/bin/cucumber:23:in `<main>'
@brasmusson
Copy link
Contributor

Oops! Actually it is not "drive other than the C drive", but "drive other then where the Cucumber-Ruby gem is installed", as far as I can tell. Most likely the same error would occur (and also in Cucumber v2.0.0), when trying to require step definitions from another drive then the workspace (current directory).

@mattwynne
Copy link
Member

Thanks for reporting this so promptly!

It looks like there used to be a bug with this in a much earlier version of Ruby - https://redmine.ruby-lang.org/issues/1366 - but it was fixed.

See also http://stackoverflow.com/questions/669417/ruby-relative-path-from-call-on-windows.

@brasmusson
Copy link
Contributor

The issue https://redmine.ruby-lang.org/issues/1366 was about mistake "C:" and "c:" (different capitalization) for different drives. Here we actually have different drives, so to me it looks like relative_path_from cannot work in this situation.

Exploring how the path in the location for step definitions (most commonly) are calculated cucumber/core_ext/proc.rb reveals that relative path is used only when the step definition is located below the current directory in the file system, otherwise absolute path is used (unless the step definition is loaded from an installed gem, where the relative path to the gem directory is used). For instance:

/<path>/workspace$ cucumber -r ../global_step_defs features

will result in that the step definitions form the global_step_defs directory will be printed by the Pretty formatter as something like:

    Given <some step>       # /<path>/global_step_defs/<file>.rb:<line>

Doing the same for the location for hooks (and step definitions base on symbols) would fix this issue.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants