Skip to content

Commit

Permalink
created basic few users and fetched them in the dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
girijaasoni committed Jan 30, 2023
1 parent a01bcd7 commit 6c05375
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
3 changes: 1 addition & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class UsersController < ApplicationController
before_action :set_user, only: %i[show edit update destroy]
before_action :set_user, only: %i[ show edit update destroy ]

# GET /users or /users.json
def index
Expand Down Expand Up @@ -58,7 +58,6 @@ def destroy
end

private

# Use callbacks to share common setup or constraints between actions.
def set_user
@user = User.find(params[:id])
Expand Down
1 change: 1 addition & 0 deletions app/javascript/components/articleCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const ArticleCard = ({ id, title, body, thumbnail, onShowClick, creator }) => (
<CardBody>
<Text style={styles.body}>{body}</Text>
</CardBody>

<CardFooter>
<Text style={styles.creatorTxt}>by {creator}</Text>
<PfButton
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/pages/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const Home = () => {
axios
.get('/articles')
.then((response) => {
console.log('here');
console.log(response.data);
setArticles(response.data);
})
.catch((response) => console.log(response));
Expand Down
16 changes: 8 additions & 8 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
User.destroy_all

User.create!([{
username: "user#1"
},
{
username: "user#2"
},
{
username: "user#3"
}])
username: "user#1"
},
{
username: "user#2"
},
{
username: "user#3"
}])

Rails.logger.debug { "Created #{User.count} Users." }
5 changes: 0 additions & 5 deletions test/controllers/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ class UsersControllerTest < ActionDispatch::IntegrationTest

test "should get index" do
get users_url

assert_response :success
end

test "should get new" do
get new_user_url

assert_response :success
end

Expand All @@ -27,19 +25,16 @@ class UsersControllerTest < ActionDispatch::IntegrationTest

test "should show user" do
get user_url(@user)

assert_response :success
end

test "should get edit" do
get edit_user_url(@user)

assert_response :success
end

test "should update user" do
patch user_url(@user), params: { user: { username: @user.username } }

assert_redirected_to user_url(@user)
end

Expand Down
1 change: 0 additions & 1 deletion test/system/users_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class UsersTest < ApplicationSystemTestCase

test "visiting the index" do
visit users_url

assert_selector "h1", text: "Users"
end

Expand Down

0 comments on commit 6c05375

Please sign in to comment.