tb_redirects 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3d9aecd0a3a06806b0438567c29a66cdcd0dc13
4
- data.tar.gz: 47d359ae1672c491ed8ccd12d1a38f9cde7eae91
3
+ metadata.gz: ef488cb3a8986ef8df495d71c8b505394287e7d9
4
+ data.tar.gz: f32e512ee7a31b3eeca5a4f9ee87347e3319dcf0
5
5
  SHA512:
6
- metadata.gz: 0bef32225d6b27065bd967ae6f76d0af43f14d88ef9de75b27deef325c3711b2fa39990b9863748b4994ff42fd88e0127a7a546e027c13e6ac359d7f2ac4a113
7
- data.tar.gz: b13461c361ddbb96357d27db51108eabcd58941139da574d15973056c35d080b4654ef49b4fec023835488edabbdd45c50096df3395a5cf1acec075e3a71cf62
6
+ metadata.gz: 07ef44c39418c85be40b3a567072d54476be43a48dafa0c2efbb2bbc32dbf463dba8fd7408141a2d95cbe0cfb779f390dbd0da1cc1bbea4a259843ac1a7a6070
7
+ data.tar.gz: 2c993f4706e08b88f53f3b7faa0877099832d68e68ce422254bc07c5e6805275cf366482c70937cdfb3d43d166837908b2c256a7f68801391f95aca47ab284bf
data/README.md CHANGED
@@ -22,9 +22,9 @@ Then restart your application.
22
22
 
23
23
  ## How it Works
24
24
 
25
- In general, Twice Baked will raise a `Spud::NotFoundError` error any time a 404 happens. Under normal circumstances the core engine will rescue from that error and display a 404 page. TB Redirects works by rescuing from that error before core is able to do so and checking the redirects table for applicable paths.
25
+ In general, Twice Baked will raise a `TbCore::NotFoundError` error any time a 404 happens. Under normal circumstances the core engine will rescue from that error and display a 404 page. TB Redirects works by rescuing from that error before core is able to do so and checking the redirects table for applicable paths.
26
26
 
27
- What this means for your controllers is that, in order for redirection to work propertly, you should always be raising `Spud::NotFoundError` when your intention is to render a 404 page. This will allow tb_core and tb_redirects to do their thing.
27
+ What this means for your controllers is that, in order for redirection to work propertly, you should always be raising `TbCore::NotFoundError` when your intention is to render a 404 page. This will allow tb_core and tb_redirects to do their thing.
28
28
 
29
29
  ## Create a Redirect
30
30
 
@@ -2,7 +2,7 @@ module TbRedirects::HandleRedirects
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- rescue_from Spud::NotFoundError, with: :check_for_applicable_redirect
5
+ rescue_from TbCore::NotFoundError, with: :check_for_applicable_redirect
6
6
  end
7
7
 
8
8
  def check_for_applicable_redirect(error)
@@ -13,7 +13,7 @@ module TbRedirects
13
13
  end
14
14
 
15
15
  initializer 'tb_redirects.admin', before: 'tb_core.admin' do |_config|
16
- Spud::Core.admin_applications += [
16
+ TbCore.admin_applications += [
17
17
  { name: 'Redirects', key: :tb_redirects, thumbnail: 'admin/module_icon.png', url: '/admin/redirects' }
18
18
  ]
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module TbRedirects
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.0.2'.freeze
3
3
  end
@@ -15,7 +15,7 @@ RSpec.describe Admin::TbRedirectsController, type: :controller do
15
15
 
16
16
  describe 'show' do
17
17
  it 'should render the show page' do
18
- tb_redirect = FactoryGirl.create(:tb_redirect)
18
+ tb_redirect = FactoryBot.create(:tb_redirect)
19
19
  get :show, params: { id: tb_redirect.id }
20
20
  expect(response).to have_http_status :success
21
21
  expect(response).to render_template :show
@@ -37,7 +37,7 @@ RSpec.describe Admin::TbRedirectsController, type: :controller do
37
37
 
38
38
  describe 'edit' do
39
39
  it 'should render the edit page' do
40
- tb_redirect = FactoryGirl.create(:tb_redirect)
40
+ tb_redirect = FactoryBot.create(:tb_redirect)
41
41
  get :edit, params: { id: tb_redirect.id }
42
42
  expect(response).to have_http_status :success
43
43
  expect(response).to render_template :edit
@@ -47,14 +47,14 @@ RSpec.describe Admin::TbRedirectsController, type: :controller do
47
47
  describe 'create' do
48
48
  it 'should create the record' do
49
49
  expect do
50
- post :create, params: { tb_redirect: FactoryGirl.attributes_for(:tb_redirect) }
50
+ post :create, params: { tb_redirect: FactoryBot.attributes_for(:tb_redirect) }
51
51
  end.to change(TbRedirect, :count).by(1)
52
52
  end
53
53
  end
54
54
 
55
55
  describe 'update' do
56
56
  it 'should update the record' do
57
- tb_redirect = FactoryGirl.create(:tb_redirect)
57
+ tb_redirect = FactoryBot.create(:tb_redirect)
58
58
  current_value = tb_redirect.source
59
59
  new_value = current_value + '-Updated'
60
60
  expect do
@@ -66,7 +66,7 @@ RSpec.describe Admin::TbRedirectsController, type: :controller do
66
66
 
67
67
  describe 'destroy' do
68
68
  it 'should destroy the record' do
69
- tb_redirect = FactoryGirl.create(:tb_redirect)
69
+ tb_redirect = FactoryBot.create(:tb_redirect)
70
70
  expect do
71
71
  delete :destroy, params: { id: tb_redirect.id }
72
72
  end.to change(TbRedirect, :count).by(-1)
@@ -3,19 +3,19 @@ require 'rails_helper'
3
3
  RSpec.describe ApplicationController, type: :controller do
4
4
  controller do
5
5
  def index
6
- raise Spud::NotFoundError
6
+ raise TbCore::NotFoundError
7
7
  end
8
8
  end
9
9
 
10
10
  describe '#check_for_applicable_redirect' do
11
11
  it 'should redirect' do
12
- FactoryGirl.create(:tb_redirect, source: '/anonymous', destination: '/redirected')
12
+ FactoryBot.create(:tb_redirect, source: '/anonymous', destination: '/redirected')
13
13
  get :index
14
14
  expect(response).to redirect_to('/redirected')
15
15
  end
16
16
 
17
17
  it 'should not redirect' do
18
- FactoryGirl.create(:tb_redirect, source: '/other', destination: '/redirected')
18
+ FactoryBot.create(:tb_redirect, source: '/other', destination: '/redirected')
19
19
  get :index
20
20
  expect(response).to_not redirect_to('/redirected')
21
21
  end
@@ -7,7 +7,7 @@ require 'tb_redirects'
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
10
- Spud::Core.configure do |config|
10
+ TbCore.configure do |config|
11
11
  config.site_name = 'Dummy'
12
12
  config.from_address = 'no-reply@dummy.com'
13
13
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :tb_redirect do
3
3
  owner_type nil
4
4
  owner_id nil
@@ -3,9 +3,9 @@ require 'rails_helper'
3
3
  RSpec.describe TbRedirect, type: :model do
4
4
  describe '.find_with_uri' do
5
5
  before(:each) do
6
- @sample_a = FactoryGirl.create(:tb_redirect, source: '/test', destination: '/redirected')
7
- @sample_b = FactoryGirl.create(:tb_redirect, source: 'http://test.com/blog', destination: '/redirected')
8
- @sample_c = FactoryGirl.create(:tb_redirect, source: 'http://test.com/about', destination: '/redirected')
6
+ @sample_a = FactoryBot.create(:tb_redirect, source: '/test', destination: '/redirected')
7
+ @sample_b = FactoryBot.create(:tb_redirect, source: 'http://test.com/blog', destination: '/redirected')
8
+ @sample_c = FactoryBot.create(:tb_redirect, source: 'http://test.com/about', destination: '/redirected')
9
9
  end
10
10
 
11
11
  it 'should find a record where the path matches' do
@@ -32,31 +32,31 @@ RSpec.describe TbRedirect, type: :model do
32
32
 
33
33
  describe '.create_smart' do
34
34
  it 'should create a new redirect' do
35
- redirect_1 = FactoryGirl.create(:tb_redirect)
35
+ redirect_1 = FactoryBot.create(:tb_redirect)
36
36
  expect do
37
- redirect_2 = TbRedirect.create_smart(FactoryGirl.attributes_for(:tb_redirect, source: '/new'))
37
+ redirect_2 = TbRedirect.create_smart(FactoryBot.attributes_for(:tb_redirect, source: '/new'))
38
38
  end.to change(TbRedirect, :count).by(1)
39
39
  end
40
40
 
41
41
  it 'should update an existing redirect' do
42
- redirect_1 = FactoryGirl.create(:tb_redirect)
42
+ redirect_1 = FactoryBot.create(:tb_redirect)
43
43
  expect do
44
- redirect_2 = TbRedirect.create_smart(FactoryGirl.attributes_for(:tb_redirect, source: redirect_1.source))
44
+ redirect_2 = TbRedirect.create_smart(FactoryBot.attributes_for(:tb_redirect, source: redirect_1.source))
45
45
  end.to_not change(TbRedirect, :count)
46
46
  end
47
47
  end
48
48
 
49
49
  describe '#source_not_equals_destination' do
50
50
  it 'should not allow the source and destination to be equal' do
51
- redirect_1 = FactoryGirl.build(:tb_redirect, source: 'a', destination: 'a')
51
+ redirect_1 = FactoryBot.build(:tb_redirect, source: 'a', destination: 'a')
52
52
  expect(redirect_1).to be_invalid
53
53
  end
54
54
  end
55
55
 
56
56
  describe '#destroy_opposite_redirect' do
57
57
  it 'should destroy the other redirect' do
58
- redirect_1 = FactoryGirl.build(:tb_redirect, source: 'a', destination: 'b')
59
- redirect_2 = FactoryGirl.build(:tb_redirect, source: 'b', destination: 'a')
58
+ redirect_1 = FactoryBot.build(:tb_redirect, source: 'a', destination: 'b')
59
+ redirect_2 = FactoryBot.build(:tb_redirect, source: 'b', destination: 'a')
60
60
  expect do
61
61
  redirect_1.reload
62
62
  end.to raise_error(ActiveRecord::RecordNotFound)
@@ -65,9 +65,9 @@ RSpec.describe TbRedirect, type: :model do
65
65
 
66
66
  describe '#schedule_loop_detection' do
67
67
  it 'should schedule a job' do
68
- parent = FactoryGirl.create(:tb_redirect)
68
+ parent = FactoryBot.create(:tb_redirect)
69
69
  expect do
70
- FactoryGirl.create(:tb_redirect, source: parent.destination)
70
+ FactoryBot.create(:tb_redirect, source: parent.destination)
71
71
  end.to have_enqueued_job(TbRedirects::DetectRedirectLoopJob)
72
72
  end
73
73
  end
data/spec/rails_helper.rb CHANGED
@@ -12,7 +12,7 @@ require 'spec_helper'
12
12
  require 'rspec/rails'
13
13
  require 'rails-controller-testing'
14
14
  require 'database_cleaner'
15
- require 'factory_girl_rails'
15
+ require 'factory_bot_rails'
16
16
  require 'tb_core/test_helper'
17
17
 
18
18
  # Add additional requires below this line. Rails is not loaded until this point!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tb_redirects
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Woods
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-05 00:00:00.000000000 Z
11
+ date: 2018-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tb_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.beta2
19
+ version: 1.4.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.4.beta2
26
+ version: 1.4.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: factory_girl_rails
84
+ name: factory_bot_rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -252,71 +252,71 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  version: '0'
253
253
  requirements: []
254
254
  rubyforge_project:
255
- rubygems_version: 2.5.1
255
+ rubygems_version: 2.6.13
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Simple redirect management for Twice Baked
259
259
  test_files:
260
- - spec/concerns/tb_redirects/has_redirects_spec.rb
261
- - spec/controllers/admin/tb_redirects_controller_spec.rb
262
- - spec/controllers/application_controller_spec.rb
260
+ - spec/spec_helper.rb
261
+ - spec/dummy/app/models/widget.rb
262
+ - spec/dummy/app/controllers/application_controller.rb
263
+ - spec/dummy/app/views/layouts/application.html.erb
264
+ - spec/dummy/app/views/layouts/error_page.html.erb
265
+ - spec/dummy/app/assets/javascripts/bootstrap_modules.js
263
266
  - spec/dummy/app/assets/javascripts/admin/application.js
264
267
  - spec/dummy/app/assets/javascripts/application.js
265
- - spec/dummy/app/assets/javascripts/bootstrap_modules.js
266
- - spec/dummy/app/assets/stylesheets/admin/application.scss
267
268
  - spec/dummy/app/assets/stylesheets/application.scss
268
- - spec/dummy/app/assets/stylesheets/imports/bootstrap_modules.scss
269
+ - spec/dummy/app/assets/stylesheets/admin/application.scss
269
270
  - spec/dummy/app/assets/stylesheets/imports/bootstrap_theme.scss
270
- - spec/dummy/app/controllers/application_controller.rb
271
+ - spec/dummy/app/assets/stylesheets/imports/bootstrap_modules.scss
271
272
  - spec/dummy/app/helpers/application_helper.rb
272
- - spec/dummy/app/models/widget.rb
273
- - spec/dummy/app/views/layouts/application.html.erb
274
- - spec/dummy/app/views/layouts/error_page.html.erb
275
- - spec/dummy/bin/bundle
276
- - spec/dummy/bin/rails
277
273
  - spec/dummy/bin/rake
278
274
  - spec/dummy/bin/setup
279
- - spec/dummy/config/application.rb
280
- - spec/dummy/config/boot.rb
281
- - spec/dummy/config/database.yml
282
- - spec/dummy/config/environment.rb
283
- - spec/dummy/config/environments/development.rb
275
+ - spec/dummy/bin/bundle
276
+ - spec/dummy/bin/rails
277
+ - spec/dummy/config/secrets.yml
278
+ - spec/dummy/config/routes.rb
279
+ - spec/dummy/config/locales/en.yml
284
280
  - spec/dummy/config/environments/production.rb
281
+ - spec/dummy/config/environments/development.rb
285
282
  - spec/dummy/config/environments/test.rb
286
- - spec/dummy/config/initializers/assets.rb
283
+ - spec/dummy/config/environment.rb
284
+ - spec/dummy/config/application.rb
285
+ - spec/dummy/config/database.yml
286
+ - spec/dummy/config/boot.rb
287
287
  - spec/dummy/config/initializers/backtrace_silencers.rb
288
- - spec/dummy/config/initializers/cookies_serializer.rb
289
- - spec/dummy/config/initializers/filter_parameter_logging.rb
290
- - spec/dummy/config/initializers/inflections.rb
291
288
  - spec/dummy/config/initializers/mime_types.rb
289
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
292
290
  - spec/dummy/config/initializers/session_store.rb
293
291
  - spec/dummy/config/initializers/wrap_parameters.rb
294
- - spec/dummy/config/locales/en.yml
295
- - spec/dummy/config/routes.rb
296
- - spec/dummy/config/secrets.yml
292
+ - spec/dummy/config/initializers/assets.rb
293
+ - spec/dummy/config/initializers/cookies_serializer.rb
294
+ - spec/dummy/config/initializers/inflections.rb
297
295
  - spec/dummy/config.ru
298
- - spec/dummy/db/migrate/20160211160614_create_spud_admin_permissions.tb_core.rb
299
- - spec/dummy/db/migrate/20160211160615_create_spud_users.tb_core.rb
296
+ - spec/dummy/Rakefile
297
+ - spec/dummy/public/favicon.ico
298
+ - spec/dummy/public/422.html
299
+ - spec/dummy/public/500.html
300
+ - spec/dummy/public/404.html
301
+ - spec/dummy/db/schema.rb
302
+ - spec/dummy/db/migrate/20160211160621_create_spud_role_permissions.tb_core.rb
300
303
  - spec/dummy/db/migrate/20160211160616_add_time_zone_to_spud_user.tb_core.rb
301
- - spec/dummy/db/migrate/20160211160617_add_scope_to_spud_admin_permissions.tb_core.rb
304
+ - spec/dummy/db/migrate/20160211160615_create_spud_users.tb_core.rb
302
305
  - spec/dummy/db/migrate/20160211160618_create_spud_user_settings.tb_core.rb
303
- - spec/dummy/db/migrate/20160211160619_create_spud_roles.tb_core.rb
306
+ - spec/dummy/db/migrate/20160211160623_add_requires_password_change_to_spud_users.tb_core.rb
307
+ - spec/dummy/db/migrate/20160211160614_create_spud_admin_permissions.tb_core.rb
308
+ - spec/dummy/db/migrate/20160211160617_add_scope_to_spud_admin_permissions.tb_core.rb
304
309
  - spec/dummy/db/migrate/20160211160620_create_spud_permissions.tb_core.rb
305
- - spec/dummy/db/migrate/20160211160621_create_spud_role_permissions.tb_core.rb
310
+ - spec/dummy/db/migrate/20160211160619_create_spud_roles.tb_core.rb
306
311
  - spec/dummy/db/migrate/20160211160622_drop_spud_admin_permissions.tb_core.rb
307
- - spec/dummy/db/migrate/20160211160623_add_requires_password_change_to_spud_users.tb_core.rb
308
312
  - spec/dummy/db/migrate/20160211185931_create_widgets.rb
309
313
  - spec/dummy/db/migrate/20160212211331_create_tb_redirects.tb_redirects.rb
310
- - spec/dummy/db/schema.rb
311
- - spec/dummy/public/404.html
312
- - spec/dummy/public/422.html
313
- - spec/dummy/public/500.html
314
- - spec/dummy/public/favicon.ico
315
- - spec/dummy/Rakefile
316
314
  - spec/dummy/README.rdoc
315
+ - spec/models/tb_redirect_spec.rb
317
316
  - spec/factories/tb_redirects.rb
318
- - spec/helpers/admin/tb_redirects_helper_spec.rb
319
317
  - spec/jobs/tb_redirects/detect_redirect_loop_job_spec.rb
320
- - spec/models/tb_redirect_spec.rb
318
+ - spec/controllers/admin/tb_redirects_controller_spec.rb
319
+ - spec/controllers/application_controller_spec.rb
321
320
  - spec/rails_helper.rb
322
- - spec/spec_helper.rb
321
+ - spec/helpers/admin/tb_redirects_helper_spec.rb
322
+ - spec/concerns/tb_redirects/has_redirects_spec.rb