Merge pull request #45 from CodeforLeipzig/fix-factorybot-definitions

Fix factorybot definitions
This commit is contained in:
Joerg Reichert 2020-03-11 19:46:40 +01:00 committed by GitHub
commit 08b6f174b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 6 deletions

View file

@ -65,6 +65,7 @@ group :test do
gem "factory_bot_rails" gem "factory_bot_rails"
gem 'shoulda-matchers', '~> 3.1' gem 'shoulda-matchers', '~> 3.1'
gem 'faker' gem 'faker'
gem 'rubocop-faker'
gem 'simplecov', require: false gem 'simplecov', require: false
gem 'database_cleaner' gem 'database_cleaner'
gem 'coveralls', require: false gem 'coveralls', require: false

View file

@ -44,6 +44,7 @@ GEM
capybara (~> 3.13, < 4) capybara (~> 3.13, < 4)
websocket-driver (>= 0.6.5) websocket-driver (>= 0.6.5)
arel (8.0.0) arel (8.0.0)
ast (2.4.0)
awesome_print (1.8.0) awesome_print (1.8.0)
builder (3.2.4) builder (3.2.4)
capybara (3.31.0) capybara (3.31.0)
@ -107,6 +108,7 @@ GEM
hashie (3.6.0) hashie (3.6.0)
i18n (1.8.2) i18n (1.8.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jaro_winkler (1.5.4)
jquery-rails (4.3.5) jquery-rails (4.3.5)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
@ -155,6 +157,9 @@ GEM
faraday faraday
multi_json multi_json
omniauth (~> 1.0) omniauth (~> 1.0)
parallel (1.19.1)
parser (2.7.0.4)
ast (~> 2.4.0)
pry (0.12.2) pry (0.12.2)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.9.0) method_source (~> 0.9.0)
@ -196,11 +201,13 @@ GEM
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
rake (13.0.1) rake (13.0.1)
rdoc (4.3.0) rdoc (4.3.0)
regexp_parser (1.7.0) regexp_parser (1.7.0)
rest-client (1.6.7) rest-client (1.6.7)
mime-types (>= 1.16) mime-types (>= 1.16)
rexml (3.2.4)
rspec-core (3.9.1) rspec-core (3.9.1)
rspec-support (~> 3.9.1) rspec-support (~> 3.9.1)
rspec-expectations (3.9.0) rspec-expectations (3.9.0)
@ -218,6 +225,17 @@ GEM
rspec-mocks (~> 3.9.0) rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0) rspec-support (~> 3.9.0)
rspec-support (3.9.2) 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 (3.4.25)
sass-rails (6.0.0) sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1) sassc-rails (~> 2.1, >= 2.1.1)
@ -270,6 +288,7 @@ GEM
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.2.0) uglifier (4.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unicode-display_width (1.6.1)
validate_url (1.0.8) validate_url (1.0.8)
activemodel (>= 3.0.0) activemodel (>= 3.0.0)
public_suffix public_suffix
@ -310,6 +329,7 @@ DEPENDENCIES
rails-controller-testing rails-controller-testing
rails-i18n rails-i18n
rspec-rails (~> 3.0) rspec-rails (~> 3.0)
rubocop-faker
sass-rails sass-rails
sdoc (~> 0.4.0) sdoc (~> 0.4.0)
shoulda-matchers (~> 3.1) shoulda-matchers (~> 3.1)

View file

@ -3,14 +3,14 @@ require_relative '../factory_helper'
FactoryBot.define do FactoryBot.define do
factory :paper do factory :paper do
name { Faker::Lorem.sentence } 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) } sequence(:reference) { |n| FactoryHelper.reference(n) }
body "leipzig" body { "leipzig" }
published_at "2015-07-20 21:16:53" published_at { "2015-07-20 21:16:53" }
scraped_at "2015-07-20 21:16:53" scraped_at { "2015-07-20 21:16:53" }
paper_type { FactoryHelper.paper_type } paper_type { FactoryHelper.paper_type }
originator { Faker::Name.name } originator { Faker::Name.name }
resolution { Faker::Lorem.paragraph(3) } resolution { Faker::Lorem.paragraph(sentence_count: 3) }
content "-------------------------------\n\n " # oh well... content { "-------------------------------\n\n " }
end end
end end