generated from dxw/rails-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split User index view into active and inactive
We have a potentially large number of users to display at /users. This commit refactors the /users page into a tabbed view at /users/active and /users/inactive which both reduces page load and affords an end user the ability to see a filtered view with either active or inactive users. By default we display active users by redirecting to /users/active.
- Loading branch information
1 parent
4456bc3
commit 242b43f
Showing
12 changed files
with
102 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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,31 @@ | ||
RSpec.describe UsersController do | ||
let(:beis_user) { create(:beis_user) } | ||
|
||
before do | ||
allow(subject).to receive(:current_user).and_return(beis_user) | ||
end | ||
|
||
describe "#index" do | ||
it "accepts a parameter of `active` and renders" do | ||
get :index, params: {user_state: "active"} | ||
|
||
expect(response).to have_http_status(200) | ||
expect(response).to render_template(:index) | ||
end | ||
|
||
it "accepts a parameter of `inactive` and renders" do | ||
get :index, params: {user_state: "inactive"} | ||
|
||
expect(response).to have_http_status(200) | ||
expect(response).to render_template(:index) | ||
end | ||
end | ||
|
||
describe "#show" do | ||
it "renders a show template" do | ||
get :show, params: {id: beis_user.id} | ||
|
||
expect(response).to render_template(:show) | ||
end | ||
end | ||
end |
This file contains 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 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 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 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,16 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "Users", type: :request do | ||
let(:beis_user) { create(:beis_user) } | ||
|
||
before do | ||
login_as(beis_user) | ||
end | ||
|
||
it "redirects /users with no parameter to /users/active" do | ||
expect(get("/users")).to redirect_to("/users/active") | ||
expect(response).to have_http_status(301) | ||
end | ||
|
||
after { logout } | ||
end |