mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Rename FactoryGirl to FactoryBot
https://robots.thoughtbot.com/factory_bot
This commit is contained in:
parent
48fd2a95a0
commit
52ab208b92
34 changed files with 47 additions and 47 deletions
2
Gemfile
2
Gemfile
|
@ -116,7 +116,7 @@ group :development do
|
|||
end
|
||||
|
||||
group :development, :test do
|
||||
gem 'factory_girl_rails'
|
||||
gem 'factory_bot_rails'
|
||||
gem 'capybara'
|
||||
gem 'rspec-rails', '~> 3.6'
|
||||
gem 'phantomjs-binaries'
|
||||
|
|
|
@ -182,10 +182,10 @@ GEM
|
|||
equalizer (0.0.11)
|
||||
erubis (2.7.0)
|
||||
execjs (2.7.0)
|
||||
factory_girl (4.8.0)
|
||||
factory_bot (4.8.2)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.8.0)
|
||||
factory_girl (~> 4.8.0)
|
||||
factory_bot_rails (4.8.2)
|
||||
factory_bot (~> 4.8.2)
|
||||
railties (>= 3.0.0)
|
||||
ffi (1.9.18)
|
||||
figaro (1.1.1)
|
||||
|
@ -509,7 +509,7 @@ DEPENDENCIES
|
|||
digidoc_client!
|
||||
epp (= 1.5.0)!
|
||||
epp-xml (= 1.1.0)!
|
||||
factory_girl_rails
|
||||
factory_bot_rails
|
||||
figaro (= 1.1.1)
|
||||
grape (= 0.12.0)
|
||||
haml-rails (= 0.9.0)
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace :dev do
|
|||
task :prime, [:random] => :environment do |t, args|
|
||||
abort 'Production environment is not supported' if Rails.env.production?
|
||||
|
||||
include FactoryGirl::Syntax::Methods
|
||||
include FactoryBot::Syntax::Methods
|
||||
|
||||
PaperTrail.enabled = false
|
||||
Domain.paper_trail_on!
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :account do
|
||||
account_type Account::CASH
|
||||
balance 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :account_activity do
|
||||
sum 1.0
|
||||
account
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :admin_domain_contact, parent: :domain_contact, class: AdminDomainContact do
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :admin_user do
|
||||
username 'test'
|
||||
sequence(:email) { |n| "test#{n}@test.com" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :api_user do
|
||||
sequence(:username) { |n| "test#{n}" }
|
||||
password 'a' * ApiUser.min_password_length
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :bank_statement do
|
||||
bank_code { '767' }
|
||||
iban { 'EE557700771000598731' }
|
||||
queried_at { Time.zone.now }
|
||||
|
||||
after :build do |bank_statement|
|
||||
bank_statement.bank_transactions << FactoryGirl.create_pair(:bank_transaction)
|
||||
bank_statement.bank_transactions << FactoryBot.create_pair(:bank_transaction)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :bank_transaction do
|
||||
currency { 'EUR' }
|
||||
sum { 100.0 }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :price, class: Billing::Price do
|
||||
price Money.from_amount(1)
|
||||
valid_from Time.zone.parse('05.07.2010')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :contact do
|
||||
name 'test'
|
||||
sequence(:code) { |n| "test#{n}" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :zone, class: DNS::Zone do
|
||||
sequence(:origin) { |n| "test#{n}" }
|
||||
ttl 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :dnskey do
|
||||
alg Dnskey::ALGORITHMS.first
|
||||
flags Dnskey::FLAGS.first
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :domain do
|
||||
sequence(:name) { |n| "test#{n}.com" }
|
||||
period 1
|
||||
|
@ -7,8 +7,8 @@ FactoryGirl.define do
|
|||
registrant
|
||||
|
||||
after :build do |domain|
|
||||
domain.admin_domain_contacts << FactoryGirl.build(:admin_domain_contact)
|
||||
domain.tech_domain_contacts << FactoryGirl.build(:tech_domain_contact)
|
||||
domain.admin_domain_contacts << FactoryBot.build(:admin_domain_contact)
|
||||
domain.tech_domain_contacts << FactoryBot.build(:tech_domain_contact)
|
||||
end
|
||||
|
||||
factory :domain_without_force_delete do
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :domain_contact do
|
||||
contact
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :domain_transfer do
|
||||
domain
|
||||
transfer_from { FactoryGirl.create(:registrar) }
|
||||
transfer_to { FactoryGirl.create(:registrar) }
|
||||
transfer_from { FactoryBot.create(:registrar) }
|
||||
transfer_to { FactoryBot.create(:registrar) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :epp_session do
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :invoice do
|
||||
buyer_name 'Registrar 1'
|
||||
currency { 'EUR' }
|
||||
|
@ -9,10 +9,10 @@ FactoryGirl.define do
|
|||
seller_city { 'Tallinn' }
|
||||
seller_street { 'Paldiski mnt. 123' }
|
||||
vat_prc 0.2
|
||||
buyer { FactoryGirl.create(:registrar) }
|
||||
buyer { FactoryBot.create(:registrar) }
|
||||
|
||||
after :build do |invoice|
|
||||
invoice.invoice_items << FactoryGirl.create_pair(:invoice_item)
|
||||
invoice.invoice_items << FactoryBot.create_pair(:invoice_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :invoice_item do
|
||||
description { 'add money' }
|
||||
unit 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :keyrelay do
|
||||
pa_date { Time.zone.now }
|
||||
expiry_relative 'P1W'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :message do
|
||||
body 'fabricator body'
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :nameserver do
|
||||
sequence(:hostname) { |n| "ns.test#{n}.ee" }
|
||||
ipv4 '192.168.1.1'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :registrant, parent: :contact, class: Registrant do
|
||||
name 'test'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :registrant_user do
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :registrant_verification do
|
||||
sequence(:domain_name) { |i| "domain#{i}.ee" }
|
||||
domain
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :registrar do
|
||||
sequence(:name) { |n| "test#{n}" }
|
||||
sequence(:code) { |n| "test#{n}" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :reserved_domain do
|
||||
sequence(:name) { |i| "domain#{i}.ee" }
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :tech_domain_contact, parent: :domain_contact, class: TechDomainContact do
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :white_ip do
|
||||
ipv4 '127.0.0.1'
|
||||
end
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
require_relative 'rails_helper'
|
||||
|
||||
RSpec.describe 'FactoryGirl', db: true do
|
||||
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 = FactoryGirl.factories.reject do |factory|
|
||||
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
|
||||
|
||||
FactoryGirl.lint factories_to_lint
|
||||
FactoryBot.lint factories_to_lint
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ require 'support/matchers/epp/code'
|
|||
|
||||
require 'support/capybara'
|
||||
require 'support/devise'
|
||||
require 'support/factory_girl'
|
||||
require 'support/factory_bot'
|
||||
require 'support/database_cleaner'
|
||||
require 'support/paper_trail'
|
||||
require 'support/settings'
|
||||
|
|
3
spec/support/factory_bot.rb
Normal file
3
spec/support/factory_bot.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
RSpec.configure do |config|
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
RSpec.configure do |config|
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue