Skip to content

Commit

Permalink
Bump rubocop minitest 0.23.0 (#2610)
Browse files Browse the repository at this point in the history
* Bump rubocop-minitest to 0.23.0

* Fix Rubocop offenses
  • Loading branch information
Stefanni Brasil authored Nov 1, 2022
1 parent df19a21 commit adda481
Show file tree
Hide file tree
Showing 60 changed files with 302 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
rubocop-minitest (0.22.2)
rubocop-minitest (0.23.0)
rubocop (>= 0.90, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
Expand Down Expand Up @@ -67,7 +67,7 @@ DEPENDENCIES
pry (= 0.14.1)
rake (= 13.0.6)
rubocop (= 1.37.1)
rubocop-minitest (= 0.22.2)
rubocop-minitest (= 0.23.0)
rubocop-rake (= 0.6.0)
simplecov (= 0.21)
test-unit (= 3.5.5)
Expand Down
2 changes: 1 addition & 1 deletion faker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency('pry', '0.14.1')
spec.add_development_dependency('rake', '13.0.6')
spec.add_development_dependency('rubocop', '1.37.1')
spec.add_development_dependency('rubocop-minitest', '0.22.2')
spec.add_development_dependency('rubocop-minitest', '0.23.0')
spec.add_development_dependency('rubocop-rake', '0.6.0')
spec.add_development_dependency('simplecov', '0.21')
spec.add_development_dependency('test-unit', '3.5.5')
Expand Down
1 change: 1 addition & 0 deletions test/faker/blockchain/test_bitcoin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def test_deterministic_address
Faker::Config.random = Random.new(42)
v = Faker::Blockchain::Bitcoin.address
Faker::Config.random = Random.new(42)

assert_equal v, Faker::Blockchain::Bitcoin.address
end

Expand Down
1 change: 1 addition & 0 deletions test/faker/blockchain/test_tezos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_deterministic_contract
Faker::Config.random = Random.new(42)
v = Faker::Blockchain::Tezos.contract
Faker::Config.random = Random.new(42)

assert_equal v, Faker::Blockchain::Tezos.contract
end
end
3 changes: 3 additions & 0 deletions test/faker/books/test_lovecraft.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def test_words_with_large_count_params
def test_sentence_with_open_compounds_allowed
1000.times do
sentence = @tester.sentence(word_count: 5, random_words_to_add: 0, open_compounds_allowed: true)

assert(sentence.split.length >= 5)
end
end
Expand All @@ -77,12 +78,14 @@ def test_sentence_with_open_compounds_allowed
def test_sentence_without_open_compounds_allowed
1000.times do
sentence = @tester.sentence(word_count: 5, random_words_to_add: 0, open_compounds_allowed: false)

assert_equal(5, sentence.split.length)
end
end

def test_paragraph_char_count
paragraph = @tester.paragraph_by_chars

assert_equal(256, paragraph.length)
end

Expand Down
4 changes: 4 additions & 0 deletions test/faker/creature/test_faker_bird.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def test_common_names
def test_common_names_with_specific_order
specific_order = @tester.order
name = @tester.common_name specific_order

assert_includes @common_order_map[specific_order.to_sym].map(&:downcase), name
end

Expand All @@ -65,6 +66,7 @@ def test_order_with_common_names
def test_specific_order_with_common_names
specific_order = @tester.order
entry = @tester.order_with_common_name specific_order

assert_includes(@common_order_map[specific_order.to_sym], entry[:common_name])
end

Expand All @@ -76,6 +78,7 @@ def test_plausible_common_names
/[A-Z][a-z]+-[a-z]+ed [a-z]+/
]
name = @tester.plausible_common_name

assert_predicate patterns.collect { |pattern| pattern.match? name }, :any?,
"Faker::Creature::Bird#plausible_common_name failed on '#{name}'"
end
Expand All @@ -87,6 +90,7 @@ def test_implausable_common_names
/[A-Z][a-z]+-[a-z]+ed [a-z]+ [a-z]+/
]
name = @tester.implausible_common_name

assert_predicate patterns.collect { |pattern| pattern.match? name }, :any?,
"Faker::Creature::Bird#implausible_common_name failed on '#{name}'"
end
Expand Down
2 changes: 2 additions & 0 deletions test/faker/default/test_alphanum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ def test_alphanumeric_with_min_alpha
letters = @tester.alphanumeric(number: 5, min_alpha: 2).chars.map do |char|
char =~ /[[:alpha:]]/
end

assert letters.compact.size >= 2
end

def test_alphanumeric_with_min_numeric
numbers = @tester.alphanumeric(number: 5, min_numeric: 4).chars.map do |char|
char =~ /[[:digit:]]/
end

assert numbers.compact.size >= 4
end
end
7 changes: 7 additions & 0 deletions test/faker/default/test_array_sample_method_compat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,32 @@ def test_returns_nil_or_empty_array_with_empty_source
source = []

result = source.sample

assert_nil result

result = source.sample(1)

assert_empty(result)
end

def test_returns_one_array_elem_without_param
source = %w[foo bar]
result = source.sample

assert_includes source, result
end

def test_returns_empty_array_with_param_zero
source = %w[foo bar]
result = source.sample(0)

assert_empty(result)
end

def test_returns_an_array_with_integer_param
source = %w[foo bar baz]
result = source.sample(2)

assert result.is_a? Array
assert_equal(2, result.length)
assert_empty((result - source))
Expand All @@ -40,10 +45,12 @@ def test_returns_an_array_with_integer_param
def test_returns_source_array_with_integer_param_equal_or_bigger_than_source_length
source = %w[foo bar]
result = source.sample(2)

assert result.is_a? Array
assert_predicate((source.sort <=> result.sort), :zero?)

result = source.sample(3)

assert result.is_a? Array
assert_predicate((source.sort <=> result.sort), :zero?)
end
Expand Down
5 changes: 5 additions & 0 deletions test/faker/default/test_faker_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def test_name
def test_basic_semantic_version
10.times do |_digits|
test_sem_vers = @tester.semantic_version.split('.')

assert_match(/[0-9]{1}/, test_sem_vers[0])
assert_match(/[0-9]{1}/, test_sem_vers[1])
assert_match(/[1-9]{1}/, test_sem_vers[2])
Expand All @@ -23,6 +24,7 @@ def test_basic_semantic_version
def test_major_semantic_version
10.times do |_digits|
test_sem_vers = @tester.semantic_version(major: (1000..9999)).split('.')

assert_match(/[0-9]{4}/, test_sem_vers[0])
assert_match(/[0-9]{1}/, test_sem_vers[1])
assert_match(/[1-9]{1}/, test_sem_vers[2])
Expand All @@ -32,6 +34,7 @@ def test_major_semantic_version
def test_minor_semantic_version
10.times do |_digits|
test_sem_vers = @tester.semantic_version(minor: (1000..9999)).split('.')

assert_match(/[0-9]{1}/, test_sem_vers[0])
assert_match(/[0-9]{4}/, test_sem_vers[1])
assert_match(/[1-9]{1}/, test_sem_vers[2])
Expand All @@ -41,6 +44,7 @@ def test_minor_semantic_version
def test_patch_semantic_version
10.times do |_digits|
test_sem_vers = @tester.semantic_version(patch: (1000..9999)).split('.')

assert_match(/[0-9]{1}/, test_sem_vers[0])
assert_match(/[0-9]{1}/, test_sem_vers[1])
assert_match(/[0-9]{4}/, test_sem_vers[2])
Expand All @@ -50,6 +54,7 @@ def test_patch_semantic_version
def test_all_semantic_version
10.times do |_digits|
test_sem_vers = @tester.semantic_version(major: (1000..9999), minor: (1000..9999), patch: (1000..9999)).split('.')

assert_match(/[0-9]{4}/, test_sem_vers[0])
assert_match(/[0-9]{4}/, test_sem_vers[1])
assert_match(/[0-9]{4}/, test_sem_vers[2])
Expand Down
Loading

0 comments on commit adda481

Please sign in to comment.