tb_core 1.3.10 → 1.4.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +5 -20
  3. data/app/controllers/admin/application_controller.rb +2 -2
  4. data/app/controllers/admin/dashboard_controller.rb +4 -4
  5. data/app/controllers/admin/password_resets_controller.rb +9 -9
  6. data/app/controllers/admin/roles_controller.rb +8 -8
  7. data/app/controllers/admin/settings_controller.rb +11 -9
  8. data/app/controllers/admin/setup_controller.rb +5 -5
  9. data/app/controllers/admin/user_sessions_controller.rb +2 -2
  10. data/app/controllers/admin/users_controller.rb +13 -13
  11. data/app/controllers/password_resets_controller.rb +7 -7
  12. data/app/controllers/spud/admin/application_controller.rb +5 -1
  13. data/app/controllers/spud/application_controller.rb +15 -11
  14. data/app/controllers/user_sessions_controller.rb +11 -5
  15. data/app/helpers/admin/application_helper.rb +20 -14
  16. data/app/helpers/tb_core/application_helper.rb +20 -16
  17. data/app/mailers/tb_core_mailer.rb +9 -3
  18. data/app/models/spud/spud_user_model.rb +7 -13
  19. data/app/models/spud_role.rb +4 -4
  20. data/app/models/spud_user_setting.rb +2 -2
  21. data/config/routes.rb +3 -3
  22. data/lib/generators/spud/controller_spec_generator.rb +6 -3
  23. data/lib/generators/spud/module_generator.rb +56 -41
  24. data/lib/generators/spud/setup_generator.rb +26 -22
  25. data/lib/generators/spud/templates/admin_controller.rb.erb +9 -13
  26. data/lib/generators/spud/templates/controller.rb.erb +4 -6
  27. data/lib/generators/spud/templates/controller_spec.rb.erb +16 -21
  28. data/lib/generators/spud/templates/views/layouts/application.html.erb +1 -1
  29. data/lib/spud_core/catch_all_route.rb +1 -1
  30. data/lib/spud_core/configuration.rb +7 -3
  31. data/lib/spud_core/engine.rb +5 -18
  32. data/lib/spud_core/errors.rb +3 -4
  33. data/lib/spud_core/test_files.rb +3 -3
  34. data/lib/spud_core/version.rb +1 -1
  35. data/lib/tb_core/belongs_to_app.rb +6 -3
  36. data/lib/tb_core/form_builder.rb +40 -33
  37. data/lib/tb_core/responder.rb +2 -2
  38. data/lib/tb_core/test_helper.rb +2 -2
  39. data/spec/controllers/admin/application_controller_spec.rb +14 -14
  40. data/spec/controllers/admin/dashboard_controller_spec.rb +26 -23
  41. data/spec/controllers/admin/password_reset_controller_spec.rb +29 -30
  42. data/spec/controllers/admin/settings_controller_spec.rb +13 -13
  43. data/spec/controllers/admin/setup_controller_spec.rb +12 -12
  44. data/spec/controllers/admin/user_sessions_controller_spec.rb +3 -3
  45. data/spec/controllers/admin/users_controller_spec.rb +68 -65
  46. data/spec/controllers/spud/application_controller_spec.rb +1 -1
  47. data/spec/dummy/config/application.rb +6 -7
  48. data/spec/dummy/config/database.yml +7 -16
  49. data/spec/dummy/config/environments/production.rb +1 -1
  50. data/spec/dummy/config/environments/test.rb +5 -2
  51. data/spec/dummy/config/routes.rb +1 -1
  52. data/spec/dummy/db/schema.rb +53 -54
  53. data/spec/factories/spud_user_factories.rb +2 -2
  54. data/spec/helpers/spud/admin/application_helper_spec.rb +4 -4
  55. data/spec/lib/spud_core/configuration_spec.rb +2 -2
  56. data/spec/lib/tb_core/belongs_to_app_spec.rb +4 -4
  57. data/spec/models/spud_role_spec.rb +9 -9
  58. data/spec/models/spud_user_spec.rb +19 -32
  59. data/spec/rails_helper.rb +5 -6
  60. metadata +67 -77
  61. data/lib/responds_to_parent.rb +0 -69
  62. data/lib/tb_core/mysql2_extensions.rb +0 -45
  63. data/spec/dummy/db/migrate/20141214200804_create_spud_admin_permissions.tb_core.rb +0 -12
  64. data/spec/dummy/db/migrate/20141214200805_create_spud_users.tb_core.rb +0 -30
  65. data/spec/dummy/db/migrate/20141214200806_add_time_zone_to_spud_user.tb_core.rb +0 -7
  66. data/spec/dummy/db/migrate/20141214200807_add_scope_to_spud_admin_permissions.tb_core.rb +0 -7
  67. data/spec/dummy/db/migrate/20141214200808_create_spud_user_settings.tb_core.rb +0 -12
  68. data/spec/dummy/db/migrate/20141214200809_create_spud_roles.tb_core.rb +0 -11
  69. data/spec/dummy/db/migrate/20141214200810_create_spud_permissions.tb_core.rb +0 -11
  70. data/spec/dummy/db/migrate/20141214200811_create_spud_role_permissions.tb_core.rb +0 -12
  71. data/spec/dummy/db/migrate/20141214200812_drop_spud_admin_permissions.tb_core.rb +0 -16
  72. data/spec/dummy/db/migrate/20150610180845_add_requires_password_change_to_spud_users.tb_core.rb +0 -6
  73. data/spec/lib/tb_core/mysql2_extensions_spec.rb +0 -59
@@ -1,30 +1,30 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe Admin::PasswordResetsController, :type => :controller do
3
+ describe Admin::PasswordResetsController, type: :controller do
4
4
 
5
- let(:user) { FactoryGirl.build(:spud_user, :id => 1, :perishable_token => "jfdlsafhbkvabuadfbds") }
5
+ let(:user) { FactoryGirl.build(:spud_user, id: 1, perishable_token: 'jfdlsafhbkvabuadfbds') }
6
6
 
7
7
  context 'get' do
8
8
  describe 'index' do
9
- it "should return success" do
9
+ it 'should return success' do
10
10
  get :index
11
11
  expect(response).to be_success
12
12
  end
13
13
  end
14
14
 
15
15
  describe 'show' do
16
- context "with a valid id" do
17
- it "should render the edit form" do
16
+ context 'with a valid id' do
17
+ it 'should render the edit form' do
18
18
  allow(SpudUser).to receive(:find_using_perishable_token).and_return(user)
19
- get :show, :id => 1
19
+ get :show, params: { id: 1 }
20
20
  expect(response).to be_success
21
21
  end
22
22
  end
23
23
 
24
- context "with an invalid id" do
25
- it "should redirect to the login form" do
24
+ context 'with an invalid id' do
25
+ it 'should redirect to the login form' do
26
26
  allow(SpudUser).to receive(:find_using_perishable_token).and_return(nil)
27
- get :show, :id => user.id
27
+ get :show, params: { id: user.id }
28
28
  expect(response).to redirect_to(admin_login_path)
29
29
  end
30
30
  end
@@ -34,53 +34,52 @@ describe Admin::PasswordResetsController, :type => :controller do
34
34
  context 'post' do
35
35
 
36
36
  describe 'create' do
37
- context "with a valid user email address submitted" do
38
- it "should trigger the password notificiation" do
37
+ context 'with a valid user email address submitted' do
38
+ it 'should trigger the password notificiation' do
39
39
  allow(SpudUser).to receive(:find_by_email).and_return(user)
40
-
41
- expect{ post :create, :email => user.email}.to change{
42
- ActionMailer::Base.deliveries.count
43
- }.by(1)
40
+ expect do
41
+ post :create, params: { email: user.email }
42
+ end.to have_enqueued_job.on_queue('mailers')
44
43
  end
45
44
 
46
- it "should redirect to the login form" do
45
+ it 'should redirect to the login form' do
47
46
  allow(SpudUser).to receive(:find_by_email).and_return(user)
48
47
 
49
- post :create, :email => user.email
48
+ post :create, params: { email: user.email }
50
49
  expect(response).to redirect_to(admin_login_path)
51
50
  end
52
51
  end
53
52
 
54
- context "with an invalid user email address submitted" do
53
+ context 'with an invalid user email address submitted' do
55
54
  before(:each) do
56
55
  allow(SpudUser).to receive(:find_by_email).and_return(nil)
57
56
  end
58
- it "should re-render the password reset form" do
59
- post :create, :email => "invalid@email.com"
60
- expect(response).to render_template("index")
57
+ it 'should re-render the password reset form' do
58
+ post :create, params: { email: 'invalid@email.com' }
59
+ expect(response).to render_template('index')
61
60
  end
62
61
  end
63
62
  end
64
63
 
65
64
  describe 'update' do
66
- let(:valid_data) { {:id => user.id, :spud_user => {:password => "password", :password_confirmation => "password"}}}
67
- let(:invalid_data) { {:id => user.id, :spud_user => {:password => "password", :password_confirmation => "drowssap"}}}
65
+ let(:valid_data) { {id: user.id, spud_user: {password: 'password', password_confirmation: 'password'}}}
66
+ let(:invalid_data) { {id: user.id, spud_user: {password: 'password', password_confirmation: 'drowssap'}}}
68
67
 
69
68
  before(:each) do
70
69
  allow(SpudUser).to receive(:find_using_perishable_token).and_return(user)
71
70
  end
72
71
 
73
- context "with valid password entry" do
74
- it "should save and redirect to the login form" do
75
- post :update, valid_data
72
+ context 'with valid password entry' do
73
+ it 'should save and redirect to the login form' do
74
+ post :update, params: valid_data
76
75
  expect(response).to redirect_to(admin_login_path)
77
76
  end
78
77
  end
79
78
 
80
- context "with an invalid password entry" do
81
- it "should re-render the password form" do
82
- post :update, invalid_data
83
- expect(response).to render_template("show")
79
+ context 'with an invalid password entry' do
80
+ it 'should re-render the password form' do
81
+ post :update, params: invalid_data
82
+ expect(response).to render_template('show')
84
83
  end
85
84
  end
86
85
  end
@@ -1,32 +1,32 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe Admin::SettingsController, :type => :controller do
3
+ describe Admin::SettingsController, type: :controller do
4
4
  before(:each) do
5
5
  activate_session(admin: true)
6
6
  end
7
-
7
+
8
8
  describe 'edit' do
9
- it "should respond with success" do
9
+ it 'should respond with success' do
10
10
  get :edit
11
11
  expect(response).to be_success
12
12
  end
13
13
  end
14
-
14
+
15
15
  describe 'update' do
16
- it "should give an error if password change does not include a valid current password" do
16
+ it 'should give an error if password change does not include a valid current password' do
17
17
  u = FactoryGirl.build(:spud_user)
18
- u.password = "test"
19
- put :update, :spud_user => {:first_name => "Mike", :password => "Imapassword", :current_password => "ImaTest"}
20
- is_expected.to respond_with 401
18
+ u.password = 'test'
19
+ put :update, params: { spud_user: {first_name: 'Mike', password: 'Imapassword', current_password: 'ImaTest'} }
20
+ expect(response).to have_http_status(401)
21
21
  end
22
22
 
23
- it "should redirect to the settings page with a successful update" do
24
- put :update, :spud_user => {:first_name => "Mike"}
23
+ it 'should redirect to the settings page with a successful update' do
24
+ put :update, params: { spud_user: {first_name: 'Mike'} }
25
25
  expect(response).to redirect_to(admin_settings_path)
26
26
  end
27
-
28
- it "should put a message in the flash notice" do
29
- put :update, :spud_user => {:first_name => "Mike"}
27
+
28
+ it 'should put a message in the flash notice' do
29
+ put :update, params: { spud_user: {first_name: 'Mike'} }
30
30
  expect(flash[:notice]).to_not be_blank
31
31
  end
32
32
  end
@@ -1,31 +1,31 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe Admin::SetupController, :type => :controller do
4
-
3
+ describe Admin::SetupController, type: :controller do
4
+
5
5
  describe 'new' do
6
- it "should be successful" do
6
+ it 'should be successful' do
7
7
  get :new
8
-
8
+
9
9
  expect(response).to be_success
10
10
  end
11
-
12
- it "should redirect to the admin login form when there is already a user" do
11
+
12
+ it 'should redirect to the admin login form when there is already a user' do
13
13
  allow(SpudUser).to receive(:count).and_return(1)
14
14
  get :new
15
-
15
+
16
16
  expect(response).to redirect_to(admin_login_path)
17
17
  end
18
18
  end
19
19
 
20
20
  describe 'create' do
21
- it "should create a new user" do
21
+ it 'should create a new user' do
22
22
  expect{
23
- post :create, :spud_user => FactoryGirl.attributes_for(:spud_user)
23
+ post :create, params: { spud_user: FactoryGirl.attributes_for(:spud_user) }
24
24
  }.to change(SpudUser, :count).by(1)
25
25
  end
26
-
27
- it "should redirect to the admin dashboard when first admin user has been created" do
28
- post :create, :spud_user => FactoryGirl.attributes_for(:spud_user)
26
+
27
+ it 'should redirect to the admin dashboard when first admin user has been created' do
28
+ post :create, params: { spud_user: FactoryGirl.attributes_for(:spud_user) }
29
29
  expect(response).to redirect_to(admin_root_path)
30
30
  end
31
31
  end
@@ -1,18 +1,18 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe Admin::UserSessionsController, :type => :controller do
3
+ describe Admin::UserSessionsController, type: :controller do
4
4
  before(:each) do
5
5
  # activate_authlogic
6
6
  # SpudUserSession.create(FactoryGirl.build(:spud_user))
7
7
  end
8
8
 
9
9
  describe 'new' do
10
- it "should redirect to setup url if no users exist" do
10
+ it 'should redirect to setup url if no users exist' do
11
11
  get :new
12
12
  expect(response).to redirect_to(admin_setup_path)
13
13
  end
14
14
 
15
- it "should render login form if users do exist" do
15
+ it 'should render login form if users do exist' do
16
16
  u = FactoryGirl.create(:spud_user)
17
17
  u.save
18
18
  get :new
@@ -1,154 +1,157 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe Admin::UsersController, :type => :controller do
3
+ describe Admin::UsersController, type: :controller do
4
4
 
5
5
  before(:each) do
6
6
  activate_session(admin: true)
7
7
  @role = FactoryGirl.create(:spud_role)
8
- Spud::Core.admin_applications += [{:name => 'Test', :key => :test}]
8
+ Spud::Core.admin_applications += [{name: 'Test', key: :test}]
9
9
  Spud::Core.permissions.push(SpudPermission.new('admin.test.full_access', 'Test', [:test]))
10
10
  end
11
-
11
+
12
12
  describe 'index' do
13
- it "should return an array of users" do
13
+ it 'should return an array of users' do
14
14
  2.times {|x| FactoryGirl.create(:spud_user) }
15
15
  get :index
16
-
16
+
17
17
  expect(assigns(:spud_users).count).to be > 1
18
18
  end
19
-
20
- it "should not return any users if there are no users" do
19
+
20
+ it 'should not return any users if there are no users' do
21
21
  get :index
22
-
22
+
23
23
  expect(assigns(:spud_users).count).to eq(1) # the currently logged in user is the only user
24
24
  end
25
-
26
- it "should not allow access to users with NO permissions" do
27
- SpudUserSession.create(FactoryGirl.build(:spud_user, :super_admin => false))
25
+
26
+ it 'should not allow access to users with NO permissions' do
27
+ SpudUserSession.create(FactoryGirl.build(:spud_user, super_admin: false))
28
28
  get :index
29
-
30
- expect(response.code).to eq("403")
29
+
30
+ expect(response.code).to eq('403')
31
31
  expect(response).to render_template('layouts/admin/error_page')
32
32
  end
33
-
34
- it "should allow access to users with the correct permissions" do
35
- u = FactoryGirl.create(:spud_user, :super_admin => false)
33
+
34
+ it 'should allow access to users with the correct permissions' do
35
+ u = FactoryGirl.create(:spud_user, super_admin: false)
36
36
  @role.permission_tags = ['admin.users.full_access']
37
37
  @role.save()
38
38
  u.role = @role
39
39
  SpudUserSession.create(u)
40
40
  get :index
41
-
41
+
42
42
  expect(response).to be_success
43
43
  end
44
44
 
45
- it "should not allow access to users without a role, and redirect to render error page if the user has no permissions" do
46
- u = FactoryGirl.create(:spud_user, :super_admin => false)
45
+ it 'should not allow access to users without a role,
46
+ and redirect to render error page if the user has no permissions' do
47
+ u = FactoryGirl.create(:spud_user, super_admin: false)
47
48
  u.role = nil
48
49
  SpudUserSession.create(u)
49
50
  get :index
50
-
51
- expect(response.code).to eq("403")
51
+
52
+ expect(response.code).to eq('403')
52
53
  expect(response).to render_template('layouts/admin/error_page')
53
54
  end
54
55
 
55
- it "should not allow access to users with a role that contains no permissions, and render error page if the users has no other admin modules" do
56
- u = FactoryGirl.create(:spud_user, :super_admin => false)
56
+ it 'should not allow access to users with a role that contains no permissions,
57
+ and render error page if the users has no other admin modules' do
58
+ u = FactoryGirl.create(:spud_user, super_admin: false)
57
59
  u.role = @role
58
60
  @role.spud_role_permissions = []
59
61
  SpudUserSession.create(u)
60
62
  get :index
61
-
62
- expect(response.code).to eq("403")
63
+
64
+ expect(response.code).to eq('403')
63
65
  expect(response).to render_template('layouts/admin/error_page')
64
66
  end
65
-
66
- it "should not allow access to users without permission and render error page if the users has other admin modules" do
67
- u = FactoryGirl.create(:spud_user, :super_admin => false)
67
+
68
+ it 'should not allow access to users without permission
69
+ and render error page if the users has other admin modules' do
70
+ u = FactoryGirl.create(:spud_user, super_admin: false)
68
71
  @role.permission_tags = ['admin.test.full_access']
69
72
  u.role = @role
70
73
  SpudUserSession.create(u)
71
74
  get :index
72
-
73
- expect(response.code).to eq("403")
75
+
76
+ expect(response.code).to eq('403')
74
77
  expect(response).to render_template('layouts/admin/error_page')
75
78
  end
76
79
  end
77
-
80
+
78
81
  describe 'show' do
79
- it "should respond successfully" do
82
+ it 'should respond successfully' do
80
83
  user = FactoryGirl.create(:spud_user)
81
- get :show, :id => user.id
84
+ get :show, params: { id: user.id }
82
85
  expect(response).to be_success
83
86
  end
84
87
  end
85
-
88
+
86
89
  describe 'new' do
87
- it "should render the form" do
88
- get :new, :format => :html
90
+ it 'should render the form' do
91
+ get :new, format: :html
89
92
  expect(response).to be_success
90
93
  end
91
94
  end
92
-
95
+
93
96
  describe 'create' do
94
- context "HTML format" do
95
- it "should create a new user with a valid form submission" do
97
+ context 'HTML format' do
98
+ it 'should create a new user with a valid form submission' do
96
99
  expect {
97
- post :create, :spud_user => FactoryGirl.attributes_for(:spud_user)
100
+ post :create, params: { spud_user: FactoryGirl.attributes_for(:spud_user) }
98
101
  }.to change(SpudUser, :count).by(1)
99
102
  end
100
-
101
- it "should not create a user with an invalid form entry" do
103
+
104
+ it 'should not create a user with an invalid form entry' do
102
105
  expect {
103
- post :create, :spud_user => FactoryGirl.attributes_for(:spud_user, :email => nil)
106
+ post :create, params: { spud_user: FactoryGirl.attributes_for(:spud_user, email: nil) }
104
107
  }.to_not change(SpudUser, :count)
105
108
  end
106
- end
109
+ end
107
110
  end
108
-
111
+
109
112
  describe 'edit' do
110
- context "HTML format" do
111
- it "should load the correct user for the edit form" do
113
+ context 'HTML format' do
114
+ it 'should load the correct user for the edit form' do
112
115
  user = FactoryGirl.create(:spud_user)
113
- get :edit, :id => user.id
114
-
116
+ get :edit, params: { id: user.id }
117
+
115
118
  expect(assigns(:user).id).to eq(user.id)
116
119
  end
117
120
  end
118
121
  end
119
-
122
+
120
123
  describe 'update' do
121
- it "should update the email when the first name attribute is changed" do
124
+ it 'should update the email when the first name attribute is changed' do
122
125
  user = FactoryGirl.create(:spud_user)
123
- new_name = "Adam"
126
+ new_name = 'Adam'
124
127
  expect {
125
- put :update, :id => user.id, :spud_user => user.attributes.merge!(:first_name => new_name)
128
+ put :update, params: { id: user.id, spud_user: { first_name: new_name } }
126
129
  user.reload
127
130
  }.to change(user, :first_name).to(new_name)
128
131
  end
129
-
130
- it "should redirect to the admin users show view after a successful update" do
132
+
133
+ it 'should redirect to the admin users show view after a successful update' do
131
134
  user = FactoryGirl.create(:spud_user)
132
- put :update, :id => user.id, :spud_user => user.attributes.merge!(:first_name => "Adam")
133
-
135
+ put :update, params: { id: user.id, spud_user: user.attributes.merge!(first_name: 'Adam') }
136
+
134
137
  expect(response).to redirect_to(admin_user_path(user))
135
138
  end
136
139
  end
137
-
140
+
138
141
  describe 'destroy' do
139
- it "should destroy the user" do
142
+ it 'should destroy the user' do
140
143
  user = FactoryGirl.create(:spud_user)
141
144
  expect {
142
- delete :destroy, :id => user.id
145
+ delete :destroy, params: { id: user.id }
143
146
  }.to change(SpudUser, :count).by(-1)
144
147
  expect(response).to be_redirect
145
148
  end
146
-
147
- it "should destroy the user with the wrong id" do
148
- user = FactoryGirl.create(:spud_user)
149
+
150
+ it 'should destroy the user with the wrong id' do
151
+ FactoryGirl.create(:spud_user)
149
152
  expect {
150
- delete :destroy, :id => "23532"
153
+ delete :destroy, params: { id: '23532' }
151
154
  }.to_not change(SpudUser, :count)
152
155
  end
153
156
  end
154
- end
157
+ end
@@ -2,7 +2,7 @@ require 'rails_helper'
2
2
  require 'rspec/mocks'
3
3
  require 'rspec/mocks/standalone'
4
4
 
5
- describe Spud::ApplicationController, :type => :controller do
5
+ describe Spud::ApplicationController, type: :controller do
6
6
 
7
7
  describe 'not_found' do
8
8
  it 'throws a 404 error' do
@@ -3,13 +3,13 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require
6
- require "tb_core"
6
+ require 'tb_core'
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
10
10
  Spud::Core.configure do |config|
11
- config.site_name = "Dummy"
12
- config.from_address = "no-reply@dummy.com"
11
+ config.site_name = 'Dummy'
12
+ config.from_address = 'no-reply@dummy.com'
13
13
  end
14
14
 
15
15
  # Settings in config/environments/* take precedence over those specified here.
@@ -36,7 +36,7 @@ module Dummy
36
36
  config.i18n.enforce_available_locales = true
37
37
 
38
38
  # Configure the default encoding used in templates for Ruby 1.9.
39
- config.encoding = "utf-8"
39
+ config.encoding = 'utf-8'
40
40
 
41
41
  # Configure sensitive parameters which will be filtered from the log file.
42
42
  config.filter_parameters += [:password]
@@ -53,11 +53,10 @@ module Dummy
53
53
  # config.active_record.whitelist_attributes = true
54
54
 
55
55
  # Enable the asset pipeline
56
- config.assets.enabled = true
56
+ # config.assets.enabled = true
57
57
 
58
58
  # Version of your assets, change this if you want to expire all your assets
59
- config.assets.version = '1.0'
59
+ # config.assets.version = '1.0'
60
60
 
61
61
  end
62
62
  end
63
-
@@ -1,18 +1,9 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: mysql2
8
- database: tb_core_development
9
- encoding: utf8mb4
10
- collation: utf8mb4_bin
11
- username: root
1
+ default: &default
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ pool: 5
12
5
 
13
6
  test:
14
- adapter: mysql2
15
- database: tb_core_test
16
- encoding: utf8mb4
17
- collation: utf8mb4_bin
18
- username: root
7
+ <<: *default
8
+ database: <%= ENV['DATABASE_NAME_TEST'] || 'tb_core_test' %>
9
+ password: <%= ENV['DATABASE_PASSWORD'] %>
@@ -9,7 +9,7 @@ Dummy::Application.configure do
9
9
  config.action_controller.perform_caching = true
10
10
 
11
11
  # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_files = false
12
+ config.public_file_server.enabled = false
13
13
 
14
14
  # Compress JavaScripts and CSS
15
15
  config.assets.compress = true
@@ -8,8 +8,8 @@ Dummy::Application.configure do
8
8
  config.cache_classes = true
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_files = true
12
- config.static_cache_control = "public, max-age=3600"
11
+ config.public_file_server.enabled = true
12
+ config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
13
13
 
14
14
  # Deprecated
15
15
  # Log error messages when you accidentally call methods on nil
@@ -35,6 +35,9 @@ Dummy::Application.configure do
35
35
  # ActionMailer::Base.deliveries array.
36
36
  config.action_mailer.delivery_method = :test
37
37
 
38
+ # Use test jobs adapter
39
+ config.active_job.queue_adapter = :test
40
+
38
41
  # Deprecated
39
42
  # Raise exception on mass assignment protection for Active Record models
40
43
  # config.active_record.mass_assignment_sanitizer = :strict
@@ -1,5 +1,5 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
3
  # mount SpudCore::Engine => "/spud_core"
4
- root :to => "pages#show", :id => "home"
4
+ root to: 'pages#show', id: 'home'
5
5
  end