bsm_oa 0.3.1

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 (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +3 -0
  5. data/Gemfile.lock +180 -0
  6. data/Rakefile +21 -0
  7. data/app/controllers/bsm_oa/accounts_controller.rb +12 -0
  8. data/app/controllers/bsm_oa/applications_controller.rb +35 -0
  9. data/app/controllers/bsm_oa/authorizations_controller.rb +80 -0
  10. data/app/controllers/bsm_oa/roles_controller.rb +58 -0
  11. data/app/views/bsm_oa/accounts/show.json.jbuilder +7 -0
  12. data/app/views/bsm_oa/applications/_application.html.erb +15 -0
  13. data/app/views/bsm_oa/applications/_application.json.jbuilder +1 -0
  14. data/app/views/bsm_oa/applications/_inputs.html.erb +11 -0
  15. data/app/views/bsm_oa/applications/create.json.jbuilder +1 -0
  16. data/app/views/bsm_oa/applications/edit.html.erb +10 -0
  17. data/app/views/bsm_oa/applications/index.html.erb +24 -0
  18. data/app/views/bsm_oa/applications/index.json.jbuilder +1 -0
  19. data/app/views/bsm_oa/applications/new.html.erb +10 -0
  20. data/app/views/bsm_oa/applications/show.json.jbuilder +1 -0
  21. data/app/views/bsm_oa/applications/update.json.jbuilder +1 -0
  22. data/app/views/bsm_oa/authorizations/_authorization.json.jbuilder +1 -0
  23. data/app/views/bsm_oa/authorizations/_inputs.html.erb +2 -0
  24. data/app/views/bsm_oa/authorizations/edit.html.erb +10 -0
  25. data/app/views/bsm_oa/authorizations/index.html.erb +0 -0
  26. data/app/views/bsm_oa/authorizations/index.json.jbuilder +1 -0
  27. data/app/views/bsm_oa/authorizations/new.html.erb +11 -0
  28. data/app/views/bsm_oa/authorizations/toggle.js.erb +9 -0
  29. data/app/views/bsm_oa/authorizations/toggle.json.jbuilder +1 -0
  30. data/app/views/bsm_oa/roles/_authorization.html.erb +17 -0
  31. data/app/views/bsm_oa/roles/_inputs.html.erb +5 -0
  32. data/app/views/bsm_oa/roles/_role.html.erb +16 -0
  33. data/app/views/bsm_oa/roles/_role.json.jbuilder +2 -0
  34. data/app/views/bsm_oa/roles/create.json.jbuilder +1 -0
  35. data/app/views/bsm_oa/roles/edit.html.erb +10 -0
  36. data/app/views/bsm_oa/roles/index.html.erb +19 -0
  37. data/app/views/bsm_oa/roles/index.json.jbuilder +2 -0
  38. data/app/views/bsm_oa/roles/new.html.erb +10 -0
  39. data/app/views/bsm_oa/roles/show.html.erb +41 -0
  40. data/app/views/bsm_oa/roles/show.json.jbuilder +1 -0
  41. data/app/views/bsm_oa/roles/update.json.jbuilder +1 -0
  42. data/bsm_oa.gemspec +37 -0
  43. data/config.ru +7 -0
  44. data/db/migrate/20150507113313_bsm_oa_create_doorkeeper_tables.rb +43 -0
  45. data/db/migrate/20150513155732_bsm_oa_create_tables.rb +16 -0
  46. data/lib/bsm_oa/application_mixin.rb +37 -0
  47. data/lib/bsm_oa/authorization.rb +49 -0
  48. data/lib/bsm_oa/config.rb +19 -0
  49. data/lib/bsm_oa/engine.rb +27 -0
  50. data/lib/bsm_oa/role.rb +28 -0
  51. data/lib/bsm_oa/routes.rb +24 -0
  52. data/lib/bsm_oa/version.rb +3 -0
  53. data/lib/bsm_oa.rb +25 -0
  54. data/spec/controllers/bsm_oa/accounts_controller_spec.rb +35 -0
  55. data/spec/controllers/bsm_oa/applications_controller_spec.rb +114 -0
  56. data/spec/controllers/bsm_oa/authorizations_controller_spec.rb +164 -0
  57. data/spec/controllers/bsm_oa/roles_controller_spec.rb +140 -0
  58. data/spec/factories.rb +23 -0
  59. data/spec/internal/config/database.yml +3 -0
  60. data/spec/internal/config/routes.rb +3 -0
  61. data/spec/internal/db/combustion_test.sqlite +0 -0
  62. data/spec/internal/db/schema.rb +13 -0
  63. data/spec/internal/log/.gitignore +1 -0
  64. data/spec/internal/public/favicon.ico +0 -0
  65. data/spec/lib/bsm_oa/application_mixin_spec.rb +48 -0
  66. data/spec/lib/bsm_oa/authorization_spec.rb +53 -0
  67. data/spec/lib/bsm_oa/config_spec.rb +20 -0
  68. data/spec/lib/bsm_oa/role_spec.rb +22 -0
  69. data/spec/spec_helper.rb +64 -0
  70. metadata +372 -0
@@ -0,0 +1,164 @@
1
+ require 'spec_helper'
2
+
3
+ describe BsmOa::AuthorizationsController, type: :controller do
4
+
5
+ let(:role) { create :role }
6
+ let(:resource) { create :authorization, role: role }
7
+
8
+ describe 'routing' do
9
+ it { is_expected.to route(:get, "/roles/1/authorizations").to(action: :index, bsm_oa_role_id: 1) }
10
+ it { is_expected.to route(:get, "/roles/1/authorizations/new").to(action: :new, bsm_oa_role_id: 1) }
11
+ it { is_expected.to route(:post, "/roles/1/authorizations").to(action: :create, bsm_oa_role_id: 1) }
12
+ it { is_expected.to route(:get, "/authorizations/1").to(action: :show, id: 1) }
13
+ it { is_expected.to route(:put, "/authorizations/1").to(action: :update, id: 1) }
14
+ it { is_expected.to route(:get, "/authorizations/1/edit").to(action: :edit, id: 1) }
15
+ it { is_expected.to route(:delete, "/authorizations/1").to(action: :destroy, id: 1) }
16
+ it { is_expected.to route(:put, "/authorizations/1/toggle/admin").to(action: :toggle, id: 1, permission: "admin") }
17
+ end
18
+
19
+ describe 'GET index.json' do
20
+ before do
21
+ resource
22
+ get :index, bsm_oa_role_id: role.to_param, format: 'json'
23
+ end
24
+
25
+ it { is_expected.to respond_with(:success) }
26
+ it { expect(response.body).to have_json_size(1) }
27
+ it { expect(response.body).to have_json_size(3).at_path('0') }
28
+ end
29
+
30
+ describe 'GET index.html' do
31
+ before do
32
+ resource
33
+ get :index, bsm_oa_role_id: role.to_param
34
+ end
35
+
36
+ it { is_expected.to render_template(:index) }
37
+ it { is_expected.to respond_with(:success) }
38
+ end
39
+
40
+ describe 'GET new.html' do
41
+ before do
42
+ get :new, bsm_oa_role_id: role.to_param
43
+ end
44
+ it { is_expected.to render_template(:new) }
45
+ it { is_expected.to respond_with(:success) }
46
+ end
47
+
48
+ describe 'GET show.html' do
49
+ before do
50
+ get :show, id: resource.to_param
51
+ end
52
+ it { is_expected.to redirect_to("/roles/#{resource.role.to_param}") }
53
+ end
54
+
55
+ describe 'GET show.json' do
56
+ before do
57
+ get :show, id: resource.to_param, format: "json"
58
+ end
59
+ it { is_expected.to respond_with(:success) }
60
+ it { expect(response.body).to have_json_size(4) }
61
+ end
62
+
63
+ describe 'GET edit.html' do
64
+ before do
65
+ get :edit, id: resource.to_param
66
+ end
67
+ it { is_expected.to render_template(:edit) }
68
+ it { is_expected.to respond_with(:success) }
69
+ end
70
+
71
+ describe 'POST create.json (successful)' do
72
+ before do
73
+ role = create(:role)
74
+ post :create, format: 'json', bsm_oa_role_id: role.to_param, authorization: resource.attributes.merge( permissions_string: 'admin')
75
+ end
76
+
77
+ it { is_expected.to respond_with(:created) }
78
+ it { expect(response.body).to have_json_size(4) }
79
+ end
80
+
81
+ describe 'POST create.html (successful)' do
82
+ before do
83
+ role = create(:role)
84
+ post :create, authorization: resource.attributes.merge( permissions_string: 'admin'), bsm_oa_role_id: role.to_param
85
+ end
86
+
87
+ it { is_expected.to respond_with(:redirect) }
88
+ it { is_expected.to redirect_to("/authorizations/#{BsmOa::Authorization.last.to_param}") }
89
+ end
90
+
91
+ describe 'POST create.html (unsuccessful)' do
92
+ before do
93
+ role = create(:role)
94
+ post :create, bsm_oa_role_id: role.to_param, authorization: { application_id: '' }
95
+ end
96
+
97
+ it { is_expected.to respond_with(:success) }
98
+ it { is_expected.to render_template(:new) }
99
+ end
100
+
101
+ describe 'PUT update.html (successful)' do
102
+ before do
103
+ put :update, id: resource.to_param, authorization: { permissions_string: 'admin' }
104
+ end
105
+
106
+ it { is_expected.to respond_with(:redirect) }
107
+ it { is_expected.to redirect_to("/authorizations/#{BsmOa::Authorization.last.to_param}") }
108
+ end
109
+
110
+ describe 'PUT update.html (unsuccessful)' do
111
+ before do
112
+ put :update, id: resource.to_param, authorization: { application_id: '0' }
113
+ end
114
+
115
+ it { is_expected.to respond_with(:success) }
116
+ it { is_expected.to render_template(:edit) }
117
+ end
118
+
119
+ describe 'PUT update.json (successful)' do
120
+ before do
121
+ put :update, format: 'json', id: resource.to_param, authorization: { permissions_string: 'admin' }
122
+ end
123
+
124
+ it { is_expected.to respond_with(:no_content) }
125
+ end
126
+
127
+ describe 'PUT update.json (unsuccessful)' do
128
+ before do
129
+ put :update, format: 'json', id: resource.to_param, authorization: { application_id: '0' }
130
+ end
131
+
132
+ it { is_expected.to respond_with(:unprocessable_entity) }
133
+ end
134
+
135
+ describe 'PUT toggle' do
136
+ before do
137
+ put :toggle, id: resource.to_param, permission: "admin"
138
+ end
139
+
140
+ it { is_expected.to respond_with(:redirect) }
141
+ it { is_expected.to redirect_to("/authorizations/1") }
142
+ end
143
+
144
+ describe 'PUT toggle.js' do
145
+ before do
146
+ put :toggle, id: resource.to_param, permission: "admin", format: "js"
147
+ end
148
+
149
+ it { is_expected.to respond_with(:success) }
150
+ it { expect(resource.reload.permissions).to be_empty }
151
+ end
152
+
153
+ describe 'PUT toggle.json' do
154
+ before do
155
+ put :toggle, id: resource.to_param, permission: "admin", format: "json"
156
+ end
157
+
158
+ it { is_expected.to respond_with(:success) }
159
+ it { expect(response.body).to have_json_size(4) }
160
+ end
161
+
162
+ end
163
+
164
+
@@ -0,0 +1,140 @@
1
+ require 'spec_helper'
2
+
3
+ describe BsmOa::RolesController, type: :controller do
4
+
5
+ let(:resource) { create :role }
6
+ let(:user) { create :user }
7
+
8
+ describe 'routing' do
9
+ it { is_expected.to route(:get, "/roles").to(action: :index) }
10
+ it { is_expected.to route(:get, "/roles/new").to(action: :new) }
11
+ it { is_expected.to route(:get, "/roles/1").to(action: :show, id: 1) }
12
+ it { is_expected.to route(:get, "/roles/1/edit").to(action: :edit, id: 1) }
13
+ it { is_expected.to route(:post, "/roles").to(action: :create) }
14
+ it { is_expected.to route(:put, "/roles/1").to(action: :update, id: 1) }
15
+ end
16
+
17
+ describe 'GET index.json' do
18
+ before do
19
+ resource
20
+ get :index, format: 'json'
21
+ end
22
+
23
+ it { is_expected.to respond_with(:success) }
24
+ it { expect(response.body).to have_json_size(1) }
25
+ end
26
+
27
+ describe 'GET show.json' do
28
+ before do
29
+ get :show, id: resource.to_param, format: 'json'
30
+ end
31
+
32
+ it { is_expected.to respond_with(:success) }
33
+ it { expect(response.body).to have_json_size(2) }
34
+ end
35
+
36
+ describe 'POST create.json (successful)' do
37
+ before do
38
+ post :create, format: 'json', role: resource.attributes.merge(name: "admin")
39
+ end
40
+
41
+ it { is_expected.to respond_with(:success) }
42
+ end
43
+
44
+ describe 'PUT update.json (successful)' do
45
+ before do
46
+ post :update, format: 'json', id: resource.to_param, role: { name: "newname"}
47
+ end
48
+
49
+ it { is_expected.to respond_with(:success) }
50
+ end
51
+
52
+ describe 'GET index.html' do
53
+ before do
54
+ get :index
55
+ end
56
+
57
+ it { is_expected.to render_template(:index) }
58
+ it { is_expected.to respond_with(:success) }
59
+ end
60
+
61
+ describe 'GET show.html' do
62
+ before do
63
+ get :show, id: resource.to_param
64
+ end
65
+
66
+ it { is_expected.to render_template(:show) }
67
+ it { is_expected.to respond_with(:success) }
68
+ end
69
+
70
+ describe 'GET edit.html' do
71
+ before do
72
+ get :edit, id: resource.to_param
73
+ end
74
+ it { is_expected.to render_template(:edit) }
75
+ it { is_expected.to respond_with(:success) }
76
+ end
77
+
78
+ describe 'GET new.html' do
79
+ before do
80
+ get :new
81
+ end
82
+ it { is_expected.to render_template(:new) }
83
+ it { is_expected.to respond_with(:success) }
84
+ end
85
+
86
+ describe 'POST create.html (successful)' do
87
+ before do
88
+ post :create, role: resource.attributes.merge(name: "newname")
89
+ end
90
+ it { is_expected.to respond_with(:redirect) }
91
+ it { is_expected.to redirect_to("http://test.host/roles/#{BsmOa::Role.last.to_param}") }
92
+ end
93
+
94
+ describe 'POST create.html (unsuccessful)' do
95
+ before do
96
+ post :create, role: resource.attributes
97
+ end
98
+
99
+ it { is_expected.to respond_with(:success) }
100
+ it { is_expected.to render_template(:new) }
101
+ end
102
+
103
+ describe 'PUT update.html (successful)' do
104
+ before do
105
+ post :update, id: resource.to_param, role: { name: "newname"}
106
+ end
107
+
108
+ it { is_expected.to respond_with(:redirect) }
109
+ it { is_expected.to redirect_to("http://test.host/roles/#{resource.to_param}") }
110
+ end
111
+
112
+ describe 'PUT update.html (unsuccessful)' do
113
+ before do
114
+ put :update, id: resource.to_param, role: { name: "" }
115
+ end
116
+
117
+ it { is_expected.to respond_with(:success) }
118
+ it { is_expected.to render_template(:edit) }
119
+ end
120
+
121
+ describe 'DELETE destroy.json' do
122
+ before do
123
+ delete :destroy, format: 'json', id: resource.to_param
124
+ end
125
+
126
+ it { is_expected.to respond_with(:no_content) }
127
+ end
128
+
129
+ describe 'DELETE destroy.html' do
130
+ before do
131
+ delete :destroy, id: resource.to_param
132
+ end
133
+
134
+ it { is_expected.to respond_with(:redirect) }
135
+ it { is_expected.to redirect_to("http://test.host/roles") }
136
+ end
137
+
138
+ end
139
+
140
+
data/spec/factories.rb ADDED
@@ -0,0 +1,23 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :application, class: Doorkeeper::Application do
4
+ sequence(:name) { |n| "Application #{n}" }
5
+ redirect_uri 'https://app.com/callback'
6
+ permissions ['admin', 'finance', 'operations']
7
+ end
8
+
9
+ factory :authorization, class: BsmOa::Authorization do
10
+ role
11
+ application
12
+ permissions ['admin']
13
+ end
14
+
15
+ factory :role, class: BsmOa::Role do
16
+ name { Faker::Lorem.word }
17
+ end
18
+
19
+ factory :user do
20
+ email { Faker::Internet.email }
21
+ end
22
+
23
+ end
@@ -0,0 +1,3 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/combustion_test.sqlite
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount_bsm_oa
3
+ end
@@ -0,0 +1,13 @@
1
+ ActiveRecord::Schema.define do
2
+
3
+ create_table :users do |t|
4
+ t.string :email
5
+ end
6
+
7
+ create_table :roles_users, id: false do |t|
8
+ t.integer :role_id
9
+ t.integer :user_id
10
+ end
11
+ add_index :roles_users, [:role_id, :user_id], unique: true
12
+
13
+ end
@@ -0,0 +1 @@
1
+ *.log
File without changes
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe Doorkeeper::Application, type: :model do
4
+
5
+ it { is_expected.to have_many(:authorizations).dependent(:destroy) }
6
+ it { is_expected.to have_many(:roles).through(:authorizations) }
7
+
8
+ it { is_expected.to serialize(:permissions) }
9
+
10
+ ['valid', 'VALID', 'v4lid'].each do |val|
11
+ it { is_expected.to allow_value([val]).for(:permissions) }
12
+ end
13
+
14
+ ['inv&lid', 'not valid'].each do |val|
15
+ it { is_expected.not_to allow_value([val]).for(:permissions) }
16
+ end
17
+
18
+ it 'should have default secret and uid attributes' do
19
+ app = create(:application, secret: nil, uid: nil)
20
+ expect(app.secret).to_not be_nil
21
+ expect(app.uid).to_not be_nil
22
+ end
23
+
24
+ it 'should all secret and uid to be user set' do
25
+ app = create(:application, secret: 'secr3t', uid: 'nexusU1D')
26
+ expect(app.secret).to eq('secr3t')
27
+ expect(app.uid).to eq('nexusU1D')
28
+ end
29
+
30
+ it 'should normalize permissions' do
31
+ app = create(:application, permissions: ['admin', 'Finance', ' employee ', ''])
32
+ expect(app.permissions).to eq ['admin', 'finance', 'employee']
33
+ end
34
+
35
+ it 'should set and return string of permissions' do
36
+ app = create(:application)
37
+ app.permissions_string = 'admin, finance, employee'
38
+ expect(app.permissions).to eq ['admin', 'finance', 'employee']
39
+ expect(app.permissions_string).to eq 'admin employee finance'
40
+ end
41
+
42
+ it 'should scope ordered' do
43
+ create(:application)
44
+ expect(described_class.ordered.size).to eq(1)
45
+ end
46
+
47
+ end
48
+
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe BsmOa::Authorization, type: :model do
4
+
5
+ it { is_expected.to belong_to(:role) }
6
+ it { is_expected.to belong_to(:application) }
7
+
8
+ it { is_expected.to validate_presence_of :role }
9
+ it { is_expected.to validate_presence_of :role_id }
10
+ it { is_expected.to validate_presence_of :application }
11
+ it { is_expected.to validate_presence_of :application_id }
12
+
13
+ describe 'uniqueness validation' do
14
+ subject { build(:authorization) }
15
+ it { is_expected.to validate_uniqueness_of(:application_id).scoped_to(:role_id) }
16
+ end
17
+
18
+ it { is_expected.to serialize(:permissions) }
19
+
20
+ it 'should set and return string of permissions' do
21
+ subject = create(:authorization)
22
+ subject.permissions_string = 'admin operations finance'
23
+ expect(subject.permissions).to eq ['admin', 'operations', 'finance']
24
+ expect(subject.permissions_string).to eq 'admin finance operations'
25
+ end
26
+
27
+ it 'should normalize permissions' do
28
+ subject = create(:authorization)
29
+ subject.permissions = ["admin ", "Finance", "operatiOns", "unknown"]
30
+ expect(subject).to be_valid
31
+ expect(subject.permissions).to eq ['admin', 'finance', 'operations']
32
+ end
33
+
34
+ it 'should have ordered scope' do
35
+ create(:authorization)
36
+ expect(described_class.ordered.size).to eq(1)
37
+ end
38
+
39
+ describe 'toggle' do
40
+ let(:authorization) { create :authorization}
41
+
42
+ it 'should toggle adding permissions' do
43
+ authorization.toggle('finance')
44
+ expect(authorization.reload.permissions).to eq(['admin', 'finance'])
45
+ end
46
+ it 'should toggle removing permissions' do
47
+ authorization.toggle('admin')
48
+ expect(authorization.reload.permissions).to eq([])
49
+ end
50
+ end
51
+ end
52
+
53
+
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe BsmOa::Config do
4
+
5
+ it "should have defaults" do
6
+ expect(subject.user_class).to eq(::User)
7
+ expect(subject.user_attrs).to eq([:id, :email])
8
+ end
9
+
10
+ it "should set custom user classes" do
11
+ subject.user_class "String"
12
+ expect(subject.user_class).to eq(::String)
13
+ end
14
+
15
+ it "should set custom user attributes" do
16
+ subject.user_attrs :id, :name, :admin
17
+ expect(subject.user_attrs).to eq([:id, :name, :admin])
18
+ end
19
+
20
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe BsmOa::Role, type: :model do
4
+
5
+ it { is_expected.to have_many(:authorizations).dependent(:destroy) }
6
+ it { is_expected.to have_many(:applications).through(:authorizations) }
7
+
8
+ it { is_expected.to validate_presence_of(:name) }
9
+ it { is_expected.to validate_length_of(:name).is_at_most(80) }
10
+ it { is_expected.to validate_uniqueness_of(:name).case_insensitive }
11
+
12
+ it 'should have ordered scope' do
13
+ create(:role)
14
+ expect(described_class.ordered.length).to eq(1)
15
+ end
16
+
17
+ it 'should normalize name attribute' do
18
+ subject = create(:role, name: ' Something ')
19
+ expect(subject.name).to eq('Something')
20
+ end
21
+
22
+ end
@@ -0,0 +1,64 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ $LOAD_PATH.unshift File.expand_path('..', __FILE__)
4
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
5
+ $LOAD_PATH.unshift File.expand_path('../../app', __FILE__)
6
+
7
+ # Initialize combustion
8
+ require 'combustion'
9
+ Combustion.initialize! :active_record do
10
+
11
+ Doorkeeper.configure do
12
+ orm :active_record
13
+ end
14
+
15
+ SimpleForm.setup do |_|
16
+ end
17
+
18
+ end
19
+
20
+ # Internal app
21
+ class User < ActiveRecord::Base
22
+ has_and_belongs_to_many :roles, class_name: "BsmOa::Role", join_table: 'roles_users'
23
+ has_many :authorizations, through: :roles, class_name: "BsmOa::Authorization"
24
+ end
25
+
26
+ # Load rspec
27
+ require 'rspec/rails'
28
+ require 'shoulda-matchers'
29
+ require 'json_spec'
30
+ require 'factory_girl'
31
+ require 'faker'
32
+ require 'database_cleaner'
33
+
34
+ RSpec.configure do |config|
35
+ config.use_transactional_fixtures = true
36
+ config.infer_spec_type_from_file_location!
37
+ config.render_views
38
+
39
+ config.before :suite do
40
+ silence_stream(STDOUT) do
41
+ ActiveRecord::Migrator.migrate(File.expand_path('../../db/migrate', __FILE__), nil)
42
+ end
43
+ FactoryGirl.find_definitions
44
+ end
45
+
46
+ config.before :suite do
47
+ DatabaseCleaner.strategy = :transaction
48
+ DatabaseCleaner.clean_with :truncation
49
+ end
50
+
51
+ config.around :each do |example|
52
+ DatabaseCleaner.cleaning { example.run }
53
+ end
54
+
55
+ config.expect_with :rspec do |expectations|
56
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
57
+ end
58
+ config.mock_with :rspec do |mocks|
59
+ mocks.verify_partial_doubles = true
60
+ end
61
+
62
+ config.include FactoryGirl::Syntax::Methods
63
+ config.include JsonSpec::Helpers
64
+ end