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

specs are failing - Spree::LegacyUser and spree_roles= issues #9

Closed
peterberkenbosch opened this issue Aug 12, 2012 · 9 comments
Closed

Comments

@peterberkenbosch
Copy link
Member

Trying to make all the specs run again on the spree_auth_devise extension, I have some issues however with the way the spree_roles association is added.
In spree/core there is an initializer called user_class_extensions.rb[1]

While running the specs in spree_auth_devise this initializer is never loaded.. there are some more issues with the Factories and with the dummy application generator.. but first things first :)

How is one supposed to write a custom authentication extension and add proper specs? Can't really figure it out..

Maybe it's just the wine and am I missing something obvious.. :)

[1] https://github.com/spree/spree/blob/master/core/config/initializers/user_class_extensions.rb

@radar
Copy link
Contributor

radar commented Aug 12, 2012

I'm guessing this is because it's pointing at the wrong branch in the Gemfile. Taking a look now.

@peterberkenbosch
Copy link
Member Author

Thanks Ryan, noticed the wrong branch.. since the bundle command failed :) so I changed that in my fork. Still having issues though..

@radar
Copy link
Contributor

radar commented Aug 13, 2012

I am still looking at it.

@peterberkenbosch
Copy link
Member Author

I know.. Thanks.. having some issues wrapping my head around the way it should be solved properly.. there are a number of issues but some need to be solved in spree I think? (dummy app generator accepting a User class param perhaps?) and the user ext. initializer logic moving to lib? That way we can require it in the spec_helper..

Looking forward in seeing what the proper solution should be..

@radar
Copy link
Contributor

radar commented Aug 13, 2012

Good idea about the user class option :) The install generator accepts a --user-class option that'll let you pass the name of the class through. I updated the installer last week to prompt for this option if you elect to not use the default authentication system too.

The dummy application generator (common:test_app) now also takes an argument for user class. Any particular reason why you would want to move the initializer logic into lib after a change like that? Maybe I'm missing something.

@peterberkenbosch
Copy link
Member Author

it looked like the methods from the initializer are not available for the User when running the specs.. could not require the file as well since it's not in the loadpath from spree_core.. what makes sense.. hence the idea to move the logic somewhere in lib so we can require it in spec_helper..

Will dive in more in a bit... first lunch!

@radar
Copy link
Contributor

radar commented Aug 13, 2012

The only way I can think of where they'd be unavailable is if Spree.user_class had not been set to your User class inside config/initializers/spree.rb.

@radar
Copy link
Contributor

radar commented Aug 14, 2012

All the specs are now passing on my machine, just waiting for the CI to give it an all clear. Could you try running it on yours too?

@peterberkenbosch
Copy link
Member Author

Al green here!! Thanks.

damianlegawiec added a commit that referenced this issue Dec 19, 2019
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

2 participants