-
Notifications
You must be signed in to change notification settings - Fork 0
[#6] [UI] As a user, I can login, [#7] [UI] As a user, I can logout #32
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
Open
ghost
wants to merge
31
commits into
develop
Choose a base branch
from
feature/ui-log-in-log-out
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
457bdbc
Merge pull request #29 from mosharaf13/release/0.1.0
mosharaf13 52bca0b
Merge branch 'backend/user-registration' into feature/ui-log-in
8b04924
Adjust styles
1fde2ae
Update link
d238321
Adjust styles
e947521
Add tests
4eca8d1
Update helper
da5e74c
Change CI to true
d2df8a0
Add classes
1abbda9
Update helper
193159f
Update tests
b207451
Update tests
739839f
Remove tests
127baf0
Merge branch 'backend/user-registration' into feature/ui-log-in-log-out
f26988e
Remove controller part
de01aa5
Adjust function name
38d7120
Ignore `.env`
8928800
Change double quotes to single quote
209c140
Extract header
36570e8
Extract flashes
9c7f0a2
Add port 80
f7746c4
Add tests
10f901c
Include for system type
4742156
Rename function
0e53c67
Add custom log in page
79af39f
Fix sign_in method does not exist
sanG-github d2abab7
Fix sign in tests
sanG-github 98e9bf0
Fix linting
52e8254
Copy `.env.example` to `.env`
a69191f
Merge branch 'develop' into feature/ui-log-in-log-out
b995dba
Enable `RAILS_SERVE_STATIC_FILES`
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| DOCKER_REGISTRY_HOST=docker.io | ||
| DOCKER_IMAGE=mosharaf13/google_scrapper_ruby | ||
| BRANCH_TAG=latest | ||
| PORT=80 | ||
| CI=true | ||
| TEST_RETRY=0 | ||
| RAILS_SERVE_STATIC_FILES=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| <div class="container"> | ||
| <h2 class="text-center">Log in</h2> | ||
|
|
||
| <div class="row justify-content-center"> | ||
| <div class="col-lg-4"> | ||
| <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> | ||
| <div class="field form-group"> | ||
| <%= f.label :email %><br /> | ||
| <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> | ||
| </div> | ||
|
|
||
| <div class="field form-group mt-3"> | ||
| <%= f.label :password %><br /> | ||
| <%= f.password_field :password, autocomplete: 'current-password', class: 'form-control' %> | ||
| </div> | ||
|
|
||
| <% if devise_mapping.rememberable? %> | ||
| <div class="field form-group mt-3"> | ||
| <%= f.check_box :remember_me, class: 'form-check-input' %> | ||
| <%= f.label :remember_me, class: 'form-check-label' %> | ||
| </div> | ||
| <% end %> | ||
|
|
||
| <div class="actions text-center mt-3"> | ||
| <div class="d-flex justify-content-center"> | ||
| <%= f.submit 'Log in', class: 'btn btn-primary m-1' %> | ||
| </div> | ||
| <%= render 'devise/shared/links' %> | ||
| </div> | ||
| <% end %> | ||
| </div> | ||
| </div> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,3 @@ | ||
| <% if user_signed_in? %> | ||
| <div> Welcome <%= current_user.email %> </div> | ||
| <%= button_to 'Sign out', destroy_user_session_path, method: :delete %> | ||
| <% else %> | ||
| <%= button_to 'Sign in', new_user_session_path %> | ||
| <% end %> | ||
| <h1> | ||
| Welcome to the world of scrapping!! | ||
| </h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <% if notice %> | ||
| <p class="notice alert alert-info"><%= notice %></p> | ||
| <% end %> | ||
|
|
||
| <% if alert %> | ||
| <p class="alert alert-danger"><%= alert %></p> | ||
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <header class="p-3 text-bg-dark"> | ||
| <div class="container"> | ||
| <div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start"> | ||
| <%= link_to 'Google Scrapper', root_url, class: 'navbar-brand col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0' %> | ||
|
|
||
| <% if user_signed_in? %> | ||
| <div class="me-3"> Welcome <%= current_user.email %> </div> | ||
| <%= button_to 'Sign out', destroy_user_session_path, method: :delete, class: 'btn btn-outline-light sign-out-button' %> | ||
| <% else %> | ||
| <%= button_to 'Sign in', new_user_session_path, method: :get, class: 'btn btn-outline-light sign-in-button' %> | ||
| <% end %> | ||
| </div> | ||
| </div> | ||
| </header> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| RSpec.configure do |config| | ||
| config.include Devise::Test::ControllerHelpers, type: :view | ||
| config.include Devise::Test::ControllerHelpers, type: :helper | ||
| config.include Devise::Test::IntegrationHelpers, type: :feature | ||
| config.include Devise::Test::IntegrationHelpers, type: :request | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| def login_as_user(user = Fabricate(:user)) | ||
| login_as user | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'rails_helper' | ||
|
|
||
| describe 'Sign in page', type: :system do | ||
| let(:selectors) do | ||
| { | ||
| auth_form: '.new_user', | ||
| email_field: 'user[email]', | ||
| password_field: 'user[password]' | ||
| } | ||
| end | ||
|
|
||
| context 'given the Sign in button is clicked' do | ||
| context 'given the credentials are valid' do | ||
| it 'displays the home page' do | ||
| visit new_user_session_path | ||
| user = Fabricate.build(:user) | ||
| submit_authentication_form(user.email, user.password) | ||
|
|
||
| expect(page).to have_current_path(root_path) | ||
| end | ||
| end | ||
|
|
||
| context 'given the credentials are invalid' do | ||
| it 'displays the Sign in page' do | ||
| visit new_user_session_path | ||
| user = Fabricate.build(:user, password: 'password') | ||
|
|
||
| submit_authentication_form(user.email, 'invalid') | ||
|
|
||
| expect(page).to have_current_path(root_path) | ||
| end | ||
|
|
||
| it 'shows the error message' do | ||
| visit new_user_session_path | ||
| user = Fabricate.build(:user, password: 'password') | ||
|
|
||
| submit_authentication_form(user.email, 'invalid') | ||
|
|
||
| expect(page).to have_text 'Invalid Email or password.' | ||
| end | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def submit_authentication_form(email, password) | ||
| within selectors[:auth_form] do | ||
| fill_in selectors[:email_field], with: email | ||
| fill_in selectors[:password_field], with: password | ||
| click_button 'Log in' | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'rails_helper' | ||
|
|
||
| describe 'Sign out', type: :system do | ||
| let(:selectors) do | ||
| { | ||
| sign_out_button: '.sign-out-button' | ||
| } | ||
| end | ||
|
|
||
| it 'redirects to the root page' do | ||
| login_as_user | ||
| visit root_path | ||
|
|
||
| click_link selectors[:sign_out_button] | ||
|
|
||
| expect(page).to have_current_path(root_path) | ||
| end | ||
| end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.