-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create device for User - EXTRA: set boolean for Admin in User schema #11
Conversation
@@ -0,0 +1,5 @@ | |||
FactoryGirl.define do |
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.
If you're not using it, remove it!
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.
using it now and added factory for user
@@ -0,0 +1,5 @@ | |||
require 'rails_helper' |
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.
idem
t.string :email, null: false, default: "" | ||
t.string :encrypted_password, null: false, default: "" | ||
# created extra boolean whether user is admin or not | ||
t.boolean :admin, default: false |
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.
Please create test to expose/ensure that a user won't be an admin by default (as it is important business logic). Also, add a test to show your colleagues how to add an admin user to the system.
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.
added specs
@arnoFleming , it should be better now. |
please label me @leefreemanxyz ! |
spec/models/user_spec.rb
Outdated
expect(guest_user.admin).to eq(false) | ||
end | ||
|
||
it "the 'Admin' status is false" do | ||
it "if 'Admin' status is set to true by another Admin, |
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.
I think we could describe this test as : 'it "creates an admin user when admin: true is included in the create function" '
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.
@lee, changed it according to your suggestion
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.
Goed.
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.
🚢 it
Created devise for user with extra: Admin boolean - standard to false