tb_redirects 0.9.0 → 1.0.beta1

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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/Rakefile +1 -5
  4. data/app/controllers/admin/tb_redirects_controller.rb +11 -14
  5. data/app/controllers/concerns/tb_redirects/handle_redirects.rb +3 -4
  6. data/app/helpers/admin/tb_redirects_helper.rb +2 -4
  7. data/app/jobs/tb_redirects/detect_redirect_loop_job.rb +5 -5
  8. data/app/models/concerns/tb_redirects/has_redirects.rb +1 -2
  9. data/app/models/tb_redirect.rb +12 -14
  10. data/lib/tb_redirects/engine.rb +5 -5
  11. data/lib/tb_redirects/version.rb +1 -1
  12. data/lib/tb_redirects.rb +1 -1
  13. data/spec/concerns/tb_redirects/has_redirects_spec.rb +6 -8
  14. data/spec/controllers/admin/tb_redirects_controller_spec.rb +13 -15
  15. data/spec/controllers/application_controller_spec.rb +3 -5
  16. data/spec/dummy/bin/setup +8 -8
  17. data/spec/dummy/config/application.rb +3 -7
  18. data/spec/dummy/config/environments/production.rb +1 -1
  19. data/spec/dummy/config/environments/test.rb +2 -2
  20. data/spec/dummy/db/migrate/20160211160615_create_spud_users.tb_core.rb +9 -10
  21. data/spec/dummy/db/migrate/20160211160616_add_time_zone_to_spud_user.tb_core.rb +0 -1
  22. data/spec/dummy/db/migrate/20160211160617_add_scope_to_spud_admin_permissions.tb_core.rb +0 -1
  23. data/spec/dummy/db/migrate/20160211160620_create_spud_permissions.tb_core.rb +3 -3
  24. data/spec/dummy/db/migrate/20160211160621_create_spud_role_permissions.tb_core.rb +2 -2
  25. data/spec/dummy/db/migrate/20160211160623_add_requires_password_change_to_spud_users.tb_core.rb +1 -1
  26. data/spec/dummy/db/migrate/20160212211331_create_tb_redirects.tb_redirects.rb +3 -3
  27. data/spec/dummy/db/schema.rb +64 -66
  28. data/spec/factories/tb_redirects.rb +2 -2
  29. data/spec/helpers/admin/tb_redirects_helper_spec.rb +0 -2
  30. data/spec/jobs/tb_redirects/detect_redirect_loop_job_spec.rb +25 -27
  31. data/spec/models/tb_redirect_spec.rb +24 -27
  32. data/spec/rails_helper.rb +9 -3
  33. data/spec/spec_helper.rb +47 -49
  34. metadata +57 -29
@@ -11,87 +11,85 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20160212211331) do
15
-
16
- create_table "spud_permissions", force: :cascade do |t|
17
- t.string "name", limit: 255, null: false
18
- t.string "tag", limit: 255, null: false
19
- t.datetime "created_at"
20
- t.datetime "updated_at"
14
+ ActiveRecord::Schema.define(version: 20_160_212_211_331) do
15
+ create_table 'spud_permissions', force: :cascade do |t|
16
+ t.string 'name', limit: 255, null: false
17
+ t.string 'tag', limit: 255, null: false
18
+ t.datetime 'created_at'
19
+ t.datetime 'updated_at'
21
20
  end
22
21
 
23
- add_index "spud_permissions", ["tag"], name: "index_spud_permissions_on_tag", unique: true, length: {"tag"=>191}, using: :btree
22
+ add_index 'spud_permissions', ['tag'], name: 'index_spud_permissions_on_tag', unique: true, length: { 'tag' => 191 }, using: :btree
24
23
 
25
- create_table "spud_role_permissions", force: :cascade do |t|
26
- t.integer "spud_role_id", limit: 4, null: false
27
- t.string "spud_permission_tag", limit: 255, null: false
28
- t.datetime "created_at"
29
- t.datetime "updated_at"
24
+ create_table 'spud_role_permissions', force: :cascade do |t|
25
+ t.integer 'spud_role_id', limit: 4, null: false
26
+ t.string 'spud_permission_tag', limit: 255, null: false
27
+ t.datetime 'created_at'
28
+ t.datetime 'updated_at'
30
29
  end
31
30
 
32
- add_index "spud_role_permissions", ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag", length: {"spud_permission_tag"=>191}, using: :btree
33
- add_index "spud_role_permissions", ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id", using: :btree
31
+ add_index 'spud_role_permissions', ['spud_permission_tag'], name: 'index_spud_role_permissions_on_spud_permission_tag', length: { 'spud_permission_tag' => 191 }, using: :btree
32
+ add_index 'spud_role_permissions', ['spud_role_id'], name: 'index_spud_role_permissions_on_spud_role_id', using: :btree
34
33
 
35
- create_table "spud_roles", force: :cascade do |t|
36
- t.string "name", limit: 255
37
- t.datetime "created_at"
38
- t.datetime "updated_at"
34
+ create_table 'spud_roles', force: :cascade do |t|
35
+ t.string 'name', limit: 255
36
+ t.datetime 'created_at'
37
+ t.datetime 'updated_at'
39
38
  end
40
39
 
41
- create_table "spud_user_settings", force: :cascade do |t|
42
- t.integer "spud_user_id", limit: 4
43
- t.string "key", limit: 255
44
- t.string "value", limit: 255
45
- t.datetime "created_at"
46
- t.datetime "updated_at"
40
+ create_table 'spud_user_settings', force: :cascade do |t|
41
+ t.integer 'spud_user_id', limit: 4
42
+ t.string 'key', limit: 255
43
+ t.string 'value', limit: 255
44
+ t.datetime 'created_at'
45
+ t.datetime 'updated_at'
47
46
  end
48
47
 
49
- create_table "spud_users", force: :cascade do |t|
50
- t.string "first_name", limit: 255
51
- t.string "last_name", limit: 255
52
- t.boolean "super_admin"
53
- t.string "login", limit: 255, null: false
54
- t.string "email", limit: 255, null: false
55
- t.string "crypted_password", limit: 255, null: false
56
- t.string "password_salt", limit: 255, null: false
57
- t.string "persistence_token", limit: 255, null: false
58
- t.string "single_access_token", limit: 255, null: false
59
- t.string "perishable_token", limit: 255, null: false
60
- t.integer "login_count", limit: 4, default: 0, null: false
61
- t.integer "failed_login_count", limit: 4, default: 0, null: false
62
- t.datetime "last_request_at"
63
- t.datetime "current_login_at"
64
- t.datetime "last_login_at"
65
- t.string "current_login_ip", limit: 255
66
- t.string "last_login_ip", limit: 255
67
- t.datetime "created_at"
68
- t.datetime "updated_at"
69
- t.string "time_zone", limit: 255
70
- t.integer "spud_role_id", limit: 4
71
- t.boolean "requires_password_change", default: false
48
+ create_table 'spud_users', force: :cascade do |t|
49
+ t.string 'first_name', limit: 255
50
+ t.string 'last_name', limit: 255
51
+ t.boolean 'super_admin'
52
+ t.string 'login', limit: 255, null: false
53
+ t.string 'email', limit: 255, null: false
54
+ t.string 'crypted_password', limit: 255, null: false
55
+ t.string 'password_salt', limit: 255, null: false
56
+ t.string 'persistence_token', limit: 255, null: false
57
+ t.string 'single_access_token', limit: 255, null: false
58
+ t.string 'perishable_token', limit: 255, null: false
59
+ t.integer 'login_count', limit: 4, default: 0, null: false
60
+ t.integer 'failed_login_count', limit: 4, default: 0, null: false
61
+ t.datetime 'last_request_at'
62
+ t.datetime 'current_login_at'
63
+ t.datetime 'last_login_at'
64
+ t.string 'current_login_ip', limit: 255
65
+ t.string 'last_login_ip', limit: 255
66
+ t.datetime 'created_at'
67
+ t.datetime 'updated_at'
68
+ t.string 'time_zone', limit: 255
69
+ t.integer 'spud_role_id', limit: 4
70
+ t.boolean 'requires_password_change', default: false
72
71
  end
73
72
 
74
- add_index "spud_users", ["email"], name: "index_spud_users_on_email", length: {"email"=>191}, using: :btree
75
- add_index "spud_users", ["login"], name: "index_spud_users_on_login", length: {"login"=>191}, using: :btree
76
- add_index "spud_users", ["spud_role_id"], name: "index_spud_users_on_spud_role_id", using: :btree
73
+ add_index 'spud_users', ['email'], name: 'index_spud_users_on_email', length: { 'email' => 191 }, using: :btree
74
+ add_index 'spud_users', ['login'], name: 'index_spud_users_on_login', length: { 'login' => 191 }, using: :btree
75
+ add_index 'spud_users', ['spud_role_id'], name: 'index_spud_users_on_spud_role_id', using: :btree
77
76
 
78
- create_table "tb_redirects", force: :cascade do |t|
79
- t.string "owner_type", limit: 255
80
- t.integer "owner_id", limit: 4
81
- t.string "source", limit: 255, null: false
82
- t.string "destination", limit: 255, null: false
83
- t.string "created_by", limit: 255
84
- t.datetime "created_at", null: false
85
- t.datetime "updated_at", null: false
77
+ create_table 'tb_redirects', force: :cascade do |t|
78
+ t.string 'owner_type', limit: 255
79
+ t.integer 'owner_id', limit: 4
80
+ t.string 'source', limit: 255, null: false
81
+ t.string 'destination', limit: 255, null: false
82
+ t.string 'created_by', limit: 255
83
+ t.datetime 'created_at', null: false
84
+ t.datetime 'updated_at', null: false
86
85
  end
87
86
 
88
- add_index "tb_redirects", ["owner_type", "owner_id"], name: "index_tb_redirects_on_owner_type_and_owner_id", length: {"owner_type"=>191, "owner_id"=>nil}, using: :btree
89
- add_index "tb_redirects", ["source"], name: "index_tb_redirects_on_source", unique: true, length: {"source"=>191}, using: :btree
87
+ add_index 'tb_redirects', ['owner_type', 'owner_id'], name: 'index_tb_redirects_on_owner_type_and_owner_id', length: { 'owner_type' => 191, 'owner_id' => nil }, using: :btree
88
+ add_index 'tb_redirects', ['source'], name: 'index_tb_redirects_on_source', unique: true, length: { 'source' => 191 }, using: :btree
90
89
 
91
- create_table "widgets", force: :cascade do |t|
92
- t.string "name", limit: 255
93
- t.datetime "created_at", null: false
94
- t.datetime "updated_at", null: false
90
+ create_table 'widgets', force: :cascade do |t|
91
+ t.string 'name', limit: 255
92
+ t.datetime 'created_at', null: false
93
+ t.datetime 'updated_at', null: false
95
94
  end
96
-
97
95
  end
@@ -2,8 +2,8 @@ FactoryGirl.define do
2
2
  factory :tb_redirect do
3
3
  owner_type nil
4
4
  owner_id nil
5
- sequence(:source){ |n| "/test-#{n}" }
6
- sequence(:destination){ |n| "/redirected-#{n}" }
5
+ sequence(:source) { |n| "/test-#{n}" }
6
+ sequence(:destination) { |n| "/redirected-#{n}" }
7
7
  created_by 'user'
8
8
  end
9
9
  end
@@ -1,7 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  RSpec.describe Admin::TbRedirectsHelper, type: :helper do
4
-
5
4
  describe '#created_by_for_tb_redirect' do
6
5
  it 'should return an info label' do
7
6
  result = helper.created_by_for_tb_redirect('user')
@@ -12,5 +11,4 @@ RSpec.describe Admin::TbRedirectsHelper, type: :helper do
12
11
  expect(result).to include('label-default')
13
12
  end
14
13
  end
15
-
16
14
  end
@@ -1,7 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  RSpec.describe TbRedirects::DetectRedirectLoopJob, type: :job do
4
-
5
4
  before do
6
5
  TbRedirect.skip_callback(:save, :after, :schedule_loop_detection)
7
6
  end
@@ -12,58 +11,57 @@ RSpec.describe TbRedirects::DetectRedirectLoopJob, type: :job do
12
11
  describe '#perform' do
13
12
  it 'should destroy a redirect' do
14
13
  redirects = TbRedirect.create([
15
- {:source => '/1', :destination => '/2', :created_by => 'user'},
16
- {:source => '/2', :destination => '/3', :created_by => 'user'},
17
- {:source => '/3', :destination => '/1', :created_by => 'user'}
18
- ])
19
- expect{
14
+ { source: '/1', destination: '/2', created_by: 'user' },
15
+ { source: '/2', destination: '/3', created_by: 'user' },
16
+ { source: '/3', destination: '/1', created_by: 'user' }
17
+ ])
18
+ expect do
20
19
  TbRedirects::DetectRedirectLoopJob.perform_now(redirects.first)
21
- }.to change(TbRedirect, :count).by(-1)
20
+ end.to change(TbRedirect, :count).by(-1)
22
21
  end
23
-
22
+
24
23
  it 'should not destroy anything' do
25
24
  redirects = TbRedirect.create([
26
- {:source => '/1', :destination => '/2', :created_by => 'user'},
27
- {:source => '/2', :destination => '/3', :created_by => 'user'},
28
- {:source => '/3', :destination => '/4', :created_by => 'user'}
29
- ])
30
- expect{
25
+ { source: '/1', destination: '/2', created_by: 'user' },
26
+ { source: '/2', destination: '/3', created_by: 'user' },
27
+ { source: '/3', destination: '/4', created_by: 'user' }
28
+ ])
29
+ expect do
31
30
  TbRedirects::DetectRedirectLoopJob.perform_now(redirects.first)
32
- }.to_not change(TbRedirect, :count)
31
+ end.to_not change(TbRedirect, :count)
33
32
  end
34
33
  end
35
34
 
36
35
  describe '#search_parent' do
37
36
  before(:each) do
38
37
  @redirects = TbRedirect.create([
39
- {:source => '/1', :destination => '/2', :created_by => 'user'},
40
- {:source => '/2', :destination => '/3', :created_by => 'user'},
41
- {:source => '/3', :destination => '/1', :created_by => 'user'}
42
- ])
38
+ { source: '/1', destination: '/2', created_by: 'user' },
39
+ { source: '/2', destination: '/3', created_by: 'user' },
40
+ { source: '/3', destination: '/1', created_by: 'user' }
41
+ ])
43
42
  @redirect = @redirects.first
44
43
  end
45
44
 
46
45
  it 'should destroy a redirect' do
47
46
  job = TbRedirects::DetectRedirectLoopJob.new(@redirect)
48
- expect{
47
+ expect do
49
48
  job.send(:search_parent, @redirects.second, @redirect.destination)
50
- }.to change(TbRedirect, :count).by(-1)
49
+ end.to change(TbRedirect, :count).by(-1)
51
50
  end
52
51
 
53
52
  it 'should continue searching' do
54
53
  job = TbRedirects::DetectRedirectLoopJob.new(@redirect)
55
- expect{
56
- job.send(:search_parent, @redirects.third, @redirect.destination)
57
- }.to change(job, :attempts).by(2)
54
+ expect do
55
+ job.send(:search_parent, @redirects.third, @redirect.destination)
56
+ end.to change(job, :attempts).by(2)
58
57
  end
59
58
 
60
59
  it 'should give up after MAX_ATTEMPTS' do
61
60
  job = TbRedirects::DetectRedirectLoopJob.new(@redirect)
62
- job.instance_variable_set(:@attempts, TbRedirects::DetectRedirectLoopJob::MAX_ATTEMPTS+1)
63
- expect{
61
+ job.instance_variable_set(:@attempts, TbRedirects::DetectRedirectLoopJob::MAX_ATTEMPTS + 1)
62
+ expect do
64
63
  job.send(:search_parent, @redirects.second, @redirect.destination)
65
- }.to raise_error(TbRedirects::DetectRedirectLoopJob::AttemptsExceeded)
64
+ end.to raise_error(TbRedirects::DetectRedirectLoopJob::AttemptsExceeded)
66
65
  end
67
66
  end
68
-
69
67
  end
@@ -1,77 +1,74 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  RSpec.describe TbRedirect, type: :model do
4
-
5
- describe '.find_by_uri' do
4
+ describe '.find_with_uri' do
6
5
  before(:each) do
7
- @sample_a = FactoryGirl.create(:tb_redirect, :source => '/test', :destination => '/redirected')
8
- @sample_b = FactoryGirl.create(:tb_redirect, :source => 'http://test.com/blog', :destination => '/redirected')
9
- @sample_c = FactoryGirl.create(:tb_redirect, :source => 'http://test.com/about', :destination => '/redirected')
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')
10
9
  end
11
10
 
12
11
  it 'should find a record where the path matches' do
13
- result = TbRedirect.find_by_uri('http://google.com/test')
12
+ result = TbRedirect.find_with_uri('http://google.com/test')
14
13
  expect(result).to eq(@sample_a)
15
14
  end
16
15
 
17
16
  it 'should find a record where the full URI matches' do
18
- result = TbRedirect.find_by_uri('http://test.com/blog')
17
+ result = TbRedirect.find_with_uri('http://test.com/blog')
19
18
  expect(result).to eq(@sample_b)
20
19
  end
21
20
 
22
21
  it 'should find no records' do
23
- result = TbRedirect.find_by_uri('http://test.com/contact')
22
+ result = TbRedirect.find_with_uri('http://test.com/contact')
24
23
  expect(result).to eq(nil)
25
24
  end
26
25
 
27
26
  it 'should catch an invalid URI error' do
28
- expect{
29
- TbRedirect.find_by_uri('%!&*')
30
- }.to_not raise_error
27
+ expect do
28
+ TbRedirect.find_with_uri('%!&*')
29
+ end.to_not raise_error
31
30
  end
32
-
33
31
  end
34
32
 
35
33
  describe '.create_smart' do
36
34
  it 'should create a new redirect' do
37
35
  redirect_1 = FactoryGirl.create(:tb_redirect)
38
- expect{
39
- redirect_2 = TbRedirect.create_smart(FactoryGirl.attributes_for(:tb_redirect, :source => '/new'))
40
- }.to change(TbRedirect, :count).by(1)
36
+ expect do
37
+ redirect_2 = TbRedirect.create_smart(FactoryGirl.attributes_for(:tb_redirect, source: '/new'))
38
+ end.to change(TbRedirect, :count).by(1)
41
39
  end
42
40
 
43
41
  it 'should update an existing redirect' do
44
42
  redirect_1 = FactoryGirl.create(:tb_redirect)
45
- expect{
46
- redirect_2 = TbRedirect.create_smart(FactoryGirl.attributes_for(:tb_redirect, :source => redirect_1.source))
47
- }.to_not change(TbRedirect, :count)
43
+ expect do
44
+ redirect_2 = TbRedirect.create_smart(FactoryGirl.attributes_for(:tb_redirect, source: redirect_1.source))
45
+ end.to_not change(TbRedirect, :count)
48
46
  end
49
47
  end
50
48
 
51
49
  describe '#source_not_equals_destination' do
52
50
  it 'should not allow the source and destination to be equal' do
53
- redirect_1 = FactoryGirl.build(:tb_redirect, :source => 'a', :destination => 'a')
51
+ redirect_1 = FactoryGirl.build(:tb_redirect, source: 'a', destination: 'a')
54
52
  expect(redirect_1).to be_invalid
55
53
  end
56
54
  end
57
55
 
58
56
  describe '#destroy_opposite_redirect' do
59
57
  it 'should destroy the other redirect' do
60
- redirect_1 = FactoryGirl.build(:tb_redirect, :source => 'a', :destination => 'b')
61
- redirect_2 = FactoryGirl.build(:tb_redirect, :source => 'b', :destination => 'a')
62
- expect{
58
+ redirect_1 = FactoryGirl.build(:tb_redirect, source: 'a', destination: 'b')
59
+ redirect_2 = FactoryGirl.build(:tb_redirect, source: 'b', destination: 'a')
60
+ expect do
63
61
  redirect_1.reload
64
- }.to raise_error(ActiveRecord::RecordNotFound)
62
+ end.to raise_error(ActiveRecord::RecordNotFound)
65
63
  end
66
64
  end
67
65
 
68
66
  describe '#schedule_loop_detection' do
69
67
  it 'should schedule a job' do
70
68
  parent = FactoryGirl.create(:tb_redirect)
71
- expect{
72
- FactoryGirl.create(:tb_redirect, :source => parent.destination)
73
- }.to have_enqueued_job(TbRedirects::DetectRedirectLoopJob)
69
+ expect do
70
+ FactoryGirl.create(:tb_redirect, source: parent.destination)
71
+ end.to have_enqueued_job(TbRedirects::DetectRedirectLoopJob)
74
72
  end
75
73
  end
76
-
77
74
  end
data/spec/rails_helper.rb CHANGED
@@ -3,13 +3,14 @@ SimpleCov.start 'rails'
3
3
 
4
4
  # This file is copied to spec/ when you run 'rails generate rspec:install'
5
5
  ENV['RAILS_ENV'] ||= 'test'
6
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
6
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
7
7
 
8
8
  # Prevent database truncation if the environment is production
9
- abort("The Rails environment is running in production mode!") if Rails.env.production?
9
+ abort('The Rails environment is running in production mode!') if Rails.env.production?
10
10
 
11
11
  require 'spec_helper'
12
12
  require 'rspec/rails'
13
+ require 'rails-controller-testing'
13
14
  require 'database_cleaner'
14
15
  require 'factory_girl_rails'
15
16
  require 'tb_core/test_helper'
@@ -36,6 +37,12 @@ require 'tb_core/test_helper'
36
37
  # ActiveRecord::Migration.maintain_test_schema!
37
38
 
38
39
  RSpec.configure do |config|
40
+ [:controller, :view, :request].each do |type|
41
+ config.include ::Rails::Controller::Testing::TestProcess, type: type
42
+ config.include ::Rails::Controller::Testing::TemplateAssertions, type: type
43
+ config.include ::Rails::Controller::Testing::Integration, type: type
44
+ end
45
+
39
46
  config.infer_base_class_for_anonymous_controllers = false
40
47
 
41
48
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
@@ -74,5 +81,4 @@ RSpec.configure do |config|
74
81
  example.run
75
82
  end
76
83
  end
77
-
78
84
  end
data/spec/spec_helper.rb CHANGED
@@ -40,53 +40,51 @@ RSpec.configure do |config|
40
40
  mocks.verify_partial_doubles = true
41
41
  end
42
42
 
43
- # The settings below are suggested to provide a good initial experience
44
- # with RSpec, but feel free to customize to your heart's content.
45
- =begin
46
- # These two settings work together to allow you to limit a spec run
47
- # to individual examples or groups you care about by tagging them with
48
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
- # get run.
50
- config.filter_run :focus
51
- config.run_all_when_everything_filtered = true
52
-
53
- # Allows RSpec to persist some state between runs in order to support
54
- # the `--only-failures` and `--next-failure` CLI options. We recommend
55
- # you configure your source control system to ignore this file.
56
- config.example_status_persistence_file_path = "spec/examples.txt"
57
-
58
- # Limits the available syntax to the non-monkey patched syntax that is
59
- # recommended. For more details, see:
60
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
61
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
63
- config.disable_monkey_patching!
64
-
65
- # Many RSpec users commonly either run the entire suite or an individual
66
- # file, and it's useful to allow more verbose output when running an
67
- # individual spec file.
68
- if config.files_to_run.one?
69
- # Use the documentation formatter for detailed output,
70
- # unless a formatter has already been configured
71
- # (e.g. via a command-line flag).
72
- config.default_formatter = 'doc'
73
- end
74
-
75
- # Print the 10 slowest examples and example groups at the
76
- # end of the spec run, to help surface which specs are running
77
- # particularly slow.
78
- config.profile_examples = 10
79
-
80
- # Run specs in random order to surface order dependencies. If you find an
81
- # order dependency and want to debug it, you can fix the order by providing
82
- # the seed, which is printed after each run.
83
- # --seed 1234
84
- config.order = :random
85
-
86
- # Seed global randomization in this process using the `--seed` CLI option.
87
- # Setting this allows you to use `--seed` to deterministically reproduce
88
- # test failures related to randomization by passing the same `--seed` value
89
- # as the one that triggered the failure.
90
- Kernel.srand config.seed
91
- =end
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ # # These two settings work together to allow you to limit a spec run
46
+ # # to individual examples or groups you care about by tagging them with
47
+ # # `:focus` metadata. When nothing is tagged with `:focus`, all examples
48
+ # # get run.
49
+ # config.filter_run :focus
50
+ # config.run_all_when_everything_filtered = true
51
+ #
52
+ # # Allows RSpec to persist some state between runs in order to support
53
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
54
+ # # you configure your source control system to ignore this file.
55
+ # config.example_status_persistence_file_path = "spec/examples.txt"
56
+ #
57
+ # # Limits the available syntax to the non-monkey patched syntax that is
58
+ # # recommended. For more details, see:
59
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
60
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
61
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
62
+ # config.disable_monkey_patching!
63
+ #
64
+ # # Many RSpec users commonly either run the entire suite or an individual
65
+ # # file, and it's useful to allow more verbose output when running an
66
+ # # individual spec file.
67
+ # if config.files_to_run.one?
68
+ # # Use the documentation formatter for detailed output,
69
+ # # unless a formatter has already been configured
70
+ # # (e.g. via a command-line flag).
71
+ # config.default_formatter = 'doc'
72
+ # end
73
+ #
74
+ # # Print the 10 slowest examples and example groups at the
75
+ # # end of the spec run, to help surface which specs are running
76
+ # # particularly slow.
77
+ # config.profile_examples = 10
78
+ #
79
+ # # Run specs in random order to surface order dependencies. If you find an
80
+ # # order dependency and want to debug it, you can fix the order by providing
81
+ # # the seed, which is printed after each run.
82
+ # # --seed 1234
83
+ # config.order = :random
84
+ #
85
+ # # Seed global randomization in this process using the `--seed` CLI option.
86
+ # # Setting this allows you to use `--seed` to deterministically reproduce
87
+ # # test failures related to randomization by passing the same `--seed` value
88
+ # # as the one that triggered the failure.
89
+ # Kernel.srand config.seed
92
90
  end