mirror of
https://github.com/chenasraf/snpr.git
synced 2026-05-17 17:38:07 +00:00
Replace factory_girl by factory_bot everywhere
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -79,7 +79,7 @@ end
|
||||
group :development, :test do
|
||||
gem 'uuidtools'
|
||||
gem 'pry-rails', require: 'pry' unless ENV['CI']
|
||||
gem 'factory_girl_rails'
|
||||
gem 'factory_bot_rails'
|
||||
gem 'launchy'
|
||||
end
|
||||
|
||||
|
||||
10
Gemfile.lock
10
Gemfile.lock
@@ -111,10 +111,10 @@ GEM
|
||||
encryptor (3.0.0)
|
||||
erubis (2.7.0)
|
||||
execjs (2.7.0)
|
||||
factory_girl (4.9.0)
|
||||
factory_bot (4.11.1)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.9.0)
|
||||
factory_girl (~> 4.9.0)
|
||||
factory_bot_rails (4.11.1)
|
||||
factory_bot (~> 4.11.1)
|
||||
railties (>= 3.0.0)
|
||||
faraday (0.14.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
@@ -400,7 +400,7 @@ DEPENDENCIES
|
||||
dotenv-rails
|
||||
dynamic_form
|
||||
execjs
|
||||
factory_girl_rails
|
||||
factory_bot_rails
|
||||
friendly_id
|
||||
guard-rspec
|
||||
i18n (>= 0.6.6)
|
||||
@@ -451,4 +451,4 @@ DEPENDENCIES
|
||||
will_paginate-bootstrap
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.2
|
||||
1.16.6
|
||||
|
||||
@@ -59,7 +59,7 @@ module Snpr
|
||||
|
||||
config.generators do |g|
|
||||
g.test_framework :rspec
|
||||
g.factory_girl dir: 'test/factories'
|
||||
g.factory_bot dir: 'test/factories'
|
||||
end
|
||||
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :achievement do
|
||||
award 'Foooooooo'
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :fitbit_activity do
|
||||
steps 100
|
||||
floors 1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :fitbit_body do
|
||||
weight '100'
|
||||
bmi '200'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :fitbit_profile do
|
||||
after(:create) do |fp, _evaluator|
|
||||
params = { fitbit_profile: fp, date_logged: '2013-01-14' }
|
||||
FactoryGirl.create(:fitbit_body, params)
|
||||
FactoryGirl.create(:fitbit_sleep, params)
|
||||
FactoryGirl.create(:fitbit_activity, params)
|
||||
FactoryBot.create(:fitbit_body, params)
|
||||
FactoryBot.create(:fitbit_sleep, params)
|
||||
FactoryBot.create(:fitbit_activity, params)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :fitbit_sleep do
|
||||
minutes_asleep 480
|
||||
minutes_awake 10
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :genome_gov_paper do
|
||||
title 'A Genome.gov Paper'
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :genotype do
|
||||
genotype_file_name 'foo.txt'
|
||||
user
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :mendeley_paper do
|
||||
title 'Musterstudie'
|
||||
uuid { UUIDTools::UUID.random_create.to_s }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :message do
|
||||
user
|
||||
sent false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :phenotype_comment do
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :phenotype do
|
||||
characteristic 'Penis length'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :picture_phenotype do
|
||||
characteristic 'Eye color'
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :plos_paper do
|
||||
title 'A PLOS Paper'
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :snp_comment do
|
||||
comment_text 'This is a great SNP!'
|
||||
subject 'Great!'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :snpedia_paper do
|
||||
url 'http://www.snpedia.com/index.php/Rs1234(A;C)'
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :snp do
|
||||
sequence(:name) { |i| "rs#{i}" }
|
||||
sequence(:position) { |i| i }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :user_achievement do
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :user_phenotype do
|
||||
association :user
|
||||
association :phenotype
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :user_picture_phenotype do
|
||||
variation 'pink'
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :user_snp do
|
||||
local_genotype 'AG'
|
||||
genotype
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :user do
|
||||
name 'Dogbert'
|
||||
sequence(:email) { |i| "fubert#{i}@example.org" }
|
||||
|
||||
@@ -7,7 +7,7 @@ end
|
||||
require File.expand_path("../../config/environment", __FILE__)
|
||||
require 'rspec/rails'
|
||||
require 'sidekiq/testing'
|
||||
require 'factory_girl_rails'
|
||||
require 'factory_bot_rails'
|
||||
require 'pry-rails' unless ENV['CI']
|
||||
require 'authlogic/test_case'
|
||||
require 'capybara/poltergeist'
|
||||
@@ -21,7 +21,7 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||
Sidekiq::Logging.logger = Logger.new('log/sidekiq-test.log')
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
config.include Authlogic::TestCase
|
||||
|
||||
# ## Mock Framework
|
||||
|
||||
@@ -7,8 +7,8 @@ class BeaconControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
activate_authlogic
|
||||
Sidekiq::Client.stubs(:enqueue)
|
||||
@user = FactoryGirl.create(:user)
|
||||
@snp = FactoryGirl.create(:snp)
|
||||
@user = FactoryBot.create(:user)
|
||||
@snp = FactoryBot.create(:snp)
|
||||
@snp.allele_frequency['A'] = 2
|
||||
@snp.save
|
||||
@controller.send(:reset_session)
|
||||
|
||||
@@ -4,7 +4,7 @@ require_relative '../test_helper'
|
||||
class GenotypesControllerTest < ActionController::TestCase
|
||||
context "Genotypes" do
|
||||
setup do
|
||||
@genotype = FactoryGirl.create(:genotype)
|
||||
@genotype = FactoryBot.create(:genotype)
|
||||
UserAchievement.delete_all
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@ class GenotypesControllerTest < ActionController::TestCase
|
||||
context "authenticated users" do
|
||||
setup do
|
||||
activate_authlogic
|
||||
@user = FactoryGirl.create(:user)
|
||||
@user = FactoryBot.create(:user)
|
||||
UserSession.create(@user)
|
||||
@publishing_award = Achievement.find_by!(award: 'Published genotyping')
|
||||
end
|
||||
|
||||
@@ -7,18 +7,18 @@ class SnpsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
activate_authlogic
|
||||
Sidekiq::Client.stubs(:enqueue)
|
||||
@user = FactoryGirl.create(:user)
|
||||
@snp = FactoryGirl.create(:snp)
|
||||
@snp_comment = FactoryGirl.create(:snp_comment, snp: @snp, user: @user)
|
||||
@user_snp = FactoryGirl.create(:user_snp, snp: @snp, user: @user)
|
||||
@user = FactoryBot.create(:user)
|
||||
@snp = FactoryBot.create(:snp)
|
||||
@snp_comment = FactoryBot.create(:snp_comment, snp: @snp, user: @user)
|
||||
@user_snp = FactoryBot.create(:user_snp, snp: @snp, user: @user)
|
||||
@controller.send(:reset_session)
|
||||
end
|
||||
|
||||
should "be shown" do
|
||||
FactoryGirl.create(:mendeley_paper, snps: [@snp])
|
||||
FactoryGirl.create(:plos_paper, snps: [@snp])
|
||||
FactoryGirl.create(:snpedia_paper, snps: [@snp])
|
||||
FactoryGirl.create(:genome_gov_paper, snps: [@snp])
|
||||
FactoryBot.create(:mendeley_paper, snps: [@snp])
|
||||
FactoryBot.create(:plos_paper, snps: [@snp])
|
||||
FactoryBot.create(:snpedia_paper, snps: [@snp])
|
||||
FactoryBot.create(:genome_gov_paper, snps: [@snp])
|
||||
get(:show, id: @snp.name)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ require_relative '../test_helper'
|
||||
class UsersControllerTest < ActionController::TestCase
|
||||
context "Users" do
|
||||
setup do
|
||||
@user = FactoryGirl.create(:user, name: "The Dude")
|
||||
@user = FactoryBot.create(:user, name: "The Dude")
|
||||
activate_authlogic
|
||||
assert_nil @controller.send(:current_user)
|
||||
Object.any_instance.stubs(:recaptcha_tags)
|
||||
@@ -81,7 +81,7 @@ class UsersControllerTest < ActionController::TestCase
|
||||
context "other users" do
|
||||
setup do
|
||||
@controller = UsersController.new
|
||||
@other_user = FactoryGirl.create(:user, name: "The Nihilist")
|
||||
@other_user = FactoryBot.create(:user, name: "The Nihilist")
|
||||
@session = UserSession.create(@other_user)
|
||||
assert_equal @other_user, @controller.send(:current_user)
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ require 'rails/test_help'
|
||||
require "authlogic/test_case"
|
||||
require 'webmock'
|
||||
WebMock.disable_net_connect!(allow_localhost: true)
|
||||
require 'factory_girl_rails'
|
||||
require 'factory_bot_rails'
|
||||
require 'paperclip/matchers'
|
||||
require 'plos'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ require_relative '../test_helper'
|
||||
|
||||
class GenomeGovTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@snp = FactoryGirl.create(:snp, name: 'rs9277554')
|
||||
@snp = FactoryBot.create(:snp, name: 'rs9277554')
|
||||
end
|
||||
|
||||
should 'create GenomeGovPapers' do
|
||||
@@ -29,7 +29,7 @@ class GenomeGovTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should 'update existing GenomeGovPapers' do
|
||||
paper = FactoryGirl.create(:genome_gov_paper,
|
||||
paper = FactoryBot.create(:genome_gov_paper,
|
||||
title: "Association of granulomatosis with polyangiitis (Wegener's) with HLA-DPB1*04 and SEMA6A gene variants: evidence from genome-wide analysis.",
|
||||
pubmed_link: 'http://www.ncbi.nlm.nih.gov/pubmed/23740775')
|
||||
paper.snps << @snp
|
||||
|
||||
@@ -4,7 +4,7 @@ require_relative '../test_helper'
|
||||
class MendeleySearchTest < ActiveSupport::TestCase
|
||||
context "worker" do
|
||||
setup do
|
||||
@snp = FactoryGirl.create(:snp)
|
||||
@snp = FactoryBot.create(:snp)
|
||||
@worker = MendeleySearch.new
|
||||
@document = {
|
||||
"uuid" => UUIDTools::UUID.random_create.to_s,
|
||||
@@ -98,7 +98,7 @@ class MendeleySearchTest < ActiveSupport::TestCase
|
||||
|
||||
should "not update existing valid papers" do
|
||||
uuid = @document["uuid"]
|
||||
existing_mendeley_paper = FactoryGirl.
|
||||
existing_mendeley_paper = FactoryBot.
|
||||
build_stubbed(:mendeley_paper, uuid: uuid, snps: [@snp])
|
||||
MendeleyPaper.expects(:find_or_initialize_by).with(uuid: uuid).
|
||||
returns(existing_mendeley_paper)
|
||||
@@ -110,7 +110,7 @@ class MendeleySearchTest < ActiveSupport::TestCase
|
||||
|
||||
should "update existing invalid papers" do
|
||||
uuid = @document["uuid"]
|
||||
existing_mendeley_paper = FactoryGirl.create(:mendeley_paper, uuid: uuid)
|
||||
existing_mendeley_paper = FactoryBot.create(:mendeley_paper, uuid: uuid)
|
||||
existing_mendeley_paper.update_column(:title, nil)
|
||||
Sidekiq::Client.expects(:enqueue)
|
||||
assert_difference(lambda { SnpReference.count }) do
|
||||
|
||||
@@ -3,7 +3,7 @@ require_relative '../test_helper'
|
||||
|
||||
class PlosSearchTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@snp = FactoryGirl.create(:snp)
|
||||
@snp = FactoryBot.create(:snp)
|
||||
end
|
||||
|
||||
should "create new PlosPapers for results from PLOS API" do
|
||||
@@ -27,7 +27,7 @@ class PlosSearchTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "update existing PlosPapers" do
|
||||
plos_paper = FactoryGirl.create(:plos_paper, doi: 'x')
|
||||
plos_paper = FactoryBot.create(:plos_paper, doi: 'x')
|
||||
article = mock(
|
||||
authors: ['Max Mustermann'],
|
||||
id: 'x',
|
||||
|
||||
@@ -4,12 +4,12 @@ require_relative '../test_helper'
|
||||
class SnpReferenceTest < ActiveSupport::TestCase
|
||||
context "SnpReference" do
|
||||
setup do
|
||||
@snps = FactoryGirl.create_list(:snp, 2)
|
||||
@snps = FactoryBot.create_list(:snp, 2)
|
||||
end
|
||||
|
||||
%w(mendeley plos snpedia genome_gov).each do |paper|
|
||||
should "associate snps with #{paper} papers" do
|
||||
@paper = FactoryGirl.create("#{paper}_paper".to_sym)
|
||||
@paper = FactoryBot.create("#{paper}_paper".to_sym)
|
||||
|
||||
assert_difference(lambda { SnpReference.count }) do
|
||||
@paper.snps << @snps.first
|
||||
|
||||
@@ -4,7 +4,7 @@ require_relative '../test_helper'
|
||||
class SnpTest < ActiveSupport::TestCase
|
||||
context "Snp" do
|
||||
setup do
|
||||
@snp = FactoryGirl.create(:snp)
|
||||
@snp = FactoryBot.create(:snp)
|
||||
end
|
||||
|
||||
should 'sum up genotype frequencies' do
|
||||
|
||||
@@ -3,7 +3,7 @@ require_relative '../test_helper'
|
||||
|
||||
class SnpediaTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@snp = FactoryGirl.create(:snp, name: 'rs12979860',
|
||||
@snp = FactoryBot.create(:snp, name: 'rs12979860',
|
||||
snpedia_updated: 32.days.ago)
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ class SnpediaTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should 'skip existing papers' do
|
||||
FactoryGirl.create(:snpedia_paper,
|
||||
FactoryBot.create(:snpedia_paper,
|
||||
revision: 445428,
|
||||
url: "http://www.snpedia.com/index.php/Rs12979860(C;C)",
|
||||
snps: [@snp])
|
||||
|
||||
Reference in New Issue
Block a user