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:
2
Gemfile
2
Gemfile
@@ -74,7 +74,7 @@ group :development, :test do
|
|||||||
gem "byebug", "~> 11.1.3"
|
gem "byebug", "~> 11.1.3"
|
||||||
gem "database_cleaner", "~> 2.0.1"
|
gem "database_cleaner", "~> 2.0.1"
|
||||||
gem "factory_bot_rails", "~> 6.2.0"
|
gem "factory_bot_rails", "~> 6.2.0"
|
||||||
gem "faker", "~> 1.8.7"
|
gem "faker", "~> 2.0.0"
|
||||||
gem "i18n-tasks", "~> 0.9.34"
|
gem "i18n-tasks", "~> 0.9.34"
|
||||||
gem "knapsack_pro", "~> 3.0.0"
|
gem "knapsack_pro", "~> 3.0.0"
|
||||||
gem "launchy", "~> 2.5.0"
|
gem "launchy", "~> 2.5.0"
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ GEM
|
|||||||
factory_bot_rails (6.2.0)
|
factory_bot_rails (6.2.0)
|
||||||
factory_bot (~> 6.2.0)
|
factory_bot (~> 6.2.0)
|
||||||
railties (>= 5.0.0)
|
railties (>= 5.0.0)
|
||||||
faker (1.8.7)
|
faker (2.0)
|
||||||
i18n (>= 0.7)
|
i18n (>= 0.7)
|
||||||
faraday (1.7.0)
|
faraday (1.7.0)
|
||||||
faraday-em_http (~> 1.0)
|
faraday-em_http (~> 1.0)
|
||||||
@@ -733,7 +733,7 @@ DEPENDENCIES
|
|||||||
email_spec (~> 2.2.0)
|
email_spec (~> 2.2.0)
|
||||||
erb_lint (~> 0.0.37)
|
erb_lint (~> 0.0.37)
|
||||||
factory_bot_rails (~> 6.2.0)
|
factory_bot_rails (~> 6.2.0)
|
||||||
faker (~> 1.8.7)
|
faker (~> 2.0.0)
|
||||||
font-awesome-sass (~> 5.15.1)
|
font-awesome-sass (~> 5.15.1)
|
||||||
foundation-rails (~> 6.6.2.0)
|
foundation-rails (~> 6.6.2.0)
|
||||||
foundation_rails_helper (~> 4.0.0)
|
foundation_rails_helper (~> 4.0.0)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
section "Creating banners" do
|
section "Creating banners" do
|
||||||
Proposal.last(3).each do |proposal|
|
Proposal.last(3).each do |proposal|
|
||||||
title = Faker::Lorem.sentence(3)
|
title = Faker::Lorem.sentence(word_count: 3)
|
||||||
description = Faker::Lorem.sentence(12)
|
description = Faker::Lorem.sentence(word_count: 12)
|
||||||
target_url = Rails.application.routes.url_helpers.proposal_path(proposal)
|
target_url = Rails.application.routes.url_helpers.proposal_path(proposal)
|
||||||
banner = Banner.new(title: title,
|
banner = Banner.new(title: title,
|
||||||
description: description,
|
description: description,
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ section "Creating Budgets" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
section "Creating Investments" do
|
section "Creating Investments" do
|
||||||
tags = Faker::Lorem.words(10)
|
tags = Faker::Lorem.words(number: 10)
|
||||||
100.times do
|
100.times do
|
||||||
heading = Budget::Heading.all.sample
|
heading = Budget::Heading.all.sample
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ section "Winner Investments" do
|
|||||||
heading: heading,
|
heading: heading,
|
||||||
group: heading.group,
|
group: heading.group,
|
||||||
budget: heading.group.budget,
|
budget: heading.group.budget,
|
||||||
title: Faker::Lorem.sentence(3).truncate(60),
|
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
description: "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>",
|
description: "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>",
|
||||||
created_at: rand((Time.current - 1.week)..Time.current),
|
created_at: rand((Time.current - 1.week)..Time.current),
|
||||||
feasibility: "feasible",
|
feasibility: "feasible",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ end
|
|||||||
section "Creating Communities Topics" do
|
section "Creating Communities Topics" do
|
||||||
Community.find_each do |community|
|
Community.find_each do |community|
|
||||||
Topic.create(community: community, author: User.all.sample,
|
Topic.create(community: community, author: User.all.sample,
|
||||||
title: Faker::Lorem.sentence(3).truncate(60), description: Faker::Lorem.sentence)
|
title: Faker::Lorem.sentence(word_count: 3).truncate(60), description: Faker::Lorem.sentence)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
section "Creating Debates" do
|
section "Creating Debates" do
|
||||||
tags = Faker::Lorem.words(25)
|
tags = Faker::Lorem.words(number: 25)
|
||||||
30.times do
|
30.times do
|
||||||
author = User.all.sample
|
author = User.all.sample
|
||||||
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
||||||
debate = Debate.create!(author: author,
|
debate = Debate.create!(author: author,
|
||||||
title: Faker::Lorem.sentence(3).truncate(60),
|
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
created_at: rand((Time.current - 1.week)..Time.current),
|
created_at: rand((Time.current - 1.week)..Time.current),
|
||||||
description: description,
|
description: description,
|
||||||
tag_list: tags.sample(3).join(","),
|
tag_list: tags.sample(3).join(","),
|
||||||
@@ -25,7 +25,7 @@ section "Creating Debates" do
|
|||||||
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
||||||
|
|
||||||
debate = Debate.create!(author: author,
|
debate = Debate.create!(author: author,
|
||||||
title: Faker::Lorem.sentence(3).truncate(60),
|
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
created_at: rand((Time.current - 1.week)..Time.current),
|
created_at: rand((Time.current - 1.week)..Time.current),
|
||||||
description: description,
|
description: description,
|
||||||
tag_list: tags.sample(3).join(","),
|
tag_list: tags.sample(3).join(","),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
section "Creating collaborative legislation" do
|
section "Creating collaborative legislation" do
|
||||||
9.times do |i|
|
9.times do |i|
|
||||||
Legislation::Process.create!(title: Faker::Lorem.sentence(3).truncate(60),
|
Legislation::Process.create!(title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
description: Faker::Lorem.paragraphs.join("\n\n"),
|
description: Faker::Lorem.paragraphs.join("\n\n"),
|
||||||
summary: Faker::Lorem.paragraph,
|
summary: Faker::Lorem.paragraph,
|
||||||
additional_info: Faker::Lorem.paragraphs.join("\n\n"),
|
additional_info: Faker::Lorem.paragraphs.join("\n\n"),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
section "Creating legislation proposals" do
|
section "Creating legislation proposals" do
|
||||||
10.times do
|
10.times do
|
||||||
Legislation::Proposal.create!(title: Faker::Lorem.sentence(3).truncate(60),
|
Legislation::Proposal.create!(title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
description: Faker::Lorem.paragraphs.join("\n\n"),
|
description: Faker::Lorem.paragraphs.join("\n\n"),
|
||||||
summary: Faker::Lorem.paragraph,
|
summary: Faker::Lorem.paragraph,
|
||||||
author: User.all.sample,
|
author: User.all.sample,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
section "Creating comment notifications" do
|
section "Creating comment notifications" do
|
||||||
User.find_each do |user|
|
User.find_each do |user|
|
||||||
debate = Debate.create!(author: user,
|
debate = Debate.create!(author: user,
|
||||||
title: Faker::Lorem.sentence(3).truncate(60),
|
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
description: "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>",
|
description: "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>",
|
||||||
tag_list: Tag.all.sample(3).join(","),
|
tag_list: Tag.all.sample(3).join(","),
|
||||||
geozone: Geozone.sample,
|
geozone: Geozone.sample,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ end
|
|||||||
section "Creating Poll Questions & Answers" do
|
section "Creating Poll Questions & Answers" do
|
||||||
Poll.find_each do |poll|
|
Poll.find_each do |poll|
|
||||||
(1..4).to_a.sample.times do
|
(1..4).to_a.sample.times do
|
||||||
question_title = Faker::Lorem.sentence(3).truncate(60) + "?"
|
question_title = Faker::Lorem.sentence(word_count: 3).truncate(60) + "?"
|
||||||
question = Poll::Question.new(author: User.all.sample,
|
question = Poll::Question.new(author: User.all.sample,
|
||||||
title: question_title,
|
title: question_title,
|
||||||
poll: poll)
|
poll: poll)
|
||||||
@@ -58,7 +58,7 @@ section "Creating Poll Questions & Answers" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
question.save!
|
question.save!
|
||||||
Faker::Lorem.words((2..4).to_a.sample).each_with_index do |title, index|
|
Faker::Lorem.words(number: (2..4).to_a.sample).each_with_index do |title, index|
|
||||||
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
||||||
answer = Poll::Question::Answer.new(question: question,
|
answer = Poll::Question::Answer.new(question: question,
|
||||||
title: title.capitalize,
|
title: title.capitalize,
|
||||||
@@ -226,7 +226,7 @@ section "Creating Poll Questions from Proposals" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
question.save!
|
question.save!
|
||||||
Faker::Lorem.words((2..4).to_a.sample).each_with_index do |title, index|
|
Faker::Lorem.words(number: (2..4).to_a.sample).each_with_index do |title, index|
|
||||||
description = "<p>#{Faker::ChuckNorris.fact}</p>"
|
description = "<p>#{Faker::ChuckNorris.fact}</p>"
|
||||||
answer = Poll::Question::Answer.new(question: question,
|
answer = Poll::Question::Answer.new(question: question,
|
||||||
title: title.capitalize,
|
title: title.capitalize,
|
||||||
@@ -256,7 +256,7 @@ section "Creating Successful Proposals" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
question.save!
|
question.save!
|
||||||
Faker::Lorem.words((2..4).to_a.sample).each_with_index do |title, index|
|
Faker::Lorem.words(number: (2..4).to_a.sample).each_with_index do |title, index|
|
||||||
description = "<p>#{Faker::ChuckNorris.fact}</p>"
|
description = "<p>#{Faker::ChuckNorris.fact}</p>"
|
||||||
answer = Poll::Question::Answer.new(question: question,
|
answer = Poll::Question::Answer.new(question: question,
|
||||||
title: title.capitalize,
|
title: title.capitalize,
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ def add_image_to(imageable)
|
|||||||
end
|
end
|
||||||
|
|
||||||
section "Creating Proposals" do
|
section "Creating Proposals" do
|
||||||
tags = Faker::Lorem.words(25)
|
tags = Faker::Lorem.words(number: 25)
|
||||||
30.times do
|
30.times do
|
||||||
title = Faker::Lorem.sentence(3).truncate(60)
|
title = Faker::Lorem.sentence(word_count: 3).truncate(60)
|
||||||
summary = Faker::Lorem.sentence(3)
|
summary = Faker::Lorem.sentence(word_count: 3)
|
||||||
author = User.all.sample
|
author = User.all.sample
|
||||||
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
||||||
|
|
||||||
@@ -52,14 +52,14 @@ section "Creating Proposals" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
section "Creating Archived Proposals" do
|
section "Creating Archived Proposals" do
|
||||||
tags = Faker::Lorem.words(25)
|
tags = Faker::Lorem.words(number: 25)
|
||||||
5.times do
|
5.times do
|
||||||
author = User.all.sample
|
author = User.all.sample
|
||||||
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
||||||
months_to_archive_proposals = Setting["months_to_archive_proposals"]
|
months_to_archive_proposals = Setting["months_to_archive_proposals"]
|
||||||
proposal = Proposal.create!(author: author,
|
proposal = Proposal.create!(author: author,
|
||||||
title: Faker::Lorem.sentence(3).truncate(60),
|
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
summary: Faker::Lorem.sentence(3),
|
summary: Faker::Lorem.sentence(word_count: 3),
|
||||||
responsible_name: Faker::Name.name,
|
responsible_name: Faker::Name.name,
|
||||||
description: description,
|
description: description,
|
||||||
tag_list: tags.sample(3).join(","),
|
tag_list: tags.sample(3).join(","),
|
||||||
@@ -80,13 +80,13 @@ section "Creating Archived Proposals" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
section "Creating Successful Proposals" do
|
section "Creating Successful Proposals" do
|
||||||
tags = Faker::Lorem.words(25)
|
tags = Faker::Lorem.words(number: 25)
|
||||||
10.times do
|
10.times do
|
||||||
author = User.all.sample
|
author = User.all.sample
|
||||||
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
||||||
proposal = Proposal.create!(author: author,
|
proposal = Proposal.create!(author: author,
|
||||||
title: Faker::Lorem.sentence(3).truncate(60),
|
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
summary: Faker::Lorem.sentence(3),
|
summary: Faker::Lorem.sentence(word_count: 3),
|
||||||
responsible_name: Faker::Name.name,
|
responsible_name: Faker::Name.name,
|
||||||
description: description,
|
description: description,
|
||||||
created_at: rand((Time.current - 1.week)..Time.current),
|
created_at: rand((Time.current - 1.week)..Time.current),
|
||||||
@@ -111,8 +111,8 @@ section "Creating Successful Proposals" do
|
|||||||
author = User.all.sample
|
author = User.all.sample
|
||||||
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
|
||||||
proposal = Proposal.create!(author: author,
|
proposal = Proposal.create!(author: author,
|
||||||
title: Faker::Lorem.sentence(4).truncate(60),
|
title: Faker::Lorem.sentence(word_count: 4).truncate(60),
|
||||||
summary: Faker::Lorem.sentence(3),
|
summary: Faker::Lorem.sentence(word_count: 3),
|
||||||
responsible_name: Faker::Name.name,
|
responsible_name: Faker::Name.name,
|
||||||
description: description,
|
description: description,
|
||||||
created_at: rand((Time.current - 1.week)..Time.current),
|
created_at: rand((Time.current - 1.week)..Time.current),
|
||||||
|
|||||||
@@ -391,8 +391,8 @@ namespace :proposal_actions do
|
|||||||
author = User.all.sample
|
author = User.all.sample
|
||||||
description = "<p>This is an example of a successful proposal with an ideal progress.</p>"
|
description = "<p>This is an example of a successful proposal with an ideal progress.</p>"
|
||||||
proposal = Proposal.create!(author: author,
|
proposal = Proposal.create!(author: author,
|
||||||
title: Faker::Lorem.sentence(3).truncate(60),
|
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
|
||||||
summary: Faker::Lorem.sentence(3),
|
summary: Faker::Lorem.sentence(word_count: 3),
|
||||||
responsible_name: Faker::Name.name,
|
responsible_name: Faker::Name.name,
|
||||||
description: description,
|
description: description,
|
||||||
created_at: Time.current - expected_supports.length.days,
|
created_at: Time.current - expected_supports.length.days,
|
||||||
|
|||||||
@@ -227,8 +227,8 @@ FactoryBot.define do
|
|||||||
factory :budget_phase, class: "Budget::Phase" do
|
factory :budget_phase, class: "Budget::Phase" do
|
||||||
budget
|
budget
|
||||||
kind { :balloting }
|
kind { :balloting }
|
||||||
summary { Faker::Lorem.sentence(3) }
|
summary { Faker::Lorem.sentence(word_count: 3) }
|
||||||
description { Faker::Lorem.sentence(10) }
|
description { Faker::Lorem.sentence(word_count: 10) }
|
||||||
starts_at { Date.yesterday }
|
starts_at { Date.yesterday }
|
||||||
ends_at { Date.tomorrow }
|
ends_at { Date.tomorrow }
|
||||||
enabled { true }
|
enabled { true }
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ describe RemoteTranslations::Microsoft::Client do
|
|||||||
context "when characters from request are greater than characters limit" 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
|
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)
|
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
|
||||||
text_en = Faker::Lorem.characters(11)
|
text_en = Faker::Lorem.characters(number: 11)
|
||||||
another_text_en = Faker::Lorem.characters(11)
|
another_text_en = Faker::Lorem.characters(number: 11)
|
||||||
|
|
||||||
translated_text_es = Faker::Lorem.characters(11)
|
translated_text_es = Faker::Lorem.characters(number: 11)
|
||||||
another_translated_text_es = Faker::Lorem.characters(11)
|
another_translated_text_es = Faker::Lorem.characters(number: 11)
|
||||||
response_text = create_response(translated_text_es)
|
response_text = create_response(translated_text_es)
|
||||||
response_another_text = create_response(another_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
|
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)
|
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
|
||||||
start_text_en = Faker::Lorem.characters(10) + " "
|
start_text_en = Faker::Lorem.characters(number: 10) + " "
|
||||||
end_text_en = Faker::Lorem.characters(10)
|
end_text_en = Faker::Lorem.characters(number: 10)
|
||||||
text_en = start_text_en + end_text_en
|
text_en = start_text_en + end_text_en
|
||||||
|
|
||||||
start_translated_text_es = Faker::Lorem.characters(10) + " "
|
start_translated_text_es = Faker::Lorem.characters(number: 10) + " "
|
||||||
end_translated_text_es = Faker::Lorem.characters(10)
|
end_translated_text_es = Faker::Lorem.characters(number: 10)
|
||||||
translated_text_es = start_translated_text_es + end_translated_text_es
|
translated_text_es = start_translated_text_es + end_translated_text_es
|
||||||
response_start_text = create_response(start_translated_text_es)
|
response_start_text = create_response(start_translated_text_es)
|
||||||
response_end_text = create_response(end_translated_text_es)
|
response_end_text = create_response(end_translated_text_es)
|
||||||
@@ -70,12 +70,12 @@ describe RemoteTranslations::Microsoft::Client do
|
|||||||
.times
|
.times
|
||||||
.and_return(response_end_text)
|
.and_return(response_end_text)
|
||||||
|
|
||||||
start_another_text_en = Faker::Lorem.characters(12) + "."
|
start_another_text_en = Faker::Lorem.characters(number: 12) + "."
|
||||||
end_another_text_en = Faker::Lorem.characters(12)
|
end_another_text_en = Faker::Lorem.characters(number: 12)
|
||||||
another_text_en = start_another_text_en + end_another_text_en
|
another_text_en = start_another_text_en + end_another_text_en
|
||||||
|
|
||||||
another_start_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(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
|
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_start_text = create_response(another_start_translated_text_es)
|
||||||
response_another_end_text = create_response(another_end_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
|
context "text has less characters than characters limit" do
|
||||||
it "does not split the text" do
|
it "does not split the text" do
|
||||||
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
|
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)
|
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
|
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
|
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)
|
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
|
||||||
start_text = Faker::Lorem.characters(10) + "."
|
start_text = Faker::Lorem.characters(number: 10) + "."
|
||||||
end_text = Faker::Lorem.characters(10)
|
end_text = Faker::Lorem.characters(number: 10)
|
||||||
text_to_translate = start_text + end_text
|
text_to_translate = start_text + end_text
|
||||||
|
|
||||||
result = client.fragments_for(text_to_translate)
|
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
|
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)
|
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20)
|
||||||
start_text = Faker::Lorem.characters(10) + " "
|
start_text = Faker::Lorem.characters(number: 10) + " "
|
||||||
end_text = Faker::Lorem.characters(10)
|
end_text = Faker::Lorem.characters(number: 10)
|
||||||
text_to_translate = start_text + end_text
|
text_to_translate = start_text + end_text
|
||||||
|
|
||||||
result = client.fragments_for(text_to_translate)
|
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
|
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)
|
stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 40)
|
||||||
sub_part_text_1 = Faker::Lorem.characters(5) + " ."
|
sub_part_text_1 = Faker::Lorem.characters(number: 5) + " ."
|
||||||
sub_part_text_2 = Faker::Lorem.characters(5)
|
sub_part_text_2 = Faker::Lorem.characters(number: 5)
|
||||||
sub_part_text_3 = Faker::Lorem.characters(9)
|
sub_part_text_3 = Faker::Lorem.characters(number: 9)
|
||||||
sub_part_text_4 = Faker::Lorem.characters(30)
|
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
|
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)
|
result = client.fragments_for(text_to_translate)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ describe Tag do
|
|||||||
|
|
||||||
describe "name validation" do
|
describe "name validation" do
|
||||||
it "160 char name should be valid" do
|
it "160 char name should be valid" do
|
||||||
tag = build(:tag, name: Faker::Lorem.characters(160))
|
tag = build(:tag, name: Faker::Lorem.characters(number: 160))
|
||||||
expect(tag).to be_valid
|
expect(tag).to be_valid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -237,6 +237,6 @@ def commentable?(resource)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def generate_response(resource)
|
def generate_response(resource)
|
||||||
field_text = Faker::Lorem.characters(10)
|
field_text = Faker::Lorem.characters(number: 10)
|
||||||
resource.translated_attribute_names.map { field_text }
|
resource.translated_attribute_names.map { field_text }
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user