Upgrade factory_bot, faker
This commit is contained in:
parent
e6a1bfcb45
commit
f2cb17bcd6
10 changed files with 33 additions and 33 deletions
30
Gemfile.lock
30
Gemfile.lock
|
@ -139,7 +139,7 @@ GEM
|
|||
execjs
|
||||
coffee-script-source (1.12.2)
|
||||
commonjs (0.2.7)
|
||||
concurrent-ruby (1.1.4)
|
||||
concurrent-ruby (1.1.5)
|
||||
connection_pool (2.2.2)
|
||||
content_for_in_controllers (0.0.2)
|
||||
coveralls (0.8.22)
|
||||
|
@ -148,7 +148,7 @@ GEM
|
|||
term-ansicolor (~> 1.3)
|
||||
thor (~> 0.19.4)
|
||||
tins (~> 1.6)
|
||||
crass (1.0.4)
|
||||
crass (1.0.5)
|
||||
daemons (1.2.6)
|
||||
database_cleaner (1.7.0)
|
||||
date_time_attribute (0.1.2)
|
||||
|
@ -174,13 +174,13 @@ GEM
|
|||
activesupport (>= 4.0, < 6)
|
||||
execjs (2.7.0)
|
||||
expression_parser (0.9.0)
|
||||
factory_bot (4.8.2)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_bot_rails (4.8.2)
|
||||
factory_bot (~> 4.8.2)
|
||||
railties (>= 3.0.0)
|
||||
faker (1.8.4)
|
||||
i18n (~> 0.5)
|
||||
factory_bot (5.1.1)
|
||||
activesupport (>= 4.2.0)
|
||||
factory_bot_rails (5.1.1)
|
||||
factory_bot (~> 5.1.0)
|
||||
railties (>= 4.2.0)
|
||||
faker (2.2.1)
|
||||
i18n (>= 0.8)
|
||||
ffi (1.9.25)
|
||||
gaffe (1.2.0)
|
||||
rails (>= 4.0.0)
|
||||
|
@ -249,7 +249,7 @@ GEM
|
|||
sprockets (> 2, < 4)
|
||||
tilt
|
||||
libv8 (3.16.14.19)
|
||||
loofah (2.2.3)
|
||||
loofah (2.3.1)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
|
@ -275,11 +275,11 @@ GEM
|
|||
mime-types-data (3.2018.0812)
|
||||
mini_mime (1.0.1)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.11.3)
|
||||
minitest (5.12.2)
|
||||
mono_logger (1.1.0)
|
||||
multi_json (1.13.1)
|
||||
mysql2 (0.4.10)
|
||||
nokogiri (1.9.1)
|
||||
nokogiri (1.10.4)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
pdf-core (0.7.0)
|
||||
polyglot (0.3.5)
|
||||
|
@ -329,8 +329,8 @@ GEM
|
|||
activesupport (>= 4.2.0, < 5.0)
|
||||
nokogiri (~> 1.6)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.4)
|
||||
loofah (~> 2.2, >= 2.2.2)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
rails-i18n (4.0.9)
|
||||
i18n (~> 0.7)
|
||||
railties (~> 4.0)
|
||||
|
@ -344,7 +344,7 @@ GEM
|
|||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (3.0.0)
|
||||
rake (12.3.2)
|
||||
rake (13.0.0)
|
||||
ransack (1.8.9)
|
||||
actionpack (>= 3.0, <= 5.1.1)
|
||||
activerecord (>= 3.0, <= 5.1.1)
|
||||
|
|
|
@ -10,20 +10,20 @@ FactoryBot.define do
|
|||
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }
|
||||
|
||||
factory :article do
|
||||
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " ##{n}" }
|
||||
sequence(:name) { |n| Faker::Lorem.words(number: rand(2..4)).join(' ') + " ##{n}" }
|
||||
supplier { create :supplier }
|
||||
article_category { create :article_category }
|
||||
end
|
||||
|
||||
factory :shared_article, class: SharedArticle do
|
||||
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " s##{n}" }
|
||||
order_number { Faker::Lorem.characters(rand(1..12)) }
|
||||
sequence(:name) { |n| Faker::Lorem.words(number: rand(2..4)).join(' ') + " s##{n}" }
|
||||
order_number { Faker::Lorem.characters(number: rand(1..12)) }
|
||||
supplier { create :shared_supplier }
|
||||
end
|
||||
end
|
||||
|
||||
factory :article_category do
|
||||
sequence(:name) { |n| Faker::Lorem.characters(rand(2..12)) + " ##{n}" }
|
||||
sequence(:name) { |n| Faker::Lorem.characters(number: rand(2..12)) + " ##{n}" }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ FactoryBot.define do
|
|||
|
||||
factory :oauth2_application, class: Doorkeeper::Application do
|
||||
name { Faker::App.name }
|
||||
redirect_uri 'https://example.com:1234/app'
|
||||
redirect_uri { 'https://example.com:1234/app' }
|
||||
end
|
||||
|
||||
factory :oauth2_access_token, class: Doorkeeper::AccessToken do
|
||||
|
|
|
@ -3,12 +3,12 @@ require 'factory_bot'
|
|||
FactoryBot.define do
|
||||
|
||||
factory :financial_transaction_class do
|
||||
sequence(:name) { |n| Faker::Lorem.characters(rand(2..12)) + " ##{n}" }
|
||||
sequence(:name) { |n| Faker::Lorem.characters(number: rand(2..12)) + " ##{n}" }
|
||||
end
|
||||
|
||||
factory :financial_transaction_type do
|
||||
financial_transaction_class
|
||||
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " ##{n}" }
|
||||
sequence(:name) { |n| Faker::Lorem.words(number: rand(2..4)).join(' ') + " ##{n}" }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,12 +8,12 @@ FactoryBot.define do
|
|||
article_ids { supplier.articles.map(&:id) unless supplier.nil? }
|
||||
|
||||
transient do
|
||||
article_count true
|
||||
article_count { true }
|
||||
end
|
||||
|
||||
# for an order from stock; need to add articles
|
||||
factory :stock_order do
|
||||
supplier_id 0
|
||||
supplier_id { 0 }
|
||||
# article_ids needs to be supplied
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ FactoryBot.define do
|
|||
address { Faker::Address.street_address }
|
||||
|
||||
transient do
|
||||
article_count 0
|
||||
article_count { 0 }
|
||||
end
|
||||
|
||||
after :create do |supplier, evaluator|
|
||||
|
|
|
@ -10,7 +10,7 @@ FactoryBot.define do
|
|||
|
||||
factory :admin do
|
||||
sequence(:nick) { |n| "admin#{n}" }
|
||||
first_name 'Administrator'
|
||||
first_name { 'Administrator' }
|
||||
after :create do |user, evaluator|
|
||||
create :workgroup, role_admin: true, user_ids: [user.id]
|
||||
end
|
||||
|
@ -35,11 +35,11 @@ FactoryBot.define do
|
|||
sequence(:name) {|n| "Group ##{n}"}
|
||||
|
||||
factory :workgroup do
|
||||
type ''
|
||||
type { '' }
|
||||
end
|
||||
|
||||
factory :ordergroup do
|
||||
type 'Ordergroup'
|
||||
type { 'Ordergroup' }
|
||||
sequence(:name) {|n| "Order group ##{n}"}
|
||||
# workaround to avoid needing to save the ordergroup
|
||||
# avoids e.g. error after logging in related to applebar
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require_relative '../spec_helper'
|
||||
|
||||
feature 'admin/configs' do
|
||||
let(:name) { Faker::Lorem.words(rand(2..4)).join(' ') }
|
||||
let(:name) { Faker::Lorem.words(number: rand(2..4)).join(' ') }
|
||||
let(:email) { Faker::Internet.email }
|
||||
let(:admin) { create :admin }
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require_relative '../spec_helper'
|
||||
|
||||
describe FoodsoftConfig do
|
||||
let(:name) { Faker::Lorem.words(rand(2..4)).join(' ') }
|
||||
let(:other_name) { Faker::Lorem.words(rand(2..4)).join(' ') }
|
||||
let(:name) { Faker::Lorem.words(number: rand(2..4)).join(' ') }
|
||||
let(:other_name) { Faker::Lorem.words(number: rand(2..4)).join(' ') }
|
||||
|
||||
it 'returns a default value' do
|
||||
expect(FoodsoftConfig[:protected][:database]).to be true
|
||||
|
|
|
@ -23,7 +23,7 @@ describe TokenVerifier do
|
|||
msg
|
||||
oldscope = FoodsoftConfig.scope
|
||||
begin
|
||||
FoodsoftConfig.scope = Faker::Lorem.words(1)
|
||||
FoodsoftConfig.scope = Faker::Lorem.words(number: 1)
|
||||
v2 = TokenVerifier.new(prefix)
|
||||
expect{ v2.verify(msg) }.to raise_error(TokenVerifier::InvalidScope)
|
||||
ensure
|
||||
|
@ -32,7 +32,7 @@ describe TokenVerifier do
|
|||
end
|
||||
|
||||
it 'does not validate a random string' do
|
||||
expect{ v.verify(Faker::Lorem.characters(100)) }.to raise_error(ActiveSupport::MessageVerifier::InvalidSignature)
|
||||
expect{ v.verify(Faker::Lorem.characters(number: 100)) }.to raise_error(ActiveSupport::MessageVerifier::InvalidSignature)
|
||||
end
|
||||
|
||||
it 'returns the message' do
|
||||
|
|
Loading…
Reference in a new issue