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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: faaf887b6dd9e95abc874df1b5ac534de5dc2dbebda5b2d887472a14a582fa9f
4
- data.tar.gz: 156619514026194dc25299d689aec65ef0cce3ee5500c79090677286cb59dd61
3
+ metadata.gz: d3025788b5adf8a466ed73bfc45f709612ad1b05de0e5e887a84c67c31cd5074
4
+ data.tar.gz: 354c47240e842ecdd4afa112e95e02ef094f94dfcd17e9431d7dbe97ee580283
5
5
  SHA512:
6
- metadata.gz: 9d3e8128355ad5fc09b3bfd8f6719dc8b5ae1a11470de49979e8877f48c2f87752a7990549dc921758499585df4a6615f3941f91863afa65eb25520290577f81
7
- data.tar.gz: 49f47d3b8d83d810a419139fb8c9419b51939bf817c6ec617200382e9951376c2ff545a669548d9f3ad6b44270facb849073ad80b5efa6f9348376b56c448df7
6
+ metadata.gz: a8a73b41a1b8ea247cd59114d9ddf857f7727efa4c780fd5b6fe17a8805aa86528061e7fa49ec2f32c9fe4a80bb0d05a70341d8176af302cb6e31da4bdce9403
7
+ data.tar.gz: d9c32ae7a0b4a81742d3caa9879c69b7949cc86ecf104b4e79f7e642fa7b92efb5b4047993a38f2136e8b226dd5119046f5e5faed85134e5f249513c3fed72dc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.2.1
2
+
3
+ ## Fixes
4
+
5
+ - Returns `401` status code when user has no authorization on a XHR request;
6
+
1
7
  # v0.2.0
2
8
 
3
9
  ## Break Changes
@@ -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: 422) if request.xhr?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Authorizy
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
@@ -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(422)
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.0
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