authorizy 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/authorizy/extension.rb +1 -1
- data/lib/authorizy/version.rb +1 -1
- data/spec/authorizy/extension/authorizy_spec.rb +1 -1
- data/spec/authorizy/rspec_spec.rb +31 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3025788b5adf8a466ed73bfc45f709612ad1b05de0e5e887a84c67c31cd5074
|
4
|
+
data.tar.gz: 354c47240e842ecdd4afa112e95e02ef094f94dfcd17e9431d7dbe97ee580283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8a73b41a1b8ea247cd59114d9ddf857f7727efa4c780fd5b6fe17a8805aa86528061e7fa49ec2f32c9fe4a80bb0d05a70341d8176af302cb6e31da4bdce9403
|
7
|
+
data.tar.gz: d9c32ae7a0b4a81742d3caa9879c69b7949cc86ecf104b4e79f7e642fa7b92efb5b4047993a38f2136e8b226dd5119046f5e5faed85134e5f249513c3fed72dc
|
data/CHANGELOG.md
CHANGED
data/lib/authorizy/extension.rb
CHANGED
@@ -12,7 +12,7 @@ module Authorizy
|
|
12
12
|
|
13
13
|
info = I18n.t('authorizy.denied', controller: params[:controller], action: params[:action])
|
14
14
|
|
15
|
-
return render(json: { message: info }, status:
|
15
|
+
return render(json: { message: info }, status: 401) if request.xhr?
|
16
16
|
|
17
17
|
redirect_to authorizy_config.redirect_url.call(self), info: info
|
18
18
|
end
|
data/lib/authorizy/version.rb
CHANGED
@@ -51,7 +51,7 @@ RSpec.describe DummyController, '#authorizy', type: :controller do
|
|
51
51
|
get :action, xhr: true, params: { key: 'value' }
|
52
52
|
|
53
53
|
expect(response.body).to eq('{"message":"Action denied for dummy#action"}')
|
54
|
-
expect(response.status).to be(
|
54
|
+
expect(response.status).to be(401)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe RSpec::Matchers, '#be_authorized' do
|
4
|
+
it 'pending' do
|
5
|
+
matcher = be_authorized('controller', 'action', params: { params: true }, session: { session: true })
|
6
|
+
|
7
|
+
expect(matcher.description).to eq %(
|
8
|
+
be authorized "controller", "action", and {:params=>{:params=>true}, :session=>{:session=>true}}
|
9
|
+
).squish
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# matcher.actual
|
14
|
+
# matcher.actual_formatted
|
15
|
+
# matcher.and
|
16
|
+
# matcher.description
|
17
|
+
# matcher.diffable?
|
18
|
+
# matcher.does_not_match?
|
19
|
+
# matcher.expected
|
20
|
+
# matcher.expected_formatted
|
21
|
+
# matcher.expects_call_stack_jump?
|
22
|
+
# matcher.failure_message
|
23
|
+
# matcher.failure_message_when_negated
|
24
|
+
# matcher.match_unless_raises
|
25
|
+
# matcher.matcher_name
|
26
|
+
# matcher.matcher_name=
|
27
|
+
# matcher.matches?
|
28
|
+
# matcher.or
|
29
|
+
# matcher.present_ivars
|
30
|
+
# matcher.rescued_exception
|
31
|
+
# matcher.supports_block_expectations?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authorizy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Washington Botelho
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- spec/authorizy/expander/expand_spec.rb
|
174
174
|
- spec/authorizy/extension/authorizy_question_spec.rb
|
175
175
|
- spec/authorizy/extension/authorizy_spec.rb
|
176
|
+
- spec/authorizy/rspec_spec.rb
|
176
177
|
- spec/common_helper.rb
|
177
178
|
- spec/spec_helper.rb
|
178
179
|
- spec/support/application.rb
|
@@ -225,6 +226,7 @@ test_files:
|
|
225
226
|
- spec/authorizy/expander/expand_spec.rb
|
226
227
|
- spec/authorizy/extension/authorizy_question_spec.rb
|
227
228
|
- spec/authorizy/extension/authorizy_spec.rb
|
229
|
+
- spec/authorizy/rspec_spec.rb
|
228
230
|
- spec/common_helper.rb
|
229
231
|
- spec/spec_helper.rb
|
230
232
|
- spec/support/application.rb
|