Skip to content

Commit fa5ad50

Browse files
committed
fix rubocop errors
1 parent 273caeb commit fa5ad50

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class V1::AdminController < ApplicationController
2-
before_action :admin?
2+
before_action :admin?
33

4-
def index
5-
@measure = current_user.measures
6-
json_response(@measure)
7-
end
4+
def index
5+
@measure = current_user.measures
6+
json_response(@measure)
7+
end
88
end

app/models/measure.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
class Measure < ApplicationRecord
22
belongs_to :user
33

4-
before_save { self.body_part_name = body_part_name ? body_part_name.split(' ').map(&:capitalize).join(' ') : body_part_name}
4+
before_save { self.body_part_name = body_part_name ? body_part_name.split(' ').map(&:capitalize).join(' ') : body_part_name }
55

66
has_one :body_part, dependent: :destroy
77
has_many :measurements, dependent: :destroy
88

99
validates_presence_of(:body_part_name)
1010

11-
12-
validates :body_part_name, uniqueness: true
13-
11+
validates :body_part_name, uniqueness: true
1412
end

app/models/user.rb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
class User < ApplicationRecord
22
has_secure_password
3-
before_save { self.email = email.downcase}
3+
before_save { self.email = email.downcase }
44

5-
validates_length_of :password, minimum: 6
5+
validates_length_of :password, minimum: 6
66

77
has_many :measures, dependent: :destroy
88

99
validates_presence_of(:name, :email, :password_digest)
1010

11-
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i.freeze
11+
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i.freeze
1212

1313
validates_length_of :email, maximum: 255
14-
validates :email, uniqueness: { scope: :id }, format: { with: VALID_EMAIL_REGEX}
15-
16-
17-
18-
end
14+
validates :email, uniqueness: { scope: :id }, format: { with: VALID_EMAIL_REGEX }
15+
end

spec/models/user_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
end
2020

2121
it { should validate_length_of(:password).is_at_least(6) }
22-
2322
end

spec/requests/v1/admin_request_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'rails_helper'
22

3-
RSpec.describe "V1::Admins", type: :request do
4-
# initialize test data
3+
RSpec.describe 'V1::Admins', type: :request do
4+
# initialize test data
55
let(:user) { create(:user) }
66
let(:admin) { create(:user, admin: true) }
77
let!(:measures) { create_list(:measure, 10, user_id: admin.id) }

0 commit comments

Comments
 (0)