authorizy 0.4.0 → 0.4.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: d5aa4cb2402214093d2887dcd0760f1087586e28d558c52bfcb4999ff18f72cc
4
- data.tar.gz: e189e2a283e745c6cb37ddab2683b362d86a4355d776866f031d4cc2c2913079
3
+ metadata.gz: adf5a52d89eabb0dd6503d0f96fb44ae9d4268213a6da8b91fb758805db97371
4
+ data.tar.gz: 01bcedd187623c4364c38d0c4f53b5a12ee1877f4426df44b21cc3b7446f6b5d
5
5
  SHA512:
6
- metadata.gz: bc846ae164fabea516698ef5ddfaec65618a30f2949ec59cc8d93a7b380f240a1a1e25afd53ea6cdfb4f0db7b43cb5a1b26fdd8f87220ef47f9de0d8064b4508
7
- data.tar.gz: 24e3e907dc28f062932bcc41387f5075ca3865b3406dc80cef0da09439c9db47a52d9c1b3d6ef1871138292f888e43608711e0fc3167a02da5e0d439fcc83091
6
+ metadata.gz: 0623f322536c3a6de17848f3f6b3642d70041384e220d0417d028a045d59970c97dfa84e659dd6a95795fe30f2ed09bb7d6203cf0bc7b600fbea0e53ff63bec5
7
+ data.tar.gz: 4e4862f37eb92ef4c0eb247ecd0fa0abe0652d6d750b282bb20908fadaf3dbaf54738ed51167cfa5784e1d158a441d349c75f9a460981c800def31df30b1d002
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.4.1
2
+
3
+ ## Fixes
4
+
5
+ - `redirect_url` was receiving the `denied` context instead of the controller's context;
6
+
1
7
  # v0.4.0
2
8
 
3
9
  ## Fixes
@@ -14,7 +14,7 @@ module Authorizy
14
14
 
15
15
  return context.render(json: { message: info }, status: 403) if context.request.xhr?
16
16
 
17
- context.redirect_to(redirect_url.call(self), info: info)
17
+ context.redirect_to(redirect_url.call(context), info: info)
18
18
  }
19
19
 
20
20
  @dependencies = {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Authorizy
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
5
5
  end
@@ -25,16 +25,18 @@ RSpec.describe Authorizy::Config, '#denied' do
25
25
  let!(:context) do
26
26
  double('context',
27
27
  params: { controller: 'users', action: 'index' },
28
- request: OpenStruct.new(xhr?: false)
28
+ request: OpenStruct.new(xhr?: false),
29
+ root_url: 'root_url'
29
30
  )
30
31
  end
31
32
 
32
- it 'renders' do
33
+ it 'redirects' do
33
34
  allow(context).to receive(:redirect_to)
35
+ allow(context).to receive(:respond_to?).with(:root_url).and_return(true)
34
36
 
35
37
  config.denied.call(context)
36
38
 
37
- expect(context).to have_received(:redirect_to).with('/', info: 'Action denied for users#index')
39
+ expect(context).to have_received(:redirect_to).with('root_url', info: 'Action denied for users#index')
38
40
  end
39
41
  end
40
42
  end
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Washington Botelho