Skip to content

Commit

Permalink
Use VerbNoun convention for operations
Browse files Browse the repository at this point in the history
Conventions make the world a better place. Let's use them :D

Closes #385
  • Loading branch information
paulcsmith committed Aug 12, 2019
1 parent d439b9c commit 2b3e0b4
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class SignUserIn < Avram::Operation
class SignInUser < Avram::Operation
# You can modify this in src/operations/mixins/user_from_email.cr
include UserFromEmail

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class SignUserUp < User::SaveOperation
class SignUpUser < User::SaveOperation
# Change password validations in src/operations/mixins/password_validations.cr
include PasswordValidations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AuthenticationFlow < BaseFlow

def sign_up(password)
visit SignUps::New
fill_form SignUserUp,
fill_form SignUpUser,
email: email,
password: password,
password_confirmation: password
Expand All @@ -20,7 +20,7 @@ class AuthenticationFlow < BaseFlow

def sign_in(password)
visit SignIns::New
fill_form SignUserIn,
fill_form SignInUser,
email: email,
password: password
click "@sign-in-button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class SignIns::Create < BrowserAction
include Auth::RedirectSignedInUsers

route do
SignUserIn.new(params).submit do |operation, authenticated_user|
SignInUser.new(params).submit do |operation, authenticated_user|
if authenticated_user
sign_in(authenticated_user)
flash.success = "You're now signed in"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ class SignIns::New < BrowserAction
include Auth::RedirectSignedInUsers

get "/sign_in" do
render NewPage, operation: SignUserIn.new
render NewPage, operation: SignInUser.new
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class SignUps::Create < BrowserAction
include Auth::RedirectSignedInUsers

route do
SignUserUp.create(params) do |operation, user|
SignUpUser.create(params) do |operation, user|
if user
flash.info = "Thanks for signing up"
sign_in(user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ class SignUps::New < BrowserAction
include Auth::RedirectSignedInUsers

get "/sign_up" do
render NewPage, operation: SignUserUp.new
render NewPage, operation: SignUpUser.new
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SignIns::NewPage < AuthLayout
needs operation : SignUserIn
needs operation : SignInUser

def content
h1 "Sign In"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SignUps::NewPage < AuthLayout
needs operation : SignUserUp
needs operation : SignUpUser

def content
h1 "Sign Up"
Expand Down

0 comments on commit 2b3e0b4

Please sign in to comment.