Skip to content

Commit

Permalink
fixed eslint and rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
girijaasoni committed Jan 24, 2023
1 parent f4cfa98 commit 639b786
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
3 changes: 2 additions & 1 deletion 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,6 +58,7 @@ def destroy
end

private

# Use callbacks to share common setup or constraints between actions.
def set_user
@user = User.find(params[:id])
Expand Down
4 changes: 1 addition & 3 deletions app/javascript/pages/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '@patternfly/react-core/dist/styles/base.css';
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
import previewImage from '../../assets/images/img1.png';
import colors from '../utils/colors.js';
import { Gallery, GalleryItem, Text, Button } from '@patternfly/react-core';
import { Gallery, GalleryItem, Text } from '@patternfly/react-core';
import ArticleForm from '../components/ArticleForm.js';
import PfButton from '../components/pfButton.js';

Expand All @@ -33,8 +33,6 @@ 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: 5 additions & 0 deletions test/controllers/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ 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 @@ -25,16 +27,19 @@ 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: 1 addition & 0 deletions test/system/users_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class UsersTest < ApplicationSystemTestCase

test "visiting the index" do
visit users_url

assert_selector "h1", text: "Users"
end

Expand Down

0 comments on commit 639b786

Please sign in to comment.