From e33931c47c33efd657e81cb4db7d8729cdc80bfd Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Mon, 9 Mar 2020 11:12:55 +0100 Subject: [PATCH 1/2] Fix paper factory definition --- spec/factories/papers.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/factories/papers.rb b/spec/factories/papers.rb index ba5dc20..2a4a354 100644 --- a/spec/factories/papers.rb +++ b/spec/factories/papers.rb @@ -5,12 +5,12 @@ FactoryBot.define do name { Faker::Lorem.sentence } sequence(:url) { |n| Faker::Internet.url("ris.example.org", "/paper-#{n}.html") } sequence(:reference) { |n| FactoryHelper.reference(n) } - body "leipzig" - published_at "2015-07-20 21:16:53" - scraped_at "2015-07-20 21:16:53" + body { "leipzig" } + published_at { "2015-07-20 21:16:53" } + scraped_at { "2015-07-20 21:16:53" } paper_type { FactoryHelper.paper_type } originator { Faker::Name.name } resolution { Faker::Lorem.paragraph(3) } - content "-------------------------------\n\n " # oh well... + content { "-------------------------------\n\n " } end end From 75f6467237a93af8b6b0464dd7aee0988d9a42aa Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Mon, 9 Mar 2020 11:14:42 +0100 Subject: [PATCH 2/2] Fix deprecated Faker usage in paper factory --- Gemfile | 1 + Gemfile.lock | 20 ++++++++++++++++++++ spec/factories/papers.rb | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 809ac63..29be893 100644 --- a/Gemfile +++ b/Gemfile @@ -65,6 +65,7 @@ group :test do gem "factory_bot_rails" gem 'shoulda-matchers', '~> 3.1' gem 'faker' + gem 'rubocop-faker' gem 'simplecov', require: false gem 'database_cleaner' gem 'coveralls', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 0bdcddf..8027dda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,6 +44,7 @@ GEM capybara (~> 3.13, < 4) websocket-driver (>= 0.6.5) arel (8.0.0) + ast (2.4.0) awesome_print (1.8.0) builder (3.2.4) capybara (3.31.0) @@ -107,6 +108,7 @@ GEM hashie (3.6.0) i18n (1.8.2) concurrent-ruby (~> 1.0) + jaro_winkler (1.5.4) jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -155,6 +157,9 @@ GEM faraday multi_json omniauth (~> 1.0) + parallel (1.19.1) + parser (2.7.0.4) + ast (~> 2.4.0) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) @@ -196,11 +201,13 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) + rainbow (3.0.0) rake (13.0.1) rdoc (4.3.0) regexp_parser (1.7.0) rest-client (1.6.7) mime-types (>= 1.16) + rexml (3.2.4) rspec-core (3.9.1) rspec-support (~> 3.9.1) rspec-expectations (3.9.0) @@ -218,6 +225,17 @@ GEM rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) rspec-support (3.9.2) + rubocop (0.80.1) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.7.0.1) + rainbow (>= 2.2.2, < 4.0) + rexml + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 1.7) + rubocop-faker (0.2.0) + rubocop (>= 0.74) + ruby-progressbar (1.10.1) sass (3.4.25) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -270,6 +288,7 @@ GEM thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) + unicode-display_width (1.6.1) validate_url (1.0.8) activemodel (>= 3.0.0) public_suffix @@ -310,6 +329,7 @@ DEPENDENCIES rails-controller-testing rails-i18n rspec-rails (~> 3.0) + rubocop-faker sass-rails sdoc (~> 0.4.0) shoulda-matchers (~> 3.1) diff --git a/spec/factories/papers.rb b/spec/factories/papers.rb index 2a4a354..85f0c98 100644 --- a/spec/factories/papers.rb +++ b/spec/factories/papers.rb @@ -3,14 +3,14 @@ require_relative '../factory_helper' FactoryBot.define do factory :paper do name { Faker::Lorem.sentence } - sequence(:url) { |n| Faker::Internet.url("ris.example.org", "/paper-#{n}.html") } + sequence(:url) { |n| Faker::Internet.url(host: "ris.example.org", path: "/paper-#{n}.html") } sequence(:reference) { |n| FactoryHelper.reference(n) } body { "leipzig" } published_at { "2015-07-20 21:16:53" } scraped_at { "2015-07-20 21:16:53" } paper_type { FactoryHelper.paper_type } originator { Faker::Name.name } - resolution { Faker::Lorem.paragraph(3) } + resolution { Faker::Lorem.paragraph(sentence_count: 3) } content { "-------------------------------\n\n " } end end