-
Notifications
You must be signed in to change notification settings - Fork 900
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
remove most of test authentication stubbing #17575
Conversation
spec/support/auth_helper.rb
Outdated
User.current_user = user | ||
puts "WARNING: double stubbing user - only use login_as or stub_user once" if user != User.current_user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STDERR.puts
? or perhaps warn
?
allow(controller).to receive(:current_user).and_return(user) | ||
allow(User).to receive(:current_user).and_return(user) | ||
# Stubs the user in context for a controller | ||
# @param features (:all|:none|Array<>,String,Symbol) features for a user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when specific features are chosen, how are they passed...as Strings? I see Array of symbol, but I would have expected String identifiers.
That being said, there already is an "everything" product feature, so we should deprecate :all
, and none can be handled by passing an empty Array, so we should probably deprecate :none
as well. Then there are no "special" feature names, only real ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thnx - array of strings or symbols work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) I would like to s/all/everything
in a future PR. it is in many repos.
b) :none
seems to work very well. It creates all the joining models. The user ends up with feature(s), just features that aren't ones that affect us
This looks really nice. Much cleaner. |
Agreed, looks great, thanks :) |
72e4160
to
5b77924
Compare
Some comments on commit kbrock@5b77924 spec/support/auth_helper.rb
|
Checked commit kbrock@5b77924 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and doesn't break ui-classic travis 👍 :)
If we have fewer stubs, then we are testing more code and we are encouraged to pay attention to roles/miq_product_features and authorization.
I can see the argument that this makes it more or less stable.
So I'm putting it out there and seeing what others thing.
I just ran master classic-ui and all tests passed locally
@himdel - thoughts?