Fix offense constant definition in block in validators/integer_array_validator_spec.rb

This commit is contained in:
Ana Nunes da Silva
2024-03-26 11:08:53 +00:00
parent 0aea14832a
commit 061ff91786
2 changed files with 8 additions and 16 deletions

View File

@@ -6,13 +6,6 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 16
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/validators/integer_array_validator_spec.rb'
# Offense count: 2
Lint/DuplicateMethods:
Exclude:

View File

@@ -3,14 +3,6 @@
require "spec_helper"
describe IntegerArrayValidator do
class TestModel
include ActiveModel::Validations
attr_accessor :ids
validates :ids, integer_array: true
end
describe "internationalization" do
it "has translation for NOT_ARRAY_ERROR" do
expect(described_class.not_array_error).not_to be_blank
@@ -22,7 +14,14 @@ describe IntegerArrayValidator do
end
describe "validation" do
let(:instance) { TestModel.new }
let(:instance) do
Class.new do
include ActiveModel::Validations
attr_accessor :ids
validates :ids, integer_array: true
end.new
end
it "does not add error when nil" do
instance.ids = nil