Skip to content

Commit

Permalink
robocop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobkagon committed Jan 8, 2025
1 parent c0b3bcb commit 351111f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
9 changes: 4 additions & 5 deletions app/models/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ class Email
validates_inclusion_of :kind, in: KINDS, message: "%{value} is not a valid email type"

validates :address,
format: {
:with => /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i,

:message => "should be a valid email address"
}
format: {
:with => /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i,
:message => "should be a valid email address"
}

validates :address,
presence: true
Expand Down
18 changes: 9 additions & 9 deletions spec/models/email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
end
end

context "valid address" do
let(:email) {"[email protected]"}
let(:params){valid_params.deep_merge!(address: email)}

it "is valid" do
Email.create(params)
person.reload
expect(person.emails.where(address: email).first.valid?).to be_truthy
end
context "valid address" do
let(:email) {"[email protected]"}
let(:params){valid_params.deep_merge!(address: email)}

it "is valid" do
Email.create(params)
person.reload
expect(person.emails.where(address: email).first.valid?).to be_truthy
end
end

valid_types = Email::KINDS
valid_types.each do |type|
Expand Down

0 comments on commit 351111f

Please sign in to comment.