Bump faker from 1.8.7 to 2.0

Since version 2.0 introduced many breaking changes, we're upgrading to
it first.

The changes have been done by installing the rubocop-faker gem and
running:

```
rubocop \
  --require rubocop-faker \
  --only Faker/DeprecatedArguments \
  --auto-correct
```
This commit is contained in:
Javi Martín
2021-08-13 04:15:25 +02:00
parent 416eac284a
commit 102cf74b3d
16 changed files with 56 additions and 56 deletions

View File

@@ -29,11 +29,11 @@ describe RemoteTranslations::Microsoft::Client do
context "when characters from request are greater than characters limit" do
it "response has the expected result when the request has 2 texts, where both less than CHARACTERS_LIMIT_PER_REQUEST" do
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
text_en = Faker::Lorem.characters(11)
another_text_en = Faker::Lorem.characters(11)
text_en = Faker::Lorem.characters(number: 11)
another_text_en = Faker::Lorem.characters(number: 11)
translated_text_es = Faker::Lorem.characters(11)
another_translated_text_es = Faker::Lorem.characters(11)
translated_text_es = Faker::Lorem.characters(number: 11)
another_translated_text_es = Faker::Lorem.characters(number: 11)
response_text = create_response(translated_text_es)
response_another_text = create_response(another_translated_text_es)
@@ -51,12 +51,12 @@ describe RemoteTranslations::Microsoft::Client do
it "response has the expected result when the request has 2 texts and both are greater than CHARACTERS_LIMIT_PER_REQUEST" do
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
start_text_en = Faker::Lorem.characters(10) + " "
end_text_en = Faker::Lorem.characters(10)
start_text_en = Faker::Lorem.characters(number: 10) + " "
end_text_en = Faker::Lorem.characters(number: 10)
text_en = start_text_en + end_text_en
start_translated_text_es = Faker::Lorem.characters(10) + " "
end_translated_text_es = Faker::Lorem.characters(10)
start_translated_text_es = Faker::Lorem.characters(number: 10) + " "
end_translated_text_es = Faker::Lorem.characters(number: 10)
translated_text_es = start_translated_text_es + end_translated_text_es
response_start_text = create_response(start_translated_text_es)
response_end_text = create_response(end_translated_text_es)
@@ -70,12 +70,12 @@ describe RemoteTranslations::Microsoft::Client do
.times
.and_return(response_end_text)
start_another_text_en = Faker::Lorem.characters(12) + "."
end_another_text_en = Faker::Lorem.characters(12)
start_another_text_en = Faker::Lorem.characters(number: 12) + "."
end_another_text_en = Faker::Lorem.characters(number: 12)
another_text_en = start_another_text_en + end_another_text_en
another_start_translated_text_es = Faker::Lorem.characters(12) + "."
another_end_translated_text_es = Faker::Lorem.characters(12)
another_start_translated_text_es = Faker::Lorem.characters(number: 12) + "."
another_end_translated_text_es = Faker::Lorem.characters(number: 12)
another_translated_text_es = another_start_translated_text_es + another_end_translated_text_es
response_another_start_text = create_response(another_start_translated_text_es)
response_another_end_text = create_response(another_end_translated_text_es)
@@ -100,7 +100,7 @@ describe RemoteTranslations::Microsoft::Client do
context "text has less characters than characters limit" do
it "does not split the text" do
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
text_to_translate = Faker::Lorem.characters(10)
text_to_translate = Faker::Lorem.characters(number: 10)
result = client.fragments_for(text_to_translate)
@@ -111,8 +111,8 @@ describe RemoteTranslations::Microsoft::Client do
context "text has more characters than characters limit" do
it "to split text by first valid dot when there is a dot for split" do
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
start_text = Faker::Lorem.characters(10) + "."
end_text = Faker::Lorem.characters(10)
start_text = Faker::Lorem.characters(number: 10) + "."
end_text = Faker::Lorem.characters(number: 10)
text_to_translate = start_text + end_text
result = client.fragments_for(text_to_translate)
@@ -122,8 +122,8 @@ describe RemoteTranslations::Microsoft::Client do
it "to split text by first valid space when there is not a dot for split but there is a space" do
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
start_text = Faker::Lorem.characters(10) + " "
end_text = Faker::Lorem.characters(10)
start_text = Faker::Lorem.characters(number: 10) + " "
end_text = Faker::Lorem.characters(number: 10)
text_to_translate = start_text + end_text
result = client.fragments_for(text_to_translate)
@@ -133,10 +133,10 @@ describe RemoteTranslations::Microsoft::Client do
it "to split text in the middle of a word when there are not valid dots and spaces" do
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 40)
sub_part_text_1 = Faker::Lorem.characters(5) + " ."
sub_part_text_2 = Faker::Lorem.characters(5)
sub_part_text_3 = Faker::Lorem.characters(9)
sub_part_text_4 = Faker::Lorem.characters(30)
sub_part_text_1 = Faker::Lorem.characters(number: 5) + " ."
sub_part_text_2 = Faker::Lorem.characters(number: 5)
sub_part_text_3 = Faker::Lorem.characters(number: 9)
sub_part_text_4 = Faker::Lorem.characters(number: 30)
text_to_translate = sub_part_text_1 + sub_part_text_2 + sub_part_text_3 + sub_part_text_4
result = client.fragments_for(text_to_translate)