route_authorizer 0.0.4 → 0.0.5

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: 672e998c468b5c1fb4cf8279b3ce71ce2aae3d8c
4
- data.tar.gz: 00aa2185e514df67db452d5344209c56437ba283
3
+ metadata.gz: 4e3a0f2ada77c7eb4c8e74711f6ea639ada66ca8
4
+ data.tar.gz: 843853d3e80d386fe0838116d1615d358c3940c5
5
5
  SHA512:
6
- metadata.gz: b13057a295b5be581734b8e41cd7f44c563435c405170abcf96b360f6c208ec075dff2054433220665c54761e184d36d242d354fda89938bb41ee4710fc332f5
7
- data.tar.gz: 5b63acbb71f664ca58d6159ce520e49c0f6d50f57cffea8e808a7706a71988042ff29fe4e3d98c2f36ac02403ed228d3b6da3ee1fb7d0b1afd6823b657ac3391
6
+ metadata.gz: ccb85cbe5d2ce0cf939cb08220eadc6189b8e1f9f920bc81b242f8dd5f543e5ac59a5282f375688982a24dc7a215d0643f7067cf7724331347fc4bed3795f8c2
7
+ data.tar.gz: 0e1f6d4bf1b393b932f609a1594d88e3fb56a4efd68f052ca371bbcea26bf122c40311868860498004edcbd0df28bfb7e5fa35639ec06373f77ede0b0dfc80f4
@@ -3,7 +3,7 @@ module RouteAuthorizer
3
3
  require 'action_controller'
4
4
 
5
5
  require 'route_authorizer/version'
6
- require 'route_authorizer/permission'
7
6
  require 'route_authorizer/permission_dsl'
7
+ require 'route_authorizer/permission'
8
8
  require 'route_authorizer/authorizer'
9
9
  end
@@ -1,4 +1,6 @@
1
- module RouteAuthorizer::Permission
1
+ class RouteAuthorizer::Permission
2
+
3
+ include RouteAuthorizer::PermissionDSL
2
4
 
3
5
  def initialize(role)
4
6
  @role = role.to_s
@@ -2,8 +2,6 @@ module RouteAuthorizer::PermissionDSL
2
2
 
3
3
  extend ActiveSupport::Concern
4
4
 
5
- include RouteAuthorizer::Permission
6
-
7
5
  class_methods do
8
6
  def all_roles(&block)
9
7
  role(:default, &block)
@@ -1,3 +1,3 @@
1
1
  module RouteAuthorizer
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -1,7 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
- Permission = Class.new
4
-
5
3
  describe RouteAuthorizer::Authorizer do
6
4
 
7
5
  let(:role) { :admin }
@@ -3,16 +3,12 @@ require 'spec_helper'
3
3
  describe RouteAuthorizer::PermissionDSL do
4
4
 
5
5
  let(:permission_class) { Class.new }
6
- let(:permission) { permission_class.new(:admin) }
6
+ let(:permission) { permission_class.new }
7
7
 
8
8
  before do
9
9
  permission_class.include(RouteAuthorizer::PermissionDSL)
10
10
  end
11
11
 
12
- it 'includes permission module' do
13
- expect(permission_class).to include RouteAuthorizer::Permission
14
- end
15
-
16
12
  it '.all_roles' do
17
13
  expect(permission_class).to receive(:role).with(:default).and_yield
18
14
 
@@ -2,12 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe RouteAuthorizer::Permission do
4
4
 
5
- let(:permission_class) { Class.new }
5
+ let(:permission_class) { Class.new(RouteAuthorizer::Permission) }
6
6
  let(:permission) { permission_class.new(@role) }
7
7
 
8
8
  before do
9
9
  @role = :admin
10
- permission_class.include(RouteAuthorizer::Permission)
10
+ end
11
+
12
+ it 'includes DSL' do
13
+ expect(permission_class).to include RouteAuthorizer::PermissionDSL
11
14
  end
12
15
 
13
16
  it 'returns no permission for no role' do
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,4 @@
1
1
  require 'bundler/setup'
2
2
  Bundler.require(:default, :development)
3
+
4
+ Permission = Class.new(RouteAuthorizer::Permission)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: route_authorizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fábio Rodrigues