File tree Expand file tree Collapse file tree 3 files changed +11
-32
lines changed
Expand file tree Collapse file tree 3 files changed +11
-32
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ def index
55 @users = User . all
66 end
77
8+ def new
9+ @user = User . new
10+ end
11+
812 def create
913 @user = User . new ( user_params )
1014
@@ -17,10 +21,6 @@ def create
1721 end
1822 end
1923
20-
21- def new
22- @user = User . new
23- end
2424 def edit
2525 end
2626
@@ -33,6 +33,7 @@ def update
3333 end
3434 end
3535 end
36+
3637 def destroy
3738 @user . destroy!
3839
@@ -42,6 +43,7 @@ def destroy
4243 end
4344
4445 private
46+
4547 def set_user
4648 @user = User . find ( params . expect ( :id ) )
4749 end
Original file line number Diff line number Diff line change 1-
1+
22< div id ="sidebar ">
33 < div class ="sidebar-wrapper active ">
44 < div class ="sidebar-header position-relative ">
7272 <% end %>
7373 </ li >
7474
75- < < < < < < < HEAD
7675 < li class ="sidebar-item ">
77- < a href ="application-chat.html " class ="sidebar-link ">
78- =======
79- < li class ="sidebar-item ">
80- < a href ="<%= users_path %> " class ='sidebar-link '>
81- > > > > > > > add user crud action
76+ <%= link_to users_path , class : 'sidebar-link' do %>
8277 < i class ="bi bi-people "> </ i >
8378 < span > Users</ span >
84- </ a >
79+ <% end % >
8580 </ li >
8681 </ ul >
8782 </ div >
Original file line number Diff line number Diff line change 11require "rails_helper"
22
3- # This spec was generated by rspec-rails when you ran the scaffold generator.
4- # It demonstrates how one might use RSpec to test the controller code that
5- # was generated by Rails when you ran the scaffold generator.
6- #
7- # It assumes that the implementation code is generated by the rails scaffold
8- # generator. If you are using any extension libraries to generate different
9- # controller code, this generated spec may or may not pass.
10- #
11- # It only uses APIs available in rails and/or rspec-rails. There are a number
12- # of tools you can use to make these specs even more expressive, but we're
13- # sticking to rails and rspec-rails APIs to keep things simple and stable.
14-
153RSpec . describe "/users" , type : :request do
164 let ( :user ) { create ( :user ) }
17-
5+ let ( :valid_attributes ) { { email : "john@doe.com" , password : "123" } }
6+ let ( :invalid_attributes ) { { email : "" } }
187
198 before do
209 sign_in ( user )
2110 end
2211
23- # This should return the minimal set of attributes required to create a valid
24- # User. As you add validations to User, be sure to
25- # adjust the attributes here as well.
26- let ( :valid_attributes ) { { email : "john@doe.com" , password : "123" } }
27-
28- let ( :invalid_attributes ) { { email : "" } }
29-
3012 describe "GET /index" do
3113 it "renders a successful response" do
3214 user = FactoryBot . create ( :user )
You can’t perform that action at this time.
0 commit comments