Skip to content

Commit 24b68d8

Browse files
authored
Various bug fixes (#53)
2 parents 20f7be1 + bee8c84 commit 24b68d8

File tree

8 files changed

+30
-74
lines changed

8 files changed

+30
-74
lines changed

app/controllers/concerns/authentication.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def request_authentication
3535
end
3636

3737
def after_authentication_url
38-
session.delete(:return_to_after_authenticating) || root_url
38+
session.delete(:return_to_after_authenticating) || regions_url
3939
end
4040

4141
def start_new_session_for(user)

app/controllers/registrations_controller.rb

Lines changed: 0 additions & 23 deletions
This file was deleted.

app/views/layouts/_sidebar.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
<li class="sidebar-item">
4848
<%= link_to regions_path, class: "sidebar-link" do %>
49-
<i class="bi bi-hospital-fill"></i>
49+
<i class="bi bi-globe"></i>
5050
<span>Regions</span>
5151
<% end %>
5252
</li>

app/views/registrations/new.html.erb

Lines changed: 0 additions & 35 deletions
This file was deleted.

app/views/users/index.html.erb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
<h1>User list </h1>
2-
31
<div class="page-heading">
42
<section class="section">
53
<div class="card">
6-
<div class="card-body">
7-
<%= link_to new_region_path, class: "btn btn-primary m-2" do %>
4+
<div class="card-header d-flex justify-content-between align-items-center">
5+
<h2>User List</h2>
6+
<%= link_to new_user_path, class: "btn btn-primary m-2" do %>
87
<i class="bi bi-plus"></i> Add New User
98
<% end %>
9+
</div>
10+
<div class="card-body">
1011
<table class="table table-striped" id="table1">
1112
<thead>
1213
<tr>

spec/requests/users_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
get users_url
1616
expect(response).to be_successful
1717
end
18+
19+
it "has a link to add a new user" do
20+
get users_url
21+
expect(page).to have_link("Add New User", href: new_user_path)
22+
end
1823
end
1924

2025
describe "GET /new" do

spec/support/capybara.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
Capybara::Selenium::Driver.new(app, browser: :chrome)
77
end
88

9+
module CapybaraPage
10+
def page
11+
Capybara.string(response.body)
12+
end
13+
end
14+
915
RSpec.configure do |config|
1016
config.before(:each, type: :system) do
1117
driven_by :rack_test
@@ -14,4 +20,6 @@
1420
config.before(:each, :debug, type: :system) do
1521
driven_by :selenium_chrome
1622
end
23+
24+
config.include CapybaraPage, type: :request
1725
end

spec/system/login_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
require "rails_helper"
22

33
RSpec.describe "User Login", type: :system do
4+
# will probably need to be amended once we have a page for non-Admin users
45
let!(:user) { create(:user) }
56

6-
# context "with correct email and password" do
7-
# it "logs in the user" do
8-
# visit new_session_path
9-
# fill_in "email", with: user.email
10-
# fill_in "password", with: user.password
11-
# click_button("Sign in")
7+
context "with correct email and password" do
8+
it "logs in the user" do
9+
visit new_session_path
10+
fill_in "email", with: user.email
11+
fill_in "password", with: user.password
12+
click_button("Sign in")
1213

13-
# # will probably need to be amended once we have a page for non-Admin users
14-
# expect(page).to have_text("Administration")
15-
# end
16-
# end
14+
expect(page).to have_text("Regions Served")
15+
end
16+
end
1717

1818
context "with incorrect email or password" do
1919
it "shows error message" do

0 commit comments

Comments
 (0)