strongbolt 0.3.10 → 0.3.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cae9f523b7f4e7e3e8a20d8e1dce761dff86ed09
4
- data.tar.gz: 5541d8ac7cbf7f88f264c0b516cdbd11a4d297a0
3
+ metadata.gz: 04c6781eb3dc1e89763dde9b772544073a3c7887
4
+ data.tar.gz: 191d6718c038d50f560bc884ac7e50e8bda654e7
5
5
  SHA512:
6
- metadata.gz: 89eecd3ddf5d3c503e154c6405121530d163d40e742bdf3a30fd6a368526377052bfc9223666e70ab03238130e39755ff177cace84790e4a8c5da8343abdc526
7
- data.tar.gz: 57ad08612046396dc58ed27161ee3525afe978cad2cf800f228e94f28aa14e96923da2525f292a871994c3171da65f057c36c42b5bae8cd2efba4027c38365b1
6
+ metadata.gz: b5e64a50b34279a805358c3a04fad85ab8beb152c41123537ce8fab87e94efb7a42003875a5b4e66020d6e7fc2ebea0d6dffc049661ddba92f84433f1a495378
7
+ data.tar.gz: cad32f04c2e40d01a7f2784b5282645f7b6712423038a80498de2c056baf8f998b523558b606a264b1c5f26c689450d597ecc4cc2adb81d2f2481682cef308da
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongbolt (0.3.9)
5
- awesome_nested_set (~> 3.0.0)
4
+ strongbolt (0.3.11)
5
+ awesome_nested_set (~> 3.1.0)
6
6
  grant (~> 3.0)
7
7
  simple_form (~> 3.0)
8
8
 
@@ -36,8 +36,8 @@ GEM
36
36
  thread_safe (~> 0.1)
37
37
  tzinfo (~> 1.1)
38
38
  arel (5.0.1.20140414130214)
39
- awesome_nested_set (3.0.3)
40
- activerecord (>= 4.0.0, < 5)
39
+ awesome_nested_set (3.1.1)
40
+ activerecord (>= 4.0.0, < 5.1)
41
41
  builder (3.2.2)
42
42
  concurrent-ruby (1.0.2)
43
43
  database_cleaner (1.5.3)
@@ -53,10 +53,10 @@ GEM
53
53
  json (1.8.3)
54
54
  mail (2.6.4)
55
55
  mime-types (>= 1.16, < 4)
56
- mime-types (3.0)
56
+ mime-types (3.1)
57
57
  mime-types-data (~> 3.2015)
58
- mime-types-data (3.2016.0221)
59
- minitest (5.8.4)
58
+ mime-types-data (3.2016.0521)
59
+ minitest (5.9.0)
60
60
  rack (1.5.5)
61
61
  rack-test (0.6.3)
62
62
  rack (>= 1.0)
@@ -75,34 +75,35 @@ GEM
75
75
  activesupport (= 4.1.15)
76
76
  rake (>= 0.8.7)
77
77
  thor (>= 0.18.1, < 2.0)
78
- rake (11.1.2)
79
- rspec (3.1.0)
80
- rspec-core (~> 3.1.0)
81
- rspec-expectations (~> 3.1.0)
82
- rspec-mocks (~> 3.1.0)
83
- rspec-core (3.1.7)
84
- rspec-support (~> 3.1.0)
85
- rspec-expectations (3.1.2)
78
+ rake (11.2.2)
79
+ rspec (3.5.0)
80
+ rspec-core (~> 3.5.0)
81
+ rspec-expectations (~> 3.5.0)
82
+ rspec-mocks (~> 3.5.0)
83
+ rspec-core (3.5.0)
84
+ rspec-support (~> 3.5.0)
85
+ rspec-expectations (3.5.0)
86
86
  diff-lcs (>= 1.2.0, < 2.0)
87
- rspec-support (~> 3.1.0)
88
- rspec-mocks (3.1.3)
89
- rspec-support (~> 3.1.0)
90
- rspec-rails (3.1.0)
87
+ rspec-support (~> 3.5.0)
88
+ rspec-mocks (3.5.0)
89
+ diff-lcs (>= 1.2.0, < 2.0)
90
+ rspec-support (~> 3.5.0)
91
+ rspec-rails (3.5.0)
91
92
  actionpack (>= 3.0)
92
93
  activesupport (>= 3.0)
93
94
  railties (>= 3.0)
94
- rspec-core (~> 3.1.0)
95
- rspec-expectations (~> 3.1.0)
96
- rspec-mocks (~> 3.1.0)
97
- rspec-support (~> 3.1.0)
98
- rspec-support (3.1.2)
95
+ rspec-core (~> 3.5.0)
96
+ rspec-expectations (~> 3.5.0)
97
+ rspec-mocks (~> 3.5.0)
98
+ rspec-support (~> 3.5.0)
99
+ rspec-support (3.5.0)
99
100
  ruby-progressbar (1.8.1)
100
101
  shoulda-matchers (2.7.0)
101
102
  activesupport (>= 3.0.0)
102
103
  simple_form (3.2.1)
103
104
  actionpack (> 4, < 5.1)
104
105
  activemodel (> 4, < 5.1)
105
- sprockets (3.6.0)
106
+ sprockets (3.6.3)
106
107
  concurrent-ruby (~> 1.0)
107
108
  rack (> 1, < 3)
108
109
  sprockets-rails (2.3.3)
@@ -119,13 +120,13 @@ PLATFORMS
119
120
  ruby
120
121
 
121
122
  DEPENDENCIES
122
- bundler (> 1.7.0)
123
+ bundler
123
124
  database_cleaner
124
125
  fabrication
125
126
  fuubar
126
127
  rails (~> 4.1.0)
127
128
  rake
128
- rspec-rails (~> 3.1.0)
129
+ rspec-rails
129
130
  shoulda-matchers (~> 2.7.0)
130
131
  sqlite3
131
132
  strongbolt!
@@ -1,3 +1,3 @@
1
1
  module Strongbolt
2
- VERSION = "0.3.10"
2
+ VERSION = "0.3.11"
3
3
  end
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  # We're testing BoltedController module through this one
4
4
  describe PostsController, :type => :controller do
5
-
5
+
6
6
  before(:all) do
7
7
  define_model "Post"
8
8
  @user = User.create!
@@ -44,8 +44,8 @@ describe PostsController, :type => :controller do
44
44
  describe "helpers" do
45
45
  before { Strongbolt.current_user = User.create! }
46
46
  after { Strongbolt.current_user = nil }
47
-
48
- describe "can?" do
47
+
48
+ describe "can?" do
49
49
  it "should respond to can?" do
50
50
  expect(PostsController.new).to respond_to :can?
51
51
  end
@@ -55,8 +55,8 @@ describe PostsController, :type => :controller do
55
55
  PostsController.new.can? :find, User
56
56
  end
57
57
  end
58
-
59
- describe "cannot?" do
58
+
59
+ describe "cannot?" do
60
60
  it "should respond to cannot?" do
61
61
  expect(PostsController.new).to respond_to :cannot?
62
62
  end
@@ -88,14 +88,14 @@ describe PostsController, :type => :controller do
88
88
  PostsController.after_action :unset_current_user
89
89
  PostsController.before_action :check_authorization
90
90
  end
91
-
91
+
92
92
  context 'when no user' do
93
93
  before do
94
94
  expect_any_instance_of(PostsController).to receive(:current_user)
95
95
  .at_least(1).times.and_return nil
96
96
  get :index
97
97
  end
98
-
98
+
99
99
  it "should set nil user" do
100
100
  expect(Strongbolt.current_user).to be_nil
101
101
  end
@@ -112,7 +112,7 @@ describe PostsController, :type => :controller do
112
112
  expect_any_instance_of(PostsController).to receive(:current_user).and_return user
113
113
  get :index
114
114
  end
115
-
115
+
116
116
  it "should set the user" do
117
117
  expect(Strongbolt.current_user).to eq user
118
118
  end
@@ -131,7 +131,7 @@ describe PostsController, :type => :controller do
131
131
  after do
132
132
  PostsController.before_action :check_authorization
133
133
  end
134
-
134
+
135
135
  context "when a user is set" do
136
136
 
137
137
  before do
@@ -139,7 +139,7 @@ describe PostsController, :type => :controller do
139
139
  .and_return @user
140
140
  get :index
141
141
  end
142
-
142
+
143
143
  it "should have unsetted the user" do
144
144
  expect(Strongbolt.current_user).to be_nil
145
145
  end
@@ -195,7 +195,7 @@ describe PostsController, :type => :controller do
195
195
  #
196
196
 
197
197
  context "when no error" do
198
-
198
+
199
199
  before(:all) do
200
200
  # Model linked to the controller
201
201
  define_model "Post" do
@@ -236,7 +236,7 @@ describe PostsController, :type => :controller do
236
236
  # When calling a custom action without CRUD associated
237
237
  #
238
238
  context "when calling unmapped action" do
239
-
239
+
240
240
  it "should raise ActionNotConfigured" do
241
241
  expect do
242
242
  get :custom
@@ -358,7 +358,7 @@ describe PostsController, :type => :controller do
358
358
  #
359
359
 
360
360
  context "when controller doesn't have model" do
361
-
361
+
362
362
  before do
363
363
  undefine_model "Post"
364
364
  setup_session
@@ -367,7 +367,7 @@ describe PostsController, :type => :controller do
367
367
  it "should raise error" do
368
368
  expect do
369
369
  get :index
370
- end.to raise_error
370
+ end.to raise_error Strongbolt::ModelNotFound
371
371
  end
372
372
 
373
373
  end # End when no model associated
@@ -405,9 +405,9 @@ describe PostsController, :type => :controller do
405
405
  end
406
406
  end
407
407
  after { PostsController.model_for_authorization = nil }
408
-
408
+
409
409
  context "when given as a string" do
410
-
410
+
411
411
  context "and not exists" do
412
412
  it "should raise error" do
413
413
  expect do
@@ -444,7 +444,7 @@ describe PostsController, :type => :controller do
444
444
  # Fetching authorization model when not specified
445
445
  #
446
446
  describe "model_for_authorization" do
447
-
447
+
448
448
  context "when model is infered from controller" do
449
449
  before do
450
450
  define_model "Post"
@@ -481,13 +481,13 @@ describe PostsController, :type => :controller do
481
481
  # Skipping controller authorization
482
482
  #
483
483
  describe 'skip_controller_authorization' do
484
-
484
+
485
485
  after { PostsController.before_action :check_authorization }
486
-
486
+
487
487
  context "when no argument" do
488
488
 
489
489
  before { PostsController.skip_controller_authorization }
490
-
490
+
491
491
  RESTFUL_ACTIONS.each do |action|
492
492
  it "should not call check_authorization" do
493
493
  expect_any_instance_of(PostsController).not_to receive(:check_authorization)
@@ -500,9 +500,9 @@ describe PostsController, :type => :controller do
500
500
  context 'with only argument' do
501
501
 
502
502
  before { PostsController.skip_controller_authorization only: skipped_actions }
503
-
503
+
504
504
  context "when 1 action" do
505
-
505
+
506
506
  let(:skipped_actions) { :index }
507
507
 
508
508
  RESTFUL_ACTIONS.each do |action|
@@ -519,7 +519,7 @@ describe PostsController, :type => :controller do
519
519
  end # End 1 action
520
520
 
521
521
  context "when several actions" do
522
-
522
+
523
523
  let(:skipped_actions) { [:show, :index] }
524
524
 
525
525
  RESTFUL_ACTIONS.each do |action|
@@ -538,11 +538,11 @@ describe PostsController, :type => :controller do
538
538
  end # End when only argument
539
539
 
540
540
  context "with except argument" do
541
-
541
+
542
542
  before { PostsController.skip_controller_authorization except: preserved_actions }
543
-
543
+
544
544
  context "when 1 action" do
545
-
545
+
546
546
  let(:preserved_actions) { :index }
547
547
 
548
548
  RESTFUL_ACTIONS.each do |action|
@@ -559,7 +559,7 @@ describe PostsController, :type => :controller do
559
559
  end # End 1 action
560
560
 
561
561
  context "when several actions" do
562
-
562
+
563
563
  let(:preserved_actions) { [:show, :index] }
564
564
 
565
565
  RESTFUL_ACTIONS.each do |action|
@@ -662,7 +662,7 @@ describe PostsController, :type => :controller do
662
662
  # Render without authorization
663
663
  #
664
664
  describe "render_without_authorization" do
665
-
665
+
666
666
  after { PostsController.render_with_authorization }
667
667
 
668
668
  it "should have aliased render" do
@@ -703,4 +703,4 @@ describe PostsController, :type => :controller do
703
703
  end
704
704
 
705
705
 
706
- end
706
+ end
@@ -157,7 +157,7 @@ describe Strongbolt::UserAbilities do
157
157
  it "should raise an error" do
158
158
  expect do
159
159
  user.add_tenant model
160
- end.to raise_error
160
+ end.to raise_error NoMethodError
161
161
  end
162
162
  end
163
163
 
@@ -1,12 +1,12 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Strongbolt do
4
-
4
+
5
5
  #
6
6
  # Important included modules
7
7
  #
8
8
  it "should have included Grant::Grantable in ActiveRecord::Base" do
9
- expect(ActiveRecord::Base.included_modules).to include Grant::Grantable
9
+ expect(ActiveRecord::Base.included_modules).to include Grant::Grantable
10
10
  end
11
11
 
12
12
  it "should have included Bolted in ActiveRecord::Base" do
@@ -45,7 +45,7 @@ describe Strongbolt do
45
45
  # Access denied
46
46
  #
47
47
  describe "access denied" do
48
-
48
+
49
49
  before do
50
50
  block = double('block', :call => nil)
51
51
  expect(block).to receive(:call).with 'user', 'instance', 'action', 'request_path'
@@ -118,13 +118,13 @@ describe Strongbolt do
118
118
  it "should raise error" do
119
119
  expect do
120
120
  AnyClass.new.method("ok", "ok2") {}
121
- end.to raise_error
121
+ end.to raise_error(StandardError)
122
122
  end
123
123
  end
124
124
 
125
125
  context "when skipped" do
126
126
  before { AnyClass.perform_without_authorization :method }
127
-
127
+
128
128
  it "should skip authorization" do
129
129
  expect do
130
130
  AnyClass.new.method("ok", "ok2") {}
@@ -171,7 +171,7 @@ describe Strongbolt do
171
171
  define_model "UserWithout" do
172
172
  self.table_name = 'users'
173
173
  end
174
-
174
+
175
175
  # We configure the user class
176
176
  Strongbolt::Configuration.user_class = 'UserWithout'
177
177
  end
@@ -190,20 +190,20 @@ describe Strongbolt do
190
190
  expect(Grant::User.current_user).to eq user
191
191
  end
192
192
  end # End when User Class doesn't have the UserAbilities included
193
-
193
+
194
194
  context 'when the model has the UserAbilities module included' do
195
-
195
+
196
196
  before do
197
197
  define_model "UserWithAbilities" do
198
198
  include Strongbolt::UserAbilities
199
199
  self.table_name = 'users'
200
200
  end
201
-
201
+
202
202
  # We configure the user class
203
203
  Strongbolt::Configuration.user_class = 'UserWithAbilities'
204
204
  end
205
205
  after { undefine_model "UserWithAbilities" }
206
-
206
+
207
207
  let(:user) { UserWithAbilities.new }
208
208
 
209
209
  it "should set the current user" do
@@ -259,7 +259,7 @@ describe Strongbolt do
259
259
  end # End when user given is the right class
260
260
 
261
261
  context "when the model isn't from the user class" do
262
-
262
+
263
263
  it "should raise error" do
264
264
  Strongbolt::Configuration.user_class = 'User'
265
265
  expect do
@@ -271,4 +271,4 @@ describe Strongbolt do
271
271
 
272
272
  end
273
273
 
274
- end
274
+ end
data/strongbolt.gemspec CHANGED
@@ -18,17 +18,17 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'awesome_nested_set', '~> 3.0.0'
21
+ spec.add_dependency 'awesome_nested_set', '~> 3.1.0'
22
22
  spec.add_dependency 'grant', '~> 3.0'
23
23
  spec.add_dependency 'simple_form', '~> 3.0'
24
24
 
25
25
  spec.add_development_dependency "rails", "~> 4.1.0"
26
- spec.add_development_dependency "bundler", "> 1.7.0"
26
+ spec.add_development_dependency "bundler"
27
27
  spec.add_development_dependency "rake"
28
28
  spec.add_development_dependency 'sqlite3'
29
29
  spec.add_development_dependency 'shoulda-matchers', '~> 2.7.0'
30
30
  spec.add_development_dependency 'fuubar'
31
- spec.add_development_dependency 'rspec-rails', '~> 3.1.0'
31
+ spec.add_development_dependency 'rspec-rails'
32
32
  spec.add_development_dependency 'fabrication'
33
33
  spec.add_development_dependency 'database_cleaner'
34
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongbolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Césaré-Herriau
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-27 00:00:00.000000000 Z
12
+ date: 2016-08-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: awesome_nested_set
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 3.0.0
20
+ version: 3.1.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 3.0.0
27
+ version: 3.1.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: grant
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -71,16 +71,16 @@ dependencies:
71
71
  name: bundler
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">"
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 1.7.0
76
+ version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">"
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 1.7.0
83
+ version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rake
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -141,16 +141,16 @@ dependencies:
141
141
  name: rspec-rails
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - "~>"
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: 3.1.0
146
+ version: '0'
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - "~>"
151
+ - - ">="
152
152
  - !ruby/object:Gem::Version
153
- version: 3.1.0
153
+ version: '0'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: fabrication
156
156
  requirement: !ruby/object:Gem::Requirement