From aeee87ea75b5a37a61722beddbc2257b176331f9 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 3 Oct 2019 15:12:26 +0300 Subject: [PATCH] Remove `factory_bot_rails` gem --- Gemfile | 1 - Gemfile.lock | 6 ---- spec/factories/account.rb | 8 ----- spec/factories/account_activity.rb | 6 ---- spec/factories/admin_domain_contact.rb | 5 --- spec/factories/admin_user.rb | 10 ------ spec/factories/api_user.rb | 23 ------------- spec/factories/billing/price.rb | 18 ----------- spec/factories/contact.rb | 39 ----------------------- spec/factories/dns/zone.rb | 12 ------- spec/factories/dnskey.rb | 15 --------- spec/factories/domain.rb | 15 --------- spec/factories/domain_contact.rb | 5 --- spec/factories/epp_session.rb | 6 ---- spec/factories/keyrelay.rb | 12 ------- spec/factories/nameserver.rb | 7 ---- spec/factories/registrant.rb | 10 ------ spec/factories/registrant_user.rb | 5 --- spec/factories/registrant_verification.rb | 9 ------ spec/factories/registrar.rb | 26 --------------- spec/factories/reserved_domain.rb | 5 --- spec/factories/tech_domain_contact.rb | 5 --- spec/factories/white_ip.rb | 5 --- spec/factory_lint_spec.rb | 15 --------- spec/support/factory_bot.rb | 3 -- test/test_helper.rb | 2 -- 26 files changed, 273 deletions(-) delete mode 100644 spec/factories/account.rb delete mode 100644 spec/factories/account_activity.rb delete mode 100644 spec/factories/admin_domain_contact.rb delete mode 100644 spec/factories/admin_user.rb delete mode 100644 spec/factories/api_user.rb delete mode 100644 spec/factories/billing/price.rb delete mode 100644 spec/factories/contact.rb delete mode 100644 spec/factories/dns/zone.rb delete mode 100644 spec/factories/dnskey.rb delete mode 100644 spec/factories/domain.rb delete mode 100644 spec/factories/domain_contact.rb delete mode 100644 spec/factories/epp_session.rb delete mode 100644 spec/factories/keyrelay.rb delete mode 100644 spec/factories/nameserver.rb delete mode 100644 spec/factories/registrant.rb delete mode 100644 spec/factories/registrant_user.rb delete mode 100644 spec/factories/registrant_verification.rb delete mode 100644 spec/factories/registrar.rb delete mode 100644 spec/factories/reserved_domain.rb delete mode 100644 spec/factories/tech_domain_contact.rb delete mode 100644 spec/factories/white_ip.rb delete mode 100644 spec/factory_lint_spec.rb delete mode 100644 spec/support/factory_bot.rb diff --git a/Gemfile b/Gemfile index 0a7d8e7f3..3e4d79449 100644 --- a/Gemfile +++ b/Gemfile @@ -89,7 +89,6 @@ group :development do end group :development, :test do - gem 'factory_bot_rails' gem 'capybara' gem 'rspec-rails', '~> 3.6' gem 'selenium-webdriver' diff --git a/Gemfile.lock b/Gemfile.lock index c0c82c9e9..aaae2e0f7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -176,11 +176,6 @@ GEM equalizer (0.0.11) erubis (2.7.0) execjs (2.7.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) ffi (1.9.25) figaro (1.1.1) thor (~> 0.14) @@ -458,7 +453,6 @@ DEPENDENCIES e_invoice! epp (= 1.5.0)! epp-xml (= 1.1.0)! - factory_bot_rails figaro (= 1.1.1) grape haml diff --git a/spec/factories/account.rb b/spec/factories/account.rb deleted file mode 100644 index 4407b1f86..000000000 --- a/spec/factories/account.rb +++ /dev/null @@ -1,8 +0,0 @@ -FactoryBot.define do - factory :account do - account_type Account::CASH - balance 1 - currency 'EUR' - registrar - end -end diff --git a/spec/factories/account_activity.rb b/spec/factories/account_activity.rb deleted file mode 100644 index b5dd348f2..000000000 --- a/spec/factories/account_activity.rb +++ /dev/null @@ -1,6 +0,0 @@ -FactoryBot.define do - factory :account_activity do - sum 1.0 - account - end -end diff --git a/spec/factories/admin_domain_contact.rb b/spec/factories/admin_domain_contact.rb deleted file mode 100644 index bdfb193e3..000000000 --- a/spec/factories/admin_domain_contact.rb +++ /dev/null @@ -1,5 +0,0 @@ -FactoryBot.define do - factory :admin_domain_contact, parent: :domain_contact, class: AdminDomainContact do - - end -end diff --git a/spec/factories/admin_user.rb b/spec/factories/admin_user.rb deleted file mode 100644 index 8f948062d..000000000 --- a/spec/factories/admin_user.rb +++ /dev/null @@ -1,10 +0,0 @@ -FactoryBot.define do - factory :admin_user do - username 'test' - sequence(:email) { |n| "test#{n}@test.com" } - password 'a' * AdminUser.min_password_length - password_confirmation { password } - country_code 'de' - roles ['admin'] - end -end diff --git a/spec/factories/api_user.rb b/spec/factories/api_user.rb deleted file mode 100644 index 01ba0f8da..000000000 --- a/spec/factories/api_user.rb +++ /dev/null @@ -1,23 +0,0 @@ -FactoryBot.define do - factory :api_user do - sequence(:username) { |n| "test#{n}" } - plain_text_password 'a' * ApiUser.min_password_length - roles ['super'] - registrar - - factory :api_user_epp do - roles %w(epp static_registrant) - end - - factory :api_user_with_unlimited_balance do - transient do - registrar false - end - - after :build do |api_user, evaluator| - registrar = (evaluator.registrar || create(:registrar_with_unlimited_balance)) - api_user.registrar = registrar - end - end - end -end diff --git a/spec/factories/billing/price.rb b/spec/factories/billing/price.rb deleted file mode 100644 index 4d44cf6a1..000000000 --- a/spec/factories/billing/price.rb +++ /dev/null @@ -1,18 +0,0 @@ -FactoryBot.define do - factory :price, class: Billing::Price do - price Money.from_amount(1) - valid_from Time.zone.parse('05.07.2010') - valid_to Time.zone.parse('05.07.2010') - duration '1 year' - operation_category Billing::Price.operation_categories.first - zone - - factory :effective_price do - expire_time { Time.zone.now + 1.day } - end - - factory :expired_price do - expire_time { Time.zone.now - 1.day } - end - end -end diff --git a/spec/factories/contact.rb b/spec/factories/contact.rb deleted file mode 100644 index 7e7a9a6a2..000000000 --- a/spec/factories/contact.rb +++ /dev/null @@ -1,39 +0,0 @@ -FactoryBot.define do - factory :contact do - name 'test' - sequence(:code) { |n| "test#{n}" } - phone '+123.456789' - email 'test@test.com' - street 'test' - city 'test' - zip 12345 - country_code 'EE' - ident '37605030299' - ident_type 'priv' - ident_country_code 'EE' - registrar - - factory :contact_private_entity do - ident_type 'priv' - end - - factory :contact_legal_entity do - ident_type 'org' - ident '12345678' # valid reg no for .ee - end - - factory :contact_with_address do - street 'test' - city 'test' - zip 12345 - country_code 'EE' - end - - factory :contact_without_address do - street nil - city nil - zip nil - country_code nil - end - end -end diff --git a/spec/factories/dns/zone.rb b/spec/factories/dns/zone.rb deleted file mode 100644 index e88a3f2fe..000000000 --- a/spec/factories/dns/zone.rb +++ /dev/null @@ -1,12 +0,0 @@ -FactoryBot.define do - factory :zone, class: DNS::Zone do - sequence(:origin) { |n| "test#{n}" } - ttl 1 - refresh 1 - add_attribute :retry, 1 - expire 1 - minimum_ttl 1 - email 'test.test' - master_nameserver 'test.test' - end -end diff --git a/spec/factories/dnskey.rb b/spec/factories/dnskey.rb deleted file mode 100644 index 4dbf0a788..000000000 --- a/spec/factories/dnskey.rb +++ /dev/null @@ -1,15 +0,0 @@ -FactoryBot.define do - factory :dnskey do - alg Dnskey::ALGORITHMS.first - flags Dnskey::FLAGS.first - protocol Dnskey::PROTOCOLS.first - ds_digest_type 2 - public_key 'AwEAAaOf5+lz3ftsL+0CCvfJbhUF/NVsNh8BKo61oYs5fXVbuWDiH872 '\ - 'LC8uKDO92TJy7Q4TF9XMAKMMlf1GMAxlRspD749SOCTN00sqfWx1OMTu '\ - 'a28L1PerwHq7665oDJDKqR71btcGqyLKhe2QDvCdA0mENimF1NudX1BJ '\ - 'DDFi6oOZ0xE/0CuveB64I3ree7nCrwLwNs56kXC4LYoX3XdkOMKiJLL/ '\ - 'MAhcxXa60CdZLoRtTEW3z8/oBq4hEAYMCNclpbd6y/exScwBxFTdUfFk '\ - 'KsdNcmvai1lyk9vna0WQrtpYpHKMXvY9LFHaJxCOLR4umfeQ42RuTd82 lqfU6ClMeXs=' - domain - end -end diff --git a/spec/factories/domain.rb b/spec/factories/domain.rb deleted file mode 100644 index 39ad2240d..000000000 --- a/spec/factories/domain.rb +++ /dev/null @@ -1,15 +0,0 @@ -FactoryBot.define do - factory :domain do - sequence(:name) { |n| "test#{n}.com" } - period 1 - period_unit 'y' # Year - valid_to Time.zone.parse('2010-07-05') - registrar - registrant - - after :build do |domain| - domain.admin_domain_contacts << FactoryBot.build(:admin_domain_contact) - domain.tech_domain_contacts << FactoryBot.build(:tech_domain_contact) - end - end -end diff --git a/spec/factories/domain_contact.rb b/spec/factories/domain_contact.rb deleted file mode 100644 index caf964ed3..000000000 --- a/spec/factories/domain_contact.rb +++ /dev/null @@ -1,5 +0,0 @@ -FactoryBot.define do - factory :domain_contact do - contact - end -end diff --git a/spec/factories/epp_session.rb b/spec/factories/epp_session.rb deleted file mode 100644 index 296368a92..000000000 --- a/spec/factories/epp_session.rb +++ /dev/null @@ -1,6 +0,0 @@ -FactoryBot.define do - factory :epp_session do - sequence(:session_id) { |n| "test#{n}" } - association :user, factory: :api_user - end -end diff --git a/spec/factories/keyrelay.rb b/spec/factories/keyrelay.rb deleted file mode 100644 index 4587af999..000000000 --- a/spec/factories/keyrelay.rb +++ /dev/null @@ -1,12 +0,0 @@ -FactoryBot.define do - factory :keyrelay do - pa_date { Time.zone.now } - expiry_relative 'P1W' - key_data_public_key 'abc' - key_data_flags 0 - key_data_protocol 3 - key_data_alg 3 - auth_info_pw 'abc' - domain - end -end diff --git a/spec/factories/nameserver.rb b/spec/factories/nameserver.rb deleted file mode 100644 index ee0a7f987..000000000 --- a/spec/factories/nameserver.rb +++ /dev/null @@ -1,7 +0,0 @@ -FactoryBot.define do - factory :nameserver do - sequence(:hostname) { |n| "ns.test#{n}.ee" } - ipv4 '192.168.1.1' - domain - end -end diff --git a/spec/factories/registrant.rb b/spec/factories/registrant.rb deleted file mode 100644 index f21fbe7c4..000000000 --- a/spec/factories/registrant.rb +++ /dev/null @@ -1,10 +0,0 @@ -FactoryBot.define do - factory :registrant, parent: :contact, class: Registrant do - name 'test' - - factory :registrant_private_entity, class: Registrant, parent: :contact_private_entity - factory :registrant_legal_entity, class: Registrant, parent: :contact_legal_entity - factory :registrant_with_address, class: Registrant, parent: :contact_with_address - factory :registrant_without_address, class: Registrant, parent: :contact_without_address - end -end diff --git a/spec/factories/registrant_user.rb b/spec/factories/registrant_user.rb deleted file mode 100644 index 29d0a2479..000000000 --- a/spec/factories/registrant_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -FactoryBot.define do - factory :registrant_user do - - end -end diff --git a/spec/factories/registrant_verification.rb b/spec/factories/registrant_verification.rb deleted file mode 100644 index 5ecc81fa5..000000000 --- a/spec/factories/registrant_verification.rb +++ /dev/null @@ -1,9 +0,0 @@ -FactoryBot.define do - factory :registrant_verification do - sequence(:domain_name) { |i| "domain#{i}.ee" } - domain - verification_token '123' - action 'confirmed' - action_type 'registrant_change' - end -end diff --git a/spec/factories/registrar.rb b/spec/factories/registrar.rb deleted file mode 100644 index 2bc945900..000000000 --- a/spec/factories/registrar.rb +++ /dev/null @@ -1,26 +0,0 @@ -FactoryBot.define do - factory :registrar do - sequence(:name) { |n| "test#{n}" } - sequence(:code) { |n| "test#{n}" } - sequence(:reg_no) { |n| "test#{n}" } - email 'test@test.com' - address_street 'test' - address_city 'test' - address_country_code 'US' - accounting_customer_code 'test' - language 'en' - sequence(:reference_no) { |n| "1234#{n}" } - - factory :registrar_with_unlimited_balance do - after :create do |registrar| - create(:account, registrar: registrar, balance: 1_000_000) - end - end - - factory :registrar_with_zero_balance do - after :create do |registrar| - create(:account, registrar: registrar, balance: 0) - end - end - end -end diff --git a/spec/factories/reserved_domain.rb b/spec/factories/reserved_domain.rb deleted file mode 100644 index 54d3c61df..000000000 --- a/spec/factories/reserved_domain.rb +++ /dev/null @@ -1,5 +0,0 @@ -FactoryBot.define do - factory :reserved_domain do - sequence(:name) { |i| "domain#{i}.ee" } - end -end diff --git a/spec/factories/tech_domain_contact.rb b/spec/factories/tech_domain_contact.rb deleted file mode 100644 index b3b3f0564..000000000 --- a/spec/factories/tech_domain_contact.rb +++ /dev/null @@ -1,5 +0,0 @@ -FactoryBot.define do - factory :tech_domain_contact, parent: :domain_contact, class: TechDomainContact do - - end -end diff --git a/spec/factories/white_ip.rb b/spec/factories/white_ip.rb deleted file mode 100644 index f2b46711c..000000000 --- a/spec/factories/white_ip.rb +++ /dev/null @@ -1,5 +0,0 @@ -FactoryBot.define do - factory :white_ip do - ipv4 '127.0.0.1' - end -end diff --git a/spec/factory_lint_spec.rb b/spec/factory_lint_spec.rb deleted file mode 100644 index 8d6386f2f..000000000 --- a/spec/factory_lint_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require_relative 'rails_helper' - -RSpec.describe 'FactoryBot', db: true do - before :example do - allow(Contact).to receive(:address_processing?).and_return(false) - end - - it 'lints factories' do - factories_to_lint = FactoryBot.factories.reject do |factory| - %i(reserved_domain).include?(factory.name) || factory.name.to_s =~ /^domain/ # Ignore the ones with domain_name validator - end - - FactoryBot.lint factories_to_lint - end -end diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb deleted file mode 100644 index c7890e49c..000000000 --- a/spec/support/factory_bot.rb +++ /dev/null @@ -1,3 +0,0 @@ -RSpec.configure do |config| - config.include FactoryBot::Syntax::Methods -end diff --git a/test/test_helper.rb b/test/test_helper.rb index c250837c1..9159ff2e3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -29,8 +29,6 @@ CompanyRegister::Client = CompanyRegisterClientStub EInvoice.provider = EInvoice::Providers::TestProvider.new class ActiveSupport::TestCase - include FactoryBot::Syntax::Methods - ActiveRecord::Migration.check_pending! fixtures :all