Skip to content

Commit

Permalink
Adds devise, test suite for user model
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-garcia-nkla committed Feb 26, 2025
1 parent 6f47ffc commit 1e75694
Show file tree
Hide file tree
Showing 12 changed files with 553 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ gem "turbo-rails"
gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
gem "devise"
gem "petergate"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"
Expand Down Expand Up @@ -50,6 +52,11 @@ group :development, :test do

# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false
gem "factory_bot_rails"
gem "faker"
gem "minitest", "~> 5.20"
gem "minitest-rails"
gem "pry"
end

group :development do
Expand Down
37 changes: 37 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
base64 (0.2.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bcrypt_pbkdf (1.1.1-arm64-darwin)
bcrypt_pbkdf (1.1.1-x86_64-darwin)
Expand All @@ -96,6 +97,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
coderay (1.1.3)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
crass (1.0.6)
Expand All @@ -106,12 +108,25 @@ GEM
debug (1.10.0)
irb (~> 1.10)
reline (>= 0.3.8)
devise (4.9.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
dotenv (3.1.7)
drb (2.2.1)
ed25519 (1.3.0)
erubi (1.13.1)
et-orbi (1.2.11)
tzinfo
factory_bot (6.5.1)
activesupport (>= 6.1.0)
factory_bot_rails (6.4.4)
factory_bot (~> 6.5)
railties (>= 5.0.0)
faker (3.5.1)
i18n (>= 1.8.11, < 2)
fugit (1.11.1)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
Expand Down Expand Up @@ -171,8 +186,12 @@ GEM
net-smtp
marcel (1.0.4)
matrix (0.4.2)
method_source (1.1.0)
mini_mime (1.1.5)
minitest (5.25.4)
minitest-rails (8.0.0)
minitest (~> 5.20)
railties (>= 8.0.0, < 8.1.0)
msgpack (1.8.0)
net-imap (0.5.6)
date
Expand Down Expand Up @@ -205,11 +224,14 @@ GEM
racc (~> 1.4)
nokogiri (1.18.3-x86_64-linux-musl)
racc (~> 1.4)
orm_adapter (0.5.0)
ostruct (0.6.1)
parallel (1.26.3)
parser (3.3.7.1)
ast (~> 2.4.1)
racc
petergate (3.0.0)
activerecord (> 4.0.0)
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
Expand All @@ -218,6 +240,9 @@ GEM
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.2.3)
date
stringio
Expand Down Expand Up @@ -270,6 +295,9 @@ GEM
regexp_parser (2.10.0)
reline (0.6.0)
io-console (~> 0.5)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.4.1)
rubocop (1.72.2)
json (~> 2.3)
Expand Down Expand Up @@ -374,6 +402,8 @@ GEM
unicode-emoji (4.0.4)
uri (1.0.2)
useragent (0.16.11)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand Down Expand Up @@ -406,10 +436,17 @@ DEPENDENCIES
capybara
dartsass-rails
debug
devise
factory_bot_rails
faker
importmap-rails
jbuilder
kamal
minitest (~> 5.20)
minitest-rails
petergate
propshaft
pry
puma (>= 5.0)
rails (~> 8.0.1)
rubocop-rails-omakase
Expand Down
20 changes: 20 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class User < ApplicationRecord
############################################################################################
## PeterGate Roles ##
## The :user role is added by default and shouldn't be included in this list. ##
## The :root_admin can access any page regardless of access settings. Use with caution! ##
## The multiple option can be set to true if you need users to have multiple roles. ##
petergate(roles: [:pizza_store_owner, :pizza_chef], multiple: false) ##

Check failure on line 7 in app/models/user.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideArrayLiteralBrackets: Use space inside array brackets.

Check failure on line 7 in app/models/user.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideArrayLiteralBrackets: Use space inside array brackets.
############################################################################################

PIZZA_STORE_OWNER = :pizza_store_owner
PIZZA_CHEF = :pizza_chef

Check failure on line 12 in app/models/user.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/TrailingWhitespace: Trailing whitespace detected.

# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable

validates :email, presence: true, uniqueness: true
end
Loading

0 comments on commit 1e75694

Please sign in to comment.