Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Commit

Permalink
Remove FactoryGirl shim which does not work with FactoryBot
Browse files Browse the repository at this point in the history
  • Loading branch information
quady committed May 14, 2019
1 parent 1947d06 commit 4090c8d
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 50 deletions.
1 change: 0 additions & 1 deletion lib/g5_authenticatable/rspec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'g5_authenticatable/test/env_helpers'
require 'g5_authenticatable/test/factory'
require 'g5_authenticatable/test/token_validation_helpers'
require 'g5_authenticatable/test/feature_helpers'
require 'g5_authenticatable/test/request_helpers'
Expand Down
4 changes: 4 additions & 0 deletions lib/g5_authenticatable/test/factories.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'g5_authenticatable/test/factories/client_users'
require 'g5_authenticatable/test/factories/global_users'
require 'g5_authenticatable/test/factories/location_users'
require 'g5_authenticatable/test/factories/roles'
12 changes: 6 additions & 6 deletions lib/g5_authenticatable/test/factories/client_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
FactoryBot.define do
factory :g5_authenticatable_client_user, parent: :g5_authenticatable_user do
transient do
clients nil
client_count 1
role_factory :g5_authenticatable_client_role
clients { nil }
client_count { 1 }
role_factory { :g5_authenticatable_client_role }
end

after(:create) do |user, evaluator|
Expand All @@ -25,21 +25,21 @@
factory :g5_authenticatable_client_admin,
parent: :g5_authenticatable_client_user do
transient do
role_factory :g5_authenticatable_client_admin_role
role_factory { :g5_authenticatable_client_admin_role }
end
end

factory :g5_authenticatable_client_editor,
parent: :g5_authenticatable_client_user do
transient do
role_factory :g5_authenticatable_client_editor_role
role_factory { :g5_authenticatable_client_editor_role }
end
end

factory :g5_authenticatable_client_viewer,
parent: :g5_authenticatable_client_user do
transient do
role_factory :g5_authenticatable_client_viewer_role
role_factory { :g5_authenticatable_client_viewer_role }
end
end
end
12 changes: 6 additions & 6 deletions lib/g5_authenticatable/test/factories/global_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
FactoryBot.define do
factory :g5_authenticatable_user, class: 'G5Authenticatable::User' do
sequence(:email) { |n| "test.user#{n}@test.host" }
provider 'g5'
provider { 'g5' }
sequence(:uid) { |n| "abc123-#{n}" }
sequence(:g5_access_token) { |n| "secret_token_#{n}" }
first_name 'Jane'
last_name 'Doe'
phone_number '(555) 867-5309'
title 'Minister of Funny Walks'
organization_name 'Department of Redundancy Department'
first_name { 'Jane' }
last_name { 'Doe' }
phone_number { '(555) 867-5309' }
title { 'Minister of Funny Walks' }
organization_name { 'Department of Redundancy Department' }
end

factory :g5_authenticatable_super_admin, parent: :g5_authenticatable_user do
Expand Down
12 changes: 6 additions & 6 deletions lib/g5_authenticatable/test/factories/location_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
FactoryBot.define do
factory :g5_authenticatable_location_user, parent: :g5_authenticatable_user do
transient do
locations nil
location_count 1
role_factory :g5_authenticatable_location_role
locations { nil }
location_count { 1 }
role_factory { :g5_authenticatable_location_role }
end

after(:create) do |user, evaluator|
Expand All @@ -25,21 +25,21 @@
factory :g5_authenticatable_location_admin,
parent: :g5_authenticatable_location_user do
transient do
role_factory :g5_authenticatable_location_admin_role
role_factory { :g5_authenticatable_location_admin_role }
end
end

factory :g5_authenticatable_location_editor,
parent: :g5_authenticatable_location_user do
transient do
role_factory :g5_authenticatable_location_editor_role
role_factory { :g5_authenticatable_location_editor_role }
end
end

factory :g5_authenticatable_location_viewer,
parent: :g5_authenticatable_location_user do
transient do
role_factory :g5_authenticatable_location_viewer_role
role_factory { :g5_authenticatable_location_viewer_role }
end
end
end
20 changes: 10 additions & 10 deletions lib/g5_authenticatable/test/factories/roles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

factory :g5_authenticatable_super_admin_role,
parent: :g5_authenticatable_role do
name 'super_admin'
name { 'super_admin' }
end

factory :g5_authenticatable_admin_role, parent: :g5_authenticatable_role do
name 'admin'
name { 'admin' }
end

factory :g5_authenticatable_editor_role, parent: :g5_authenticatable_role do
name 'editor'
name { 'editor' }
end

factory :g5_authenticatable_viewer_role, parent: :g5_authenticatable_role do
name 'viewer'
name { 'viewer' }
end

factory :g5_authenticatable_client_role, parent: :g5_authenticatable_role do
Expand All @@ -28,17 +28,17 @@

factory :g5_authenticatable_client_admin_role,
parent: :g5_authenticatable_client_role do
name 'admin'
name { 'admin' }
end

factory :g5_authenticatable_client_editor_role,
parent: :g5_authenticatable_client_role do
name 'editor'
name { 'editor' }
end

factory :g5_authenticatable_client_viewer_role,
parent: :g5_authenticatable_client_role do
name 'viewer'
name { 'viewer' }
end

factory :g5_authenticatable_location_role,
Expand All @@ -48,16 +48,16 @@

factory :g5_authenticatable_location_admin_role,
parent: :g5_authenticatable_location_role do
name 'admin'
name { 'admin' }
end

factory :g5_authenticatable_location_editor_role,
parent: :g5_authenticatable_location_role do
name 'editor'
name { 'editor' }
end

factory :g5_authenticatable_location_viewer_role,
parent: :g5_authenticatable_location_role do
name 'viewer'
name { 'viewer' }
end
end
20 changes: 0 additions & 20 deletions lib/g5_authenticatable/test/factory.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/g5_authenticatable/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module G5Authenticatable
VERSION = '1.1.2'
VERSION = '1.1.3.beta.1'
end

0 comments on commit 4090c8d

Please sign in to comment.