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

Rails 4: Cannot use '--format progess' when class is named 'Progress' #251

Closed
chrisroos opened this issue Jul 5, 2013 · 5 comments
Closed

Comments

@chrisroos
Copy link

This looks similar to cucumber issue 345[1] and has re-appeared after upgrading our Rails 3.2 app to Rails 4 (i.e. this works fine against Rails 3.2).

I'm adding this issue against cucumber-rails even though I have tracked the problem down to the Cucumber::Constantize#constantize auto-loading magic in cucumber itself.

To replicate:

* Create a new Rails 4 project
* Add cucumber-rails and database_cleaner to the Gemfile

$ bundle install
$ rails g cucumber:install
$ rails g model:progress
$ rake db:migrate

$ cucumber --format=progress
#=> wrong number of arguments (3 for 1)
#=> Error creating formatter: progress (ArgumentError)

I've also created a dummy Rails 4 app to illustrate the problem: https://github.com/chrisroos/rails-4-and-cucumber

[1] cucumber/common#345

@mattwynne
Copy link
Member

I think this should be fixed by Cucumber 1.3.5, which I just released. Can you please try it?

@mattwynne
Copy link
Member

Actually that may be bollocks but please try anyway! :)

@Kosmas
Copy link
Member

Kosmas commented Feb 10, 2014

@mattwynne just tried it and still gives an error:

wrong number of arguments (3 for 0..2) 
Error creating formatter: progress (ArgumentError)

and the runtime dependency for cucumber is >= 1.3.8

@mattwynne
Copy link
Member

I've done some investigation today. It seems that Rails 4 changes the behaviour of Object.const_get / Object.const_missing? to search up and return constants from parent namespaces if the specific constant asked for can't be found.

We've been relying on the behaviour of these methods to automatically require the formatter only where necessary. I guess we'll have to change this. @tooky something to think about for 2.0 as we change the way formatters get loaded, eh?

The workaround is to include this line somewhere in features/support:

require 'cucumber/formatter/progress'

@chrisroos thanks for logging this and making the test repo - that really helped me to investigate it. Mind if we close this now?

@chrisroos
Copy link
Author

I've just had a little play and can see that adding require 'cucumber/formatter/progress' to features/support/progress-formatter.rb does the trick.

I'm more than happy for you to close the issue, @mattwynne.

mxygem added a commit that referenced this issue Aug 24, 2017
mxygem added a commit that referenced this issue Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants