ros-apartment 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/.rubocop-linter.yml +22 -0
  3. data/.pryrc +5 -3
  4. data/.rubocop.yml +17 -0
  5. data/.rubocop_todo.yml +29 -0
  6. data/.story_branch.yml +4 -0
  7. data/.travis.yml +12 -11
  8. data/Appraisals +18 -18
  9. data/Gemfile +4 -1
  10. data/README.md +33 -5
  11. data/Rakefile +2 -0
  12. data/apartment.gemspec +6 -6
  13. data/gemfiles/rails_4_2.gemfile +12 -10
  14. data/gemfiles/rails_5_0.gemfile +11 -9
  15. data/gemfiles/rails_5_1.gemfile +11 -9
  16. data/gemfiles/rails_5_2.gemfile +10 -8
  17. data/gemfiles/rails_6_0.gemfile +11 -9
  18. data/gemfiles/rails_master.gemfile +11 -9
  19. data/lib/apartment/adapters/abstract_adapter.rb +34 -34
  20. data/lib/apartment/adapters/abstract_jdbc_adapter.rb +4 -3
  21. data/lib/apartment/adapters/jdbc_mysql_adapter.rb +3 -3
  22. data/lib/apartment/adapters/jdbc_postgresql_adapter.rb +13 -11
  23. data/lib/apartment/adapters/mysql2_adapter.rb +10 -9
  24. data/lib/apartment/adapters/postgis_adapter.rb +3 -2
  25. data/lib/apartment/adapters/postgresql_adapter.rb +28 -25
  26. data/lib/apartment/adapters/sqlite3_adapter.rb +16 -8
  27. data/lib/apartment/console.rb +28 -3
  28. data/lib/apartment/custom_console.rb +26 -0
  29. data/lib/apartment/deprecation.rb +2 -1
  30. data/lib/apartment/elevators/domain.rb +4 -3
  31. data/lib/apartment/elevators/first_subdomain.rb +3 -2
  32. data/lib/apartment/elevators/generic.rb +4 -3
  33. data/lib/apartment/elevators/host.rb +6 -1
  34. data/lib/apartment/elevators/host_hash.rb +6 -2
  35. data/lib/apartment/elevators/subdomain.rb +9 -5
  36. data/lib/apartment/migrator.rb +4 -3
  37. data/lib/apartment/railtie.rb +13 -5
  38. data/lib/apartment/reloader.rb +2 -1
  39. data/lib/apartment/tasks/enhancements.rb +4 -6
  40. data/lib/apartment/tenant.rb +3 -4
  41. data/lib/apartment/version.rb +3 -1
  42. data/lib/apartment.rb +15 -9
  43. data/lib/generators/apartment/install/install_generator.rb +4 -3
  44. data/lib/generators/apartment/install/templates/apartment.rb +3 -2
  45. data/lib/tasks/apartment.rake +19 -18
  46. data/spec/adapters/jdbc_mysql_adapter_spec.rb +5 -4
  47. data/spec/adapters/jdbc_postgresql_adapter_spec.rb +10 -12
  48. data/spec/adapters/mysql2_adapter_spec.rb +15 -13
  49. data/spec/adapters/postgresql_adapter_spec.rb +22 -20
  50. data/spec/adapters/sqlite3_adapter_spec.rb +41 -23
  51. data/spec/apartment_spec.rb +4 -2
  52. data/spec/dummy/app/controllers/application_controller.rb +4 -3
  53. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  54. data/spec/dummy/app/models/application_record.rb +6 -0
  55. data/spec/dummy/app/models/company.rb +4 -2
  56. data/spec/dummy/app/models/user.rb +4 -2
  57. data/spec/dummy/config/application.rb +11 -9
  58. data/spec/dummy/config/boot.rb +4 -2
  59. data/spec/dummy/config/environment.rb +3 -1
  60. data/spec/dummy/config/environments/development.rb +2 -1
  61. data/spec/dummy/config/environments/production.rb +3 -1
  62. data/spec/dummy/config/environments/test.rb +3 -1
  63. data/spec/dummy/config/initializers/apartment.rb +4 -2
  64. data/spec/dummy/config/initializers/backtrace_silencers.rb +1 -0
  65. data/spec/dummy/config/initializers/inflections.rb +1 -0
  66. data/spec/dummy/config/initializers/mime_types.rb +1 -0
  67. data/spec/dummy/config/initializers/secret_token.rb +2 -0
  68. data/spec/dummy/config/initializers/session_store.rb +3 -1
  69. data/spec/dummy/config/routes.rb +3 -1
  70. data/spec/dummy/config.ru +3 -1
  71. data/spec/dummy/db/seeds/import.rb +3 -1
  72. data/spec/dummy/script/rails +4 -2
  73. data/spec/dummy_engine/config/initializers/apartment.rb +4 -3
  74. data/spec/dummy_engine/lib/dummy_engine/engine.rb +2 -0
  75. data/spec/dummy_engine/lib/dummy_engine/version.rb +3 -1
  76. data/spec/dummy_engine/lib/dummy_engine.rb +3 -1
  77. data/spec/dummy_engine/test/dummy/config/application.rb +4 -2
  78. data/spec/dummy_engine/test/dummy/config/boot.rb +4 -2
  79. data/spec/dummy_engine/test/dummy/config/environment.rb +3 -1
  80. data/spec/dummy_engine/test/dummy/config/environments/development.rb +2 -0
  81. data/spec/dummy_engine/test/dummy/config/environments/production.rb +2 -0
  82. data/spec/dummy_engine/test/dummy/config/environments/test.rb +2 -0
  83. data/spec/dummy_engine/test/dummy/config/initializers/assets.rb +2 -0
  84. data/spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb +1 -0
  85. data/spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb +3 -1
  86. data/spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb +2 -0
  87. data/spec/dummy_engine/test/dummy/config/initializers/inflections.rb +1 -0
  88. data/spec/dummy_engine/test/dummy/config/initializers/mime_types.rb +1 -0
  89. data/spec/dummy_engine/test/dummy/config/initializers/session_store.rb +2 -0
  90. data/spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb +2 -0
  91. data/spec/dummy_engine/test/dummy/config/routes.rb +2 -0
  92. data/spec/dummy_engine/test/dummy/config.ru +3 -1
  93. data/spec/examples/connection_adapter_examples.rb +15 -13
  94. data/spec/examples/generic_adapter_custom_configuration_example.rb +21 -23
  95. data/spec/examples/generic_adapter_examples.rb +40 -39
  96. data/spec/examples/schema_adapter_examples.rb +93 -88
  97. data/spec/integration/apartment_rake_integration_spec.rb +24 -24
  98. data/spec/integration/query_caching_spec.rb +10 -8
  99. data/spec/integration/use_within_an_engine_spec.rb +5 -5
  100. data/spec/schemas/v1.rb +2 -3
  101. data/spec/schemas/v2.rb +22 -24
  102. data/spec/schemas/v3.rb +26 -28
  103. data/spec/spec_helper.rb +8 -6
  104. data/spec/support/apartment_helpers.rb +9 -5
  105. data/spec/support/capybara_sessions.rb +5 -5
  106. data/spec/support/config.rb +5 -2
  107. data/spec/support/contexts.rb +10 -8
  108. data/spec/support/requirements.rb +19 -6
  109. data/spec/support/setup.rb +5 -5
  110. data/spec/tasks/apartment_rake_spec.rb +30 -35
  111. data/spec/tenant_spec.rb +48 -44
  112. data/spec/unit/config_spec.rb +26 -27
  113. data/spec/unit/elevators/domain_spec.rb +9 -8
  114. data/spec/unit/elevators/first_subdomain_spec.rb +14 -12
  115. data/spec/unit/elevators/generic_spec.rb +16 -15
  116. data/spec/unit/elevators/host_hash_spec.rb +9 -8
  117. data/spec/unit/elevators/host_spec.rb +26 -26
  118. data/spec/unit/elevators/subdomain_spec.rb +24 -23
  119. data/spec/unit/migrator_spec.rb +18 -17
  120. data/spec/unit/reloader_spec.rb +8 -8
  121. metadata +40 -22
@@ -1,39 +1,42 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'apartment/adapters/postgresql_adapter'
3
5
 
4
6
  describe Apartment::Adapters::PostgresqlAdapter, database: :postgresql do
5
7
  unless defined?(JRUBY_VERSION)
6
8
 
7
- subject{ Apartment::Tenant.postgresql_adapter config }
8
-
9
- context "using schemas with schema.rb" do
9
+ subject { Apartment::Tenant.postgresql_adapter config }
10
10
 
11
- before{ Apartment.use_schemas = true }
11
+ context 'using schemas with schema.rb' do
12
+ before { Apartment.use_schemas = true }
12
13
 
13
14
  # Not sure why, but somehow using let(:tenant_names) memoizes for the whole example group, not just each test
14
15
  def tenant_names
15
- ActiveRecord::Base.connection.execute("SELECT nspname FROM pg_namespace;").collect { |row| row['nspname'] }
16
+ ActiveRecord::Base.connection.execute('SELECT nspname FROM pg_namespace;').collect { |row| row['nspname'] }
16
17
  end
17
18
 
18
19
  let(:default_tenant) { subject.switch { ActiveRecord::Base.connection.schema_search_path.gsub('"', '') } }
19
20
 
20
- it_should_behave_like "a generic apartment adapter"
21
- it_should_behave_like "a schema based apartment adapter"
21
+ it_should_behave_like 'a generic apartment adapter'
22
+ it_should_behave_like 'a schema based apartment adapter'
22
23
  end
23
24
 
24
- context "using schemas with SQL dump" do
25
-
26
- before{ Apartment.use_schemas = true; Apartment.use_sql = true }
25
+ context 'using schemas with SQL dump' do
26
+ before do
27
+ Apartment.use_schemas = true
28
+ Apartment.use_sql = true
29
+ end
27
30
 
28
31
  # Not sure why, but somehow using let(:tenant_names) memoizes for the whole example group, not just each test
29
32
  def tenant_names
30
- ActiveRecord::Base.connection.execute("SELECT nspname FROM pg_namespace;").collect { |row| row['nspname'] }
33
+ ActiveRecord::Base.connection.execute('SELECT nspname FROM pg_namespace;').collect { |row| row['nspname'] }
31
34
  end
32
35
 
33
36
  let(:default_tenant) { subject.switch { ActiveRecord::Base.connection.schema_search_path.gsub('"', '') } }
34
37
 
35
- it_should_behave_like "a generic apartment adapter"
36
- it_should_behave_like "a schema based apartment adapter"
38
+ it_should_behave_like 'a generic apartment adapter'
39
+ it_should_behave_like 'a schema based apartment adapter'
37
40
 
38
41
  it 'allows for dashes in the schema name' do
39
42
  expect { Apartment::Tenant.create('has-dashes') }.to_not raise_error
@@ -42,20 +45,19 @@ describe Apartment::Adapters::PostgresqlAdapter, database: :postgresql do
42
45
  after { Apartment::Tenant.drop('has-dashes') if Apartment.connection.schema_exists? 'has-dashes' }
43
46
  end
44
47
 
45
- context "using connections" do
46
-
47
- before{ Apartment.use_schemas = false }
48
+ context 'using connections' do
49
+ before { Apartment.use_schemas = false }
48
50
 
49
51
  # Not sure why, but somehow using let(:tenant_names) memoizes for the whole example group, not just each test
50
52
  def tenant_names
51
- connection.execute("select datname from pg_database;").collect { |row| row['datname'] }
53
+ connection.execute('select datname from pg_database;').collect { |row| row['datname'] }
52
54
  end
53
55
 
54
56
  let(:default_tenant) { subject.switch { ActiveRecord::Base.connection.current_database } }
55
57
 
56
- it_should_behave_like "a generic apartment adapter"
57
- it_should_behave_like "a generic apartment adapter able to handle custom configuration"
58
- it_should_behave_like "a connection based apartment adapter"
58
+ it_should_behave_like 'a generic apartment adapter'
59
+ it_should_behave_like 'a generic apartment adapter able to handle custom configuration'
60
+ it_should_behave_like 'a connection based apartment adapter'
59
61
  end
60
62
  end
61
63
  end
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'apartment/adapters/sqlite3_adapter'
3
5
 
4
6
  describe Apartment::Adapters::Sqlite3Adapter, database: :sqlite do
5
7
  unless defined?(JRUBY_VERSION)
6
8
 
7
- subject{ Apartment::Tenant.sqlite3_adapter config }
9
+ subject { Apartment::Tenant.sqlite3_adapter config }
8
10
 
9
- context "using connections" do
11
+ context 'using connections' do
10
12
  def tenant_names
11
- db_dir = File.expand_path("../../dummy/db", __FILE__)
13
+ db_dir = File.expand_path('../dummy/db', __dir__)
12
14
  Dir.glob("#{db_dir}/*.sqlite3").map { |file| File.basename(file, '.sqlite3') }
13
15
  end
14
16
 
@@ -16,18 +18,18 @@ describe Apartment::Adapters::Sqlite3Adapter, database: :sqlite do
16
18
  subject.switch { File.basename(Apartment::Test.config['connections']['sqlite']['database'], '.sqlite3') }
17
19
  end
18
20
 
19
- it_should_behave_like "a generic apartment adapter"
20
- it_should_behave_like "a connection based apartment adapter"
21
+ it_should_behave_like 'a generic apartment adapter'
22
+ it_should_behave_like 'a connection based apartment adapter'
21
23
 
22
24
  after(:all) do
23
25
  File.delete(Apartment::Test.config['connections']['sqlite']['database'])
24
26
  end
25
27
  end
26
28
 
27
- context "with prepend and append" do
29
+ context 'with prepend and append' do
28
30
  let(:default_dir) { File.expand_path(File.dirname(config[:database])) }
29
- describe "#prepend" do
30
- let (:db_name) { "db_with_prefix" }
31
+ describe '#prepend' do
32
+ let(:db_name) { 'db_with_prefix' }
31
33
  before do
32
34
  Apartment.configure do |config|
33
35
  config.prepend_environment = true
@@ -35,32 +37,44 @@ describe Apartment::Adapters::Sqlite3Adapter, database: :sqlite do
35
37
  end
36
38
  end
37
39
 
38
- after { subject.drop db_name rescue nil }
40
+ after do
41
+ begin
42
+ subject.drop db_name
43
+ rescue StandardError => _e
44
+ nil
45
+ end
46
+ end
39
47
 
40
- it "should create a new database" do
48
+ it 'should create a new database' do
41
49
  subject.create db_name
42
50
 
43
- expect(File.exists?("#{default_dir}/#{Rails.env}_#{db_name}.sqlite3")).to eq true
51
+ expect(File.exist?("#{default_dir}/#{Rails.env}_#{db_name}.sqlite3")).to eq true
44
52
  end
45
53
  end
46
54
 
47
- describe "#neither" do
48
- let (:db_name) { "db_without_prefix_suffix" }
55
+ describe '#neither' do
56
+ let(:db_name) { 'db_without_prefix_suffix' }
49
57
  before do
50
58
  Apartment.configure { |config| config.prepend_environment = config.append_environment = false }
51
59
  end
52
60
 
53
- after { subject.drop db_name rescue nil }
61
+ after do
62
+ begin
63
+ subject.drop db_name
64
+ rescue StandardError => _e
65
+ nil
66
+ end
67
+ end
54
68
 
55
- it "should create a new database" do
69
+ it 'should create a new database' do
56
70
  subject.create db_name
57
71
 
58
- expect(File.exists?("#{default_dir}/#{db_name}.sqlite3")).to eq true
72
+ expect(File.exist?("#{default_dir}/#{db_name}.sqlite3")).to eq true
59
73
  end
60
74
  end
61
75
 
62
- describe "#append" do
63
- let (:db_name) { "db_with_suffix" }
76
+ describe '#append' do
77
+ let(:db_name) { 'db_with_suffix' }
64
78
  before do
65
79
  Apartment.configure do |config|
66
80
  config.prepend_environment = false
@@ -68,16 +82,20 @@ describe Apartment::Adapters::Sqlite3Adapter, database: :sqlite do
68
82
  end
69
83
  end
70
84
 
71
- after { subject.drop db_name rescue nil }
85
+ after do
86
+ begin
87
+ subject.drop db_name
88
+ rescue StandardError => _e
89
+ nil
90
+ end
91
+ end
72
92
 
73
- it "should create a new database" do
93
+ it 'should create a new database' do
74
94
  subject.create db_name
75
95
 
76
- expect(File.exists?("#{default_dir}/#{db_name}_#{Rails.env}.sqlite3")).to eq true
96
+ expect(File.exist?("#{default_dir}/#{db_name}_#{Rails.env}.sqlite3")).to eq true
77
97
  end
78
98
  end
79
-
80
99
  end
81
-
82
100
  end
83
101
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Apartment do
4
- it "should be valid" do
6
+ it 'should be valid' do
5
7
  expect(Apartment).to be_a(Module)
6
8
  end
7
9
 
8
- it "should be a valid app" do
10
+ it 'should be a valid app' do
9
11
  expect(::Rails.application).to be_a(Dummy::Application)
10
12
  end
11
13
  end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ApplicationController < ActionController::Base
2
4
  protect_from_forgery
3
-
4
- def index
5
- end
5
+
6
+ def index; end
6
7
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ApplicationHelper
2
4
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # NOTE: Dummy model base
4
+ class ApplicationRecord < ActiveRecord::Base
5
+ self.abstract_class = true
6
+ end
@@ -1,3 +1,5 @@
1
- class Company < ActiveRecord::Base
1
+ # frozen_string_literal: true
2
+
3
+ class Company < ApplicationRecord
2
4
  # Dummy models
3
- end
5
+ end
@@ -1,3 +1,5 @@
1
- class User < ActiveRecord::Base
1
+ # frozen_string_literal: true
2
+
3
+ class User < ApplicationRecord
2
4
  # Dummy models
3
- end
5
+ end
@@ -1,13 +1,15 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ # frozen_string_literal: true
2
2
 
3
- require "active_model/railtie"
4
- require "active_record/railtie"
5
- require "action_controller/railtie"
6
- require "action_view/railtie"
7
- require "action_mailer/railtie"
3
+ require File.expand_path('boot', __dir__)
4
+
5
+ require 'active_model/railtie'
6
+ require 'active_record/railtie'
7
+ require 'action_controller/railtie'
8
+ require 'action_view/railtie'
9
+ require 'action_mailer/railtie'
8
10
 
9
11
  Bundler.require
10
- require "apartment"
12
+ require 'apartment'
11
13
 
12
14
  module Dummy
13
15
  class Application < Rails::Application
@@ -20,7 +22,7 @@ module Dummy
20
22
  config.middleware.use Apartment::Elevators::Subdomain
21
23
 
22
24
  # Custom directories with classes and modules you want to be autoloadable.
23
- config.autoload_paths += %W(#{config.root}/lib)
25
+ config.autoload_paths += %W[#{config.root}/lib]
24
26
 
25
27
  # Only load the plugins named here, in the order given (default is alphabetical).
26
28
  # :all can be used as a placeholder for all plugins not explicitly named.
@@ -41,7 +43,7 @@ module Dummy
41
43
  # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
42
44
 
43
45
  # Configure the default encoding used in templates for Ruby 1.9.
44
- config.encoding = "utf-8"
46
+ config.encoding = 'utf-8'
45
47
 
46
48
  # Configure sensitive parameters which will be filtered from the log file.
47
49
  config.filter_parameters += [:password]
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
 
3
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
5
+ gemfile = File.expand_path('../../../Gemfile', __dir__)
4
6
 
5
7
  if File.exist?(gemfile)
6
8
  ENV['BUNDLE_GEMFILE'] = gemfile
@@ -8,4 +10,4 @@ if File.exist?(gemfile)
8
10
  Bundler.setup
9
11
  end
10
12
 
11
- $:.unshift File.expand_path('../../../../lib', __FILE__)
13
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Load the rails application
2
- require File.expand_path('../application', __FILE__)
4
+ require File.expand_path('application', __dir__)
3
5
 
4
6
  # Initialize the rails application
5
7
  Dummy::Application.initialize!
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Dummy::Application.configure do
2
4
  # Settings specified here will take precedence over those in config/application.rb
3
5
 
@@ -25,4 +27,3 @@ Dummy::Application.configure do
25
27
  # Only use best-standards-support built into browsers
26
28
  config.action_dispatch.best_standards_support = :builtin
27
29
  end
28
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Dummy::Application.configure do
2
4
  # Settings specified here will take precedence over those in config/application.rb
3
5
 
@@ -12,7 +14,7 @@ Dummy::Application.configure do
12
14
  config.action_controller.perform_caching = true
13
15
 
14
16
  # Specifies the header that your server uses for sending files
15
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
17
+ config.action_dispatch.x_sendfile_header = 'X-Sendfile'
16
18
 
17
19
  # For nginx:
18
20
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Dummy::Application.configure do
2
4
  # Settings specified here will take precedence over those in config/application.rb
3
5
 
@@ -17,7 +19,7 @@ Dummy::Application.configure do
17
19
  config.action_dispatch.show_exceptions = false
18
20
 
19
21
  # Disable request forgery protection in test environment
20
- config.action_controller.allow_forgery_protection = false
22
+ config.action_controller.allow_forgery_protection = false
21
23
 
22
24
  # Tell Action Mailer not to deliver emails to the real world.
23
25
  # The :test delivery method accumulates sent emails in the
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Apartment.configure do |config|
2
- config.excluded_models = ["Company"]
3
- config.tenant_names = lambda{ Company.pluck(:database) }
4
+ config.excluded_models = ['Company']
5
+ config.tenant_names = -> { Company.pluck(:database) }
4
6
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Be sure to restart your server when you modify this file.
2
3
 
3
4
  # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Be sure to restart your server when you modify this file.
2
3
 
3
4
  # Add new inflection rules using the following format
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Be sure to restart your server when you modify this file.
2
3
 
3
4
  # Add new mime types for use in respond_to blocks:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Be sure to restart your server when you modify this file.
2
4
 
3
5
  # Your secret key for verifying the integrity of signed cookies.
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Be sure to restart your server when you modify this file.
2
4
 
3
- Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
5
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
6
 
5
7
  # Use the database for sessions instead of the cookie-based default,
6
8
  # which shouldn't be used to store highly confidential information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Dummy::Application.routes.draw do
2
- root :to => 'application#index'
4
+ root to: 'application#index'
3
5
  end
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is used by Rack-based servers to start the application.
2
4
 
3
- require ::File.expand_path('../config/environment', __FILE__)
5
+ require ::File.expand_path('../config/environment', __FILE__)
4
6
  run Dummy::Application
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def create_users
2
- 6.times {|x| User.where(name: "Different User #{x}").first_or_create! }
4
+ 6.times { |x| User.where(name: "Different User #{x}").first_or_create! }
3
5
  end
4
6
 
5
7
  create_users
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
5
 
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
+ APP_PATH = File.expand_path('../config/application', __dir__)
7
+ require File.expand_path('../config/boot', __dir__)
6
8
  require 'rails/commands'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Require whichever elevator you're using below here...
2
4
  #
3
5
  # require 'apartment/elevators/generic'
@@ -8,7 +10,6 @@ require 'apartment/elevators/subdomain'
8
10
  # Apartment Configuration
9
11
  #
10
12
  Apartment.configure do |config|
11
-
12
13
  # These models will not be multi-tenanted,
13
14
  # but remain in the global (public) namespace
14
15
  #
@@ -17,13 +18,13 @@ Apartment.configure do |config|
17
18
  #
18
19
  # config.excluded_models = %w{Tenant}
19
20
  #
20
- config.excluded_models = %w{}
21
+ config.excluded_models = %w[]
21
22
 
22
23
  # use postgres schemas?
23
24
  config.use_schemas = true
24
25
 
25
26
  # use raw SQL dumps for creating postgres schemas? (only appies with use_schemas set to true)
26
- #config.use_sql = true
27
+ # config.use_sql = true
27
28
 
28
29
  # configure persistent schemas (E.g. hstore )
29
30
  # config.persistent_schemas = %w{ hstore }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DummyEngine
2
4
  class Engine < ::Rails::Engine
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DummyEngine
2
- VERSION = "0.0.1"
4
+ VERSION = '0.0.1'
3
5
  end
@@ -1,4 +1,6 @@
1
- require "dummy_engine/engine"
1
+ # frozen_string_literal: true
2
+
3
+ require 'dummy_engine/engine'
2
4
 
3
5
  module DummyEngine
4
6
  end
@@ -1,9 +1,11 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('boot', __dir__)
2
4
 
3
5
  require 'rails/all'
4
6
 
5
7
  Bundler.require(*Rails.groups)
6
- require "dummy_engine"
8
+ require 'dummy_engine'
7
9
 
8
10
  module Dummy
9
11
  class Application < Rails::Application
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
5
 
4
6
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
7
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
4
+ require File.expand_path('application', __dir__)
3
5
 
4
6
  # Initialize the Rails application.
5
7
  Rails.application.initialize!
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.configure do
2
4
  # Settings specified here will take precedence over those in config/application.rb.
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.configure do
2
4
  # Settings specified here will take precedence over those in config/application.rb.
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.configure do
2
4
  # Settings specified here will take precedence over those in config/application.rb.
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Be sure to restart your server when you modify this file.
2
4
 
3
5
  # Version of your assets, change this if you want to expire all your assets.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Be sure to restart your server when you modify this file.
2
3
 
3
4
  # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Be sure to restart your server when you modify this file.
2
4
 
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
5
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Be sure to restart your server when you modify this file.
2
4
 
3
5
  # Configure sensitive parameters which will be filtered from the log file.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Be sure to restart your server when you modify this file.
2
3
 
3
4
  # Add new inflection rules using the following format. Inflections
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Be sure to restart your server when you modify this file.
2
3
 
3
4
  # Add new mime types for use in respond_to blocks:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Be sure to restart your server when you modify this file.
2
4
 
3
5
  Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Be sure to restart your server when you modify this file.
2
4
 
3
5
  # This file contains settings for ActionController::ParamsWrapper which
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.routes.draw do
2
4
  # The priority is based upon order of creation: first created -> highest priority.
3
5
  # See how all your routes lay out with "rake routes".