panda_pal 5.15.1.beta2 → 5.15.1.beta4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +0 -0
  3. data/Rakefile +0 -0
  4. data/app/assets/config/panda_pal_manifest.js +0 -0
  5. data/app/assets/javascripts/panda_pal/lti.js +0 -0
  6. data/app/assets/stylesheets/panda_pal/application.css +0 -0
  7. data/app/assets/stylesheets/panda_pal/lti.css +0 -0
  8. data/app/controllers/panda_pal/api_call_controller.rb +1 -2
  9. data/app/controllers/panda_pal/lti_controller.rb +1 -3
  10. data/app/controllers/panda_pal/lti_v1_p0_controller.rb +1 -3
  11. data/app/controllers/panda_pal/lti_v1_p3_controller.rb +1 -3
  12. data/app/controllers/panda_pal/{application_controller.rb → panda_pal_controller.rb} +1 -1
  13. data/app/helpers/panda_pal/application_helper.rb +0 -0
  14. data/app/jobs/panda_pal/jobs/grade_passback_job.rb +0 -0
  15. data/app/lib/lti_xml/base_platform.rb +0 -0
  16. data/app/lib/lti_xml/bridge_platform.rb +0 -0
  17. data/app/lib/lti_xml/canvas_platform.rb +0 -0
  18. data/app/lib/panda_pal/launch_url_helpers.rb +0 -0
  19. data/app/lib/panda_pal/lti_jwt_validator.rb +0 -0
  20. data/app/models/panda_pal/api_call.rb +0 -0
  21. data/app/models/panda_pal/organization_concerns/organization_builder.rb +0 -0
  22. data/app/models/panda_pal/organization_concerns/settings_validation.rb +0 -0
  23. data/app/models/panda_pal/organization_concerns/task_scheduling.rb +0 -0
  24. data/app/models/panda_pal/panda_pal_record.rb +0 -0
  25. data/app/models/panda_pal/platform.rb +0 -0
  26. data/app/views/layouts/panda_pal/application.html.erb +0 -0
  27. data/app/views/panda_pal/lti/launch.html.erb +0 -0
  28. data/app/views/panda_pal/lti_v1_p3/login.html.erb +0 -0
  29. data/app/views/panda_pal/partials/_auto_submit_form.html.erb +0 -0
  30. data/config/dev_lti_key.key +0 -0
  31. data/config/initializers/apartment.rb +32 -22
  32. data/config/routes.rb +0 -0
  33. data/db/migrate/20160412205931_create_panda_pal_organizations.rb +0 -0
  34. data/db/migrate/20160413135653_create_panda_pal_sessions.rb +0 -0
  35. data/db/migrate/20160425130344_add_panda_pal_organization_to_session.rb +0 -0
  36. data/db/migrate/20170106165533_add_salesforce_id_to_organizations.rb +0 -0
  37. data/db/migrate/20171205183457_encrypt_organization_settings.rb +0 -0
  38. data/db/migrate/20171205194657_remove_old_organization_settings.rb +0 -0
  39. data/db/migrate/20220721095653_create_panda_pal_api_calls.rb +0 -0
  40. data/lib/panda_pal/concerns/ability_helper.rb +0 -0
  41. data/lib/panda_pal/engine.rb +1 -0
  42. data/lib/panda_pal/helpers/console_helpers.rb +0 -0
  43. data/lib/panda_pal/helpers/misc_helper.rb +0 -0
  44. data/lib/panda_pal/helpers/route_helper.rb +0 -0
  45. data/lib/panda_pal/helpers/secure_headers.rb +0 -0
  46. data/lib/panda_pal/helpers.rb +0 -0
  47. data/lib/panda_pal/plugins.rb +0 -0
  48. data/lib/panda_pal/version.rb +1 -1
  49. data/lib/panda_pal.rb +0 -0
  50. data/lib/tasks/panda_pal_tasks.rake +0 -0
  51. data/panda_pal.gemspec +0 -14
  52. data/spec/controllers/panda_pal/api_call_controller_spec.rb +18 -20
  53. data/spec/core/apartment_multidb_spec.rb +1 -1
  54. data/spec/factories/panda_pal_organizations.rb +1 -1
  55. data/spec/factories/panda_pal_sessions.rb +4 -4
  56. data/spec/{dummy → internal}/config/database.yml +1 -12
  57. data/spec/{dummy → internal}/config/routes.rb +2 -1
  58. data/spec/internal/config/storage.yml +3 -0
  59. data/spec/internal/db/schema.rb +6 -0
  60. data/spec/models/panda_pal/api_call_spec.rb +1 -1
  61. data/spec/models/panda_pal/organization/settings_validation_spec.rb +1 -1
  62. data/spec/models/panda_pal/organization/task_scheduling_spec.rb +1 -1
  63. data/spec/models/panda_pal/organization_spec.rb +4 -4
  64. data/spec/models/panda_pal/session_spec.rb +1 -1
  65. data/spec/spec_helper.rb +54 -5
  66. metadata +10 -220
  67. data/spec/dummy/README.rdoc +0 -28
  68. data/spec/dummy/Rakefile +0 -6
  69. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  70. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  71. data/spec/dummy/app/bin/bundle +0 -3
  72. data/spec/dummy/app/bin/rails +0 -4
  73. data/spec/dummy/app/bin/rake +0 -4
  74. data/spec/dummy/app/bin/setup +0 -29
  75. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  76. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  77. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  78. data/spec/dummy/config/application.rb +0 -29
  79. data/spec/dummy/config/boot.rb +0 -5
  80. data/spec/dummy/config/environment.rb +0 -5
  81. data/spec/dummy/config/environments/development.rb +0 -27
  82. data/spec/dummy/config/environments/production.rb +0 -68
  83. data/spec/dummy/config/environments/test.rb +0 -47
  84. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  85. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  86. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  87. data/spec/dummy/config/initializers/inflections.rb +0 -16
  88. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  89. data/spec/dummy/config/initializers/session_store.rb +0 -3
  90. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  91. data/spec/dummy/config/locales/en.yml +0 -23
  92. data/spec/dummy/config/secrets.yml +0 -22
  93. data/spec/dummy/config.ru +0 -4
  94. data/spec/dummy/db/schema.rb +0 -49
  95. data/spec/dummy/db/test2_schema.rb +0 -49
  96. data/spec/dummy/public/404.html +0 -67
  97. data/spec/dummy/public/422.html +0 -67
  98. data/spec/dummy/public/500.html +0 -66
  99. data/spec/dummy/public/favicon.ico +0 -0
  100. data/spec/rails_helper.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bccb0af3b5fde8625ec6005b16d8264e1f21df5bb38a317c2a860c69d80a2288
4
- data.tar.gz: 7118ce4073237a09f89f0e724e5dc10ef355e1e51abbcb5be86ce530016c1599
3
+ metadata.gz: cc92de1f76650accfff8d4ecc7de8ce545f3e544d145cee1b96625b10dfa7344
4
+ data.tar.gz: 8a981b6f9106d445cbb6c133a3aa992ab268c74eb63c1bedcecab7874c0ccfde
5
5
  SHA512:
6
- metadata.gz: 056f0b2030a2464851ca8761537602bf1d132b68fed4f9d0ed047020052f4cb7a96e2ac07c6e07d605fa1bf903b75e8139eb9bcbbc807f71b8b9d92258ea4eff
7
- data.tar.gz: '0515690ad2446026702ca536e98a745a1a450f498922613024aea7541c8f9b4658608b3d3086cc50b166cd04c92de1a37bad6153aee2abc8a1050aba301c8d87'
6
+ metadata.gz: 73669c16287ed12c5a371549bb093b3e9ad815dd25d646fb46770be776fd30ae956ba5205cbbc9f26dd7358d50595fa30ba6a078b601ceb4d535902f331c9360
7
+ data.tar.gz: 9715f5c8c0a7c3ca84e690a337aec8cb41961a32afb1f7caa749c2d67ed0822422d508ced453d7309efd12f3d0f6d10a39c7ffa187a75061fdb947bc35a08784
data/MIT-LICENSE CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,8 +1,7 @@
1
1
  require 'jwt'
2
- require_dependency "panda_pal/application_controller"
3
2
 
4
3
  module PandaPal
5
- class ApiCallController < ApplicationController
4
+ class ApiCallController < PandaPalController
6
5
  rescue_from StandardError do |err|
7
6
  render json: { status: 'error' }, status: 500
8
7
  end
@@ -1,6 +1,4 @@
1
- require_dependency "panda_pal/application_controller"
2
-
3
1
  module PandaPal
4
- class LtiController < ApplicationController
2
+ class LtiController < PandaPalController
5
3
  end
6
4
  end
@@ -1,7 +1,5 @@
1
- require_dependency "panda_pal/application_controller"
2
-
3
1
  module PandaPal
4
- class LtiV1P0Controller < ApplicationController
2
+ class LtiV1P0Controller < PandaPalController
5
3
  if Rails.version < '5.0'
6
4
  skip_before_action :verify_authenticity_token
7
5
  else
@@ -1,7 +1,5 @@
1
- require_dependency "panda_pal/application_controller"
2
-
3
1
  module PandaPal
4
- class LtiV1P3Controller < ApplicationController
2
+ class LtiV1P3Controller < PandaPalController
5
3
  if Rails.version < '5.0'
6
4
  skip_before_action :verify_authenticity_token
7
5
  else
@@ -1,5 +1,5 @@
1
1
  module PandaPal
2
- class ApplicationController < ActionController::Base
2
+ class PandaPalController < ActionController::Base
3
3
  around_action :share_controller_on_thread
4
4
 
5
5
  def share_controller_on_thread
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -10,25 +10,29 @@ require "apartment/adapters/postgresql_adapter"
10
10
  module Apartment
11
11
  SHARD_PREFIXES = ["SHARD_DB", "HEROKU_POSTGRESQL"]
12
12
 
13
- def self.shard_configurations
14
- $shard_configurations ||= begin
15
- shard_to_env = {}
13
+ class << self
14
+ def_delegators :connection_class, :connected?
16
15
 
17
- base_config = ActiveRecord::Base.configurations.find_db_config(Rails.env).configuration_hash
16
+ def shard_configurations
17
+ $shard_configurations ||= begin
18
+ shard_to_env = {}
18
19
 
19
- ENV.keys.each do |k|
20
- m = /^(#{SHARD_PREFIXES.join("|")})_(\w+)_URL$/.match(k)
21
- next unless m
20
+ base_config = ActiveRecord::Base.configurations.find_db_config(Rails.env).configuration_hash
22
21
 
23
- url = ENV[k]
24
- shardcfg = ActiveRecord::Base.configurations.resolve(url).configuration_hash
25
- shardcfg = base_config.merge(shardcfg || {})
26
- shard_to_env[m[2].downcase] = shardcfg
27
- end
22
+ ENV.keys.each do |k|
23
+ m = /^(#{SHARD_PREFIXES.join("|")})_(\w+)_URL$/.match(k)
24
+ next unless m
25
+
26
+ url = ENV[k]
27
+ shardcfg = ActiveRecord::Base.configurations.resolve(url).configuration_hash
28
+ shardcfg = base_config.merge(shardcfg || {})
29
+ shard_to_env[m[2].downcase] = shardcfg
30
+ end
28
31
 
29
- shard_to_env.freeze unless Rails.env.test?
32
+ shard_to_env.freeze unless Rails.env.test?
30
33
 
31
- shard_to_env
34
+ shard_to_env
35
+ end
32
36
  end
33
37
  end
34
38
 
@@ -120,14 +124,12 @@ module Apartment
120
124
 
121
125
  raise ActiveRecord::StatementInvalid, "PandaPal/Apartment Mutli-DB support does not currently support DB roles" if ActiveRecord::Base.current_role != ActiveRecord::Base.default_role
122
126
 
123
- unless ActiveRecord::Base.connected?
124
- Apartment.establish_connection multi_tenantify(tenant, false)
125
- Apartment.connection.verify!
126
- end
127
-
127
+ shard, schema = Apartment::Tenant.split_tenant(@current)
128
+ Apartment.establish_connection(multi_tenantify(tenant, false)) unless shard == "default" || Apartment.connected?
129
+ Apartment.connection.verify!
128
130
  Apartment.connection.enable_query_cache! if query_cache_enabled
129
131
 
130
- raise ActiveRecord::StatementInvalid, "Could not find schema for tenant #{tenant} (#{tenant_schemas.inspect})" unless schema_exists?(tenant_schemas)
132
+ raise ActiveRecord::StatementInvalid, "Could not find schema for tenant \"#{tenant}\": (#{tenant_schemas.inspect})" unless schema_exists?(tenant_schemas)
131
133
 
132
134
  Apartment.connection.schema_search_path = full_search_path
133
135
  rescue *rescuable_exceptions => e
@@ -150,6 +152,14 @@ module Apartment
150
152
  schema
151
153
  end
152
154
  end
155
+
156
+ def raise_schema_connect_to_new(tenant, exception)
157
+ shard, schema = Tenant.split_tenant(tenant)
158
+ raise TenantNotFound, <<~EXCEPTION_MESSAGE
159
+ Could not set search path to schemas, they may be invalid: "#{schema}" #{full_search_path}.
160
+ Original error: #{exception.class}: #{exception}
161
+ EXCEPTION_MESSAGE
162
+ end
153
163
  end
154
164
  end
155
165
 
@@ -181,7 +191,7 @@ module Apartment
181
191
  # to effectively disable this patch for that model.
182
192
  if (adapter = Thread.current[:apartment_adapter]) && adapter.is_a?(Apartment::Adapters::PostgresMultiDBSchemaAdapter) && !adapter.is_excluded_model?(self)
183
193
  shard, schema = Apartment::Tenant.split_tenant(adapter.current)
184
- return "#{shard}" unless shard == "default"
194
+ return "apt:#{shard}" unless shard == "default"
185
195
  end
186
196
 
187
197
  pre_apartment_current_shard
@@ -210,7 +220,7 @@ Apartment.configure do |config|
210
220
  shard_configurations = Apartment.shard_configurations
211
221
 
212
222
  PandaPal::Organization.all.to_a.each_with_object({}) do |org, hash|
213
- shard = org.shard || "default"
223
+ shard = org.shard.to_s || "default"
214
224
  hash[org.tenant_name] = shard == "default" ? base_config : shard_configurations[shard.downcase]
215
225
  end
216
226
  else
data/config/routes.rb CHANGED
File without changes
File without changes
@@ -1,3 +1,4 @@
1
+ require 'rails'
1
2
  require 'apartment'
2
3
  require 'ims/lti'
3
4
  require 'attr_encrypted'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module PandaPal
2
- VERSION = "5.15.1.beta2"
2
+ VERSION = "5.15.1.beta4"
3
3
  end
data/lib/panda_pal.rb CHANGED
File without changes
File without changes
data/panda_pal.gemspec CHANGED
@@ -29,18 +29,4 @@ Gem::Specification.new do |s|
29
29
  s.add_dependency 'json-jwt'
30
30
  s.add_dependency 'jwt'
31
31
  s.add_dependency 'httparty'
32
-
33
- s.add_development_dependency "rails", "~> 7.0"
34
- s.add_development_dependency 'pg'
35
- s.add_development_dependency 'sidekiq', "< 7.0"
36
- s.add_development_dependency 'sidekiq-scheduler'
37
- s.add_development_dependency 'ros-apartment', '~> 3.0'
38
- s.add_development_dependency 'ros-apartment-sidekiq', '~> 1.2'
39
- s.add_development_dependency 'rspec-rails'
40
- s.add_development_dependency 'factory_girl_rails'
41
-
42
- s.add_development_dependency "redis", ">=4.2", "< 5.0"
43
-
44
- # TODO See https://github.com/mikel/mail/issues/1489
45
- s.add_development_dependency "mail", "2.7.1"
46
32
  end
@@ -1,27 +1,25 @@
1
- require 'rails_helper'
1
+ require 'spec_helper'
2
2
 
3
- module PandaPal
4
- RSpec.describe ApiCallController, type: :controller do
5
- let!(:api_call) { ApiCall.create!(logic: '"#{p[:foo]}_bar"') }
3
+ RSpec.describe PandaPal::ApiCallController, type: :controller do
4
+ let!(:api_call) { PandaPal::ApiCall.create!(logic: '"#{p[:foo]}_bar"') }
6
5
 
7
- def json_body
8
- JSON.parse(response.body)
9
- end
6
+ def json_body
7
+ JSON.parse(response.body)
8
+ end
10
9
 
11
- describe "#call" do
12
- it "calls the function with parameters" do
13
- get :call, params: { token: api_call.jwt_token, foo: 'bar', use_route: 'panda_pal' }
14
- expect(response).to be_successful
15
- expect(json_body["status"]).to eq 'ok'
16
- expect(json_body["result"]).to eq 'bar_bar'
17
- end
10
+ describe "#call" do
11
+ it "calls the function with parameters" do
12
+ get :call, params: { token: api_call.jwt_token, foo: 'bar', use_route: 'panda_pal' }
13
+ expect(response).to be_successful
14
+ expect(json_body["status"]).to eq 'ok'
15
+ expect(json_body["result"]).to eq 'bar_bar'
16
+ end
18
17
 
19
- it "fails given a bad JWT" do
20
- get :call, params: { token: "bad.jwt.token", foo: 'bar', use_route: 'panda_pal' }
21
- expect(response).not_to be_successful
22
- expect(json_body["status"]).to eq 'error'
23
- expect(json_body["error"]).to eq 'Invalid JWT'
24
- end
18
+ it "fails given a bad JWT" do
19
+ get :call, params: { token: "bad.jwt.token", foo: 'bar', use_route: 'panda_pal' }
20
+ expect(response).not_to be_successful
21
+ expect(json_body["status"]).to eq 'error'
22
+ expect(json_body["error"]).to eq 'Invalid JWT'
25
23
  end
26
24
  end
27
25
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails_helper'
3
+ require 'spec_helper'
4
4
 
5
5
  RSpec.describe PandaPal::Organization, type: :model do
6
6
  context "across multiple DBs" do
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :panda_pal_organization, class: 'PandaPal::Organization' do
3
3
  name { SecureRandom.hex }
4
4
  key { SecureRandom.hex }
@@ -1,7 +1,7 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :panda_pal_session, class: 'PandaPal::Session' do
3
- session_secret "MyString"
4
- organization nil
5
- data "MyText"
3
+ session_secret { "MyString" }
4
+ organization { nil }
5
+ data { "MyText" }
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
-
2
1
  default: &default
2
+ database: panda-pal-test
3
3
  adapter: postgresql
4
4
  encoding: unicode
5
5
  # For details on connection pooling, see Rails configuration guide
@@ -9,10 +9,6 @@ default: &default
9
9
  password: <%= ENV.fetch("DB_PASSWORD", "") %>
10
10
  host: <%= ENV.fetch("DB_ADDRESS", "localhost") %>
11
11
 
12
- development:
13
- <<: *default
14
- database: panda_pal_development
15
-
16
12
  test:
17
13
  test1:
18
14
  <<: *default
@@ -20,10 +16,3 @@ test:
20
16
  test2:
21
17
  <<: *default
22
18
  database: panda_pal_test2
23
-
24
- production:
25
- <<: *default
26
- host: <%= ENV.fetch('DB_ADDRESS', 'localhost') %>
27
- database: panda_pal_production
28
- username: <%= ENV.fetch("DB_USERNAME", "panda_pal_specs_postgres_user") %>
29
- password: <%= ENV.fetch("DB_PASSWORD", 'panda_pal_specs_postgres_password') %>
@@ -1,4 +1,5 @@
1
- Rails.application.routes.draw do
1
+ # frozen_string_literal: true
2
2
 
3
+ Rails.application.routes.draw do
3
4
  mount PandaPal::Engine => "/panda_pal"
4
5
  end
@@ -0,0 +1,3 @@
1
+ test:
2
+ service: Disk
3
+ root: /Users/eknapp/code/panda_pal/tmp/storage
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ ActiveRecord::Schema.define do
4
+ # Set up any tables you need to exist for your test suite that don't belong
5
+ # in migrations.
6
+ end
@@ -1,4 +1,4 @@
1
- require 'rails_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module PandaPal
4
4
  RSpec.describe ApiCall, type: :model do
@@ -1,4 +1,4 @@
1
- require 'rails_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module PandaPal
4
4
  PandaPal::Organization
@@ -1,4 +1,4 @@
1
- require 'rails_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module PandaPal
4
4
  PandaPal::Organization
@@ -1,15 +1,15 @@
1
- require 'rails_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module PandaPal
4
4
  RSpec.describe Organization, type: :model do
5
5
  it 'creates a schema upon creation' do
6
- expect(Apartment::Tenant).to receive(:create)
6
+ expect(Apartment::Tenant).to receive(:create).and_call_original
7
7
  create :panda_pal_organization
8
8
  end
9
9
 
10
10
  it 'deletes a schema upon deletion' do
11
- expect(Apartment::Tenant).to receive(:create)
12
- expect(Apartment::Tenant).to receive(:drop)
11
+ expect(Apartment::Tenant).to receive(:create).and_call_original
12
+ expect(Apartment::Tenant).to receive(:drop).and_call_original
13
13
  org = create :panda_pal_organization
14
14
  org.destroy
15
15
  end
@@ -1,4 +1,4 @@
1
- require 'rails_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module PandaPal
4
4
  RSpec.describe Session, type: :model do
data/spec/spec_helper.rb CHANGED
@@ -1,19 +1,40 @@
1
- ENV["RAILS_ENV"] ||= 'test'
1
+ # ENV["RAILS_ENV"] ||= 'test'
2
2
 
3
+ require 'bundler'
4
+ Bundler.require :default, :development
5
+
6
+ Combustion.initialize! :active_record, :active_job, :action_controller
7
+
8
+ require 'sidekiq'
9
+ require 'sidekiq/rails'
3
10
  require 'sidekiq/testing'
4
11
  require 'sidekiq-scheduler'
5
12
 
6
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
7
13
  require 'rspec/rails'
8
14
  require 'rspec/autorun'
9
15
  require 'nokogiri'
10
- require 'factory_girl_rails'
16
+ require 'factory_bot_rails'
17
+
18
+ require "panda_pal/spec_helper"
11
19
 
12
- ActiveRecord::Migration.maintain_test_schema!
13
20
  ActiveRecord::Schema.verbose = false
14
21
 
22
+ Dir[File.dirname(__FILE__) + "/factories/**/*.rb"].each {|f| require f }
23
+
15
24
  RSpec.configure do |config|
16
- config.include FactoryGirl::Syntax::Methods
25
+ config.include PandaPal::SpecHelper
26
+ config.include FactoryBot::Syntax::Methods
27
+
28
+ config.before(:each) do
29
+ allow_any_instance_of(PandaPal::Organization).to receive(:create_schema).and_wrap_original do |m, *args|
30
+ org = m.receiver
31
+ m.call(*args)
32
+ org.switch_tenant do
33
+ Combustion::Database::LoadSchema.call
34
+ Combustion::Database::Migrate.call
35
+ end
36
+ end
37
+ end
17
38
 
18
39
  # rspec-expectations config goes here. You can use an alternate
19
40
  # assertion/expectation library such as wrong or the stdlib/minitest
@@ -45,6 +66,34 @@ RSpec.configure do |config|
45
66
  }
46
67
  end
47
68
 
69
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
70
+ config.fixture_paths |= [
71
+ "#{::Rails.root}/spec/fixtures"
72
+ ]
73
+
74
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
75
+ # examples within a transaction, remove the following line or assign false
76
+ # instead of true.
77
+ config.use_transactional_fixtures = true
78
+
79
+ # RSpec Rails can automatically mix in different behaviours to your tests
80
+ # based on their file location, for example enabling you to call `get` and
81
+ # `post` in specs under `spec/controllers`.
82
+ #
83
+ # You can disable this behaviour by removing the line below, and instead
84
+ # explicitly tag your specs with their type, e.g.:
85
+ #
86
+ # RSpec.describe UsersController, :type => :controller do
87
+ # # ...
88
+ # end
89
+ #
90
+ # The different available types are documented in the features, such as in
91
+ # https://relishapp.com/rspec/rspec-rails/docs
92
+ config.infer_spec_type_from_file_location!
93
+
94
+ # Filter lines from Rails gems in backtraces.
95
+ config.filter_rails_from_backtrace!
96
+
48
97
  # The settings below are suggested to provide a good initial experience
49
98
  # with RSpec, but feel free to customize to your heart's content.
50
99
  =begin