cannie 0.2.2 → 0.3.0

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
  SHA1:
3
- metadata.gz: b8a8164315ae9f501175417065d2384db087752d
4
- data.tar.gz: 20f75d9c20080934668e8b8d5ee3b69eae41b1f0
3
+ metadata.gz: 8ea32c68a9113d637d3bb791057f5b348b56b08c
4
+ data.tar.gz: 3ec306e3f8446dd4268a871d477766892fea7af8
5
5
  SHA512:
6
- metadata.gz: 76f3377028bf84da8ae0c0d47386ba834a94ed191d627fcacaff09a1cd9f077a7349d02fec370712aa41b3eacd6ee562db9e7397bfd99878fc3e85c66791c69a
7
- data.tar.gz: 1dbcc7c5cbb65b79b36d0ac360c5d5745d94ca4591d7680e6fde3b6a5c6f9ef28d4a8384fce8acef11b1aba175bffe792553745c61f4035d4fc8609a2b8dcb17
6
+ metadata.gz: 869fc0875050480d6cd2dc953944d26fcf1f73fb795f9fdb91e0d46aac0e758c5f7e92ca2b1e44463d8b3f84ed994471d9bf8dfb616e05f3a1e35b796247d561
7
+ data.tar.gz: 35729050589a2a28d6af0a741f9574917d2f7957fd0558d2d2b5f3582eabe75e75f405b12d5d5c9df021bc09619fe3b772cf3a7fd00c200f9fe256767e5526c5
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
@@ -15,4 +14,5 @@ spec/reports
15
14
  test/tmp
16
15
  test/version_tmp
17
16
  tmp
18
- .idea
17
+ .idea
18
+ .gems
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  group :test do
4
4
  gem 'rspec'
5
- gem 'simplecov'
5
+ gem 'simplecov', require: false
6
6
  end
7
7
 
8
8
  # Specify your gem's dependencies in cannie.gemspec
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cannie (0.2.2)
5
+ actionpack (>= 4.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionpack (4.2.6)
11
+ actionview (= 4.2.6)
12
+ activesupport (= 4.2.6)
13
+ rack (~> 1.6)
14
+ rack-test (~> 0.6.2)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
+ actionview (4.2.6)
18
+ activesupport (= 4.2.6)
19
+ builder (~> 3.1)
20
+ erubis (~> 2.7.0)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ activesupport (4.2.6)
24
+ i18n (~> 0.7)
25
+ json (~> 1.7, >= 1.7.7)
26
+ minitest (~> 5.1)
27
+ thread_safe (~> 0.3, >= 0.3.4)
28
+ tzinfo (~> 1.1)
29
+ builder (3.2.2)
30
+ diff-lcs (1.2.5)
31
+ docile (1.1.5)
32
+ erubis (2.7.0)
33
+ i18n (0.7.0)
34
+ json (1.8.3)
35
+ loofah (2.0.3)
36
+ nokogiri (>= 1.5.9)
37
+ mini_portile2 (2.0.0)
38
+ minitest (5.8.4)
39
+ nokogiri (1.6.7.2)
40
+ mini_portile2 (~> 2.0.0.rc2)
41
+ rack (1.6.4)
42
+ rack-test (0.6.3)
43
+ rack (>= 1.0)
44
+ rails-deprecated_sanitizer (1.0.3)
45
+ activesupport (>= 4.2.0.alpha)
46
+ rails-dom-testing (1.0.7)
47
+ activesupport (>= 4.2.0.beta, < 5.0)
48
+ nokogiri (~> 1.6.0)
49
+ rails-deprecated_sanitizer (>= 1.0.1)
50
+ rails-html-sanitizer (1.0.3)
51
+ loofah (~> 2.0)
52
+ rake (11.1.2)
53
+ rspec (3.4.0)
54
+ rspec-core (~> 3.4.0)
55
+ rspec-expectations (~> 3.4.0)
56
+ rspec-mocks (~> 3.4.0)
57
+ rspec-core (3.4.4)
58
+ rspec-support (~> 3.4.0)
59
+ rspec-expectations (3.4.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.4.0)
62
+ rspec-mocks (3.4.1)
63
+ diff-lcs (>= 1.2.0, < 2.0)
64
+ rspec-support (~> 3.4.0)
65
+ rspec-support (3.4.1)
66
+ simplecov (0.11.2)
67
+ docile (~> 1.1.0)
68
+ json (~> 1.8)
69
+ simplecov-html (~> 0.10.0)
70
+ simplecov-html (0.10.0)
71
+ thread_safe (0.3.5)
72
+ tzinfo (1.2.2)
73
+ thread_safe (~> 0.1)
74
+
75
+ PLATFORMS
76
+ ruby
77
+
78
+ DEPENDENCIES
79
+ bundler (~> 1.3)
80
+ cannie!
81
+ rake
82
+ rspec
83
+ simplecov
84
+
85
+ BUNDLED WITH
86
+ 1.11.2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Cannie
2
2
 
3
- [![Build Status](https://travis-ci.org/hck/cannie.png)](https://travis-ci.org/hck/cannie)
3
+ [![Build Status](https://travis-ci.org/hck/cannie.png)](https://travis-ci.org/hck/cannie) [![Code Climate](https://codeclimate.com/github/hck/cannie.png)](https://codeclimate.com/github/hck/cannie)
4
4
 
5
5
  Cannie is a gem for authorization/permissions checking on per-controller/per-action basis.
6
6
 
@@ -20,5 +20,4 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
21
  spec.add_development_dependency "rake"
22
22
  spec.add_runtime_dependency "actionpack", ">= 4.0"
23
- spec.add_runtime_dependency "activesupport", ">= 4.0"
24
23
  end
@@ -1,10 +1,9 @@
1
1
  module Cannie
2
2
  module ControllerExtensions
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- extend ClassMethods
7
- helper_method :can?, :current_permissions
3
+ def self.extended(base)
4
+ base.include self
5
+ base.extend ClassMethods
6
+ base.helper_method :can?, :current_permissions
8
7
  end
9
8
 
10
9
  module ClassMethods
@@ -16,7 +15,7 @@ module Cannie
16
15
  # # ...
17
16
  # end
18
17
  #
19
- def check_permissions(options={})
18
+ def check_permissions(options = {})
20
19
  _if, _unless = options.values_at(:if, :unless)
21
20
  before_action(options.slice(:only, :except)) do |controller|
22
21
  next if controller.permitted?
@@ -75,7 +74,5 @@ module Cannie
75
74
  end
76
75
 
77
76
  if defined? ActionController::Base
78
- ActionController::Base.class_eval do
79
- include Cannie::ControllerExtensions
80
- end
81
- end
77
+ ActionController::Base.extend Cannie::ControllerExtensions
78
+ end
@@ -1,9 +1,7 @@
1
1
  module Cannie
2
2
  module Permissions
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- extend ClassMethods
3
+ def self.included(base)
4
+ base.extend ClassMethods
7
5
  end
8
6
 
9
7
  module ClassMethods
@@ -49,10 +47,19 @@ module Cannie
49
47
  @user = user
50
48
  end
51
49
 
50
+ # Checks if at least one rule for specified action add subject is present
51
+ #
52
+ # @param [Symbol] action
53
+ # @param [String, Symbol] subject
54
+ # @return [Boolean]
52
55
  def can?(action, subject)
53
56
  rules_for(action, subject).present?
54
57
  end
55
58
 
59
+ # Raises error Cannie::ActionForbidden if there is no rules for specified action and subject
60
+ #
61
+ # @param [Symbol] action
62
+ # @param [String, Symbol] subject
56
63
  def permit!(action, subject)
57
64
  raise Cannie::ActionForbidden unless can?(action, subject)
58
65
  end
@@ -70,4 +77,4 @@ module Cannie
70
77
  end
71
78
  end
72
79
  end
73
- end
80
+ end
@@ -2,15 +2,29 @@ module Cannie
2
2
  class Rule
3
3
  attr_reader :action, :subject
4
4
 
5
- def initialize(action, subject, options={})
5
+ # Initializes new rule
6
+ #
7
+ # @param [Symbol] action action which should be permitted on subject
8
+ # @param [String, Symbol] subject subject of the rule
9
+ # @param [Hash] options additional options and conditions for the new rule
10
+ # @option options [Proc] :if condition which is checked for a particular Permissions object
11
+ # and should be evaluated to true
12
+ # @option options [Proc] :unless condition which is checked for a particular Permissions object
13
+ # and should be evaluated to false
14
+ def initialize(action, subject, options = {})
6
15
  @action, @subject, @_if, @_unless = action, subject, *options.values_at(:if, :unless)
7
16
  end
8
17
 
18
+ # Checks whether rule is applied to permissions passed as an argument
19
+ #
20
+ # @param [Cannie::Permissions] permissions
21
+ # @return [Boolean]
9
22
  def applies_to?(permissions)
10
23
  if?(permissions) && unless?(permissions)
11
24
  end
12
25
 
13
26
  private
27
+
14
28
  attr_reader :_if, :_unless
15
29
 
16
30
  def if?(permissions)
@@ -1,3 +1,3 @@
1
1
  module Cannie
2
- VERSION = '0.2.2'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Cannie::ControllerExtensions do
3
+ RSpec.describe Cannie::ControllerExtensions do
4
4
  let(:klass) do
5
5
  Class.new(ActionController::Base) do
6
6
  def action
@@ -29,19 +29,23 @@ describe Cannie::ControllerExtensions do
29
29
  end
30
30
 
31
31
  describe '.check_permissions' do
32
- before { subject.stub(:current_permissions).and_return(permissions.new('User')) }
32
+ before do
33
+ allow(subject).to receive(:current_permissions).and_return(permissions.new('User'))
34
+ end
33
35
 
34
36
  describe 'without conditions' do
35
- before do
36
- klass.check_permissions
37
- end
37
+ before { klass.check_permissions }
38
38
 
39
39
  it 'raises exception if no rules for action & subject exist' do
40
- expect { subject.dispatch(:action, ActionDispatch::TestRequest.new) }.to raise_error(Cannie::ActionForbidden)
40
+ expect {
41
+ subject.dispatch(:action, ActionDispatch::TestRequest.new)
42
+ }.to raise_error(Cannie::ActionForbidden)
41
43
  end
42
44
 
43
45
  it 'does not raise exception rules match action & subject' do
44
- expect { subject.dispatch(:index, ActionDispatch::TestRequest.new) }.not_to raise_error
46
+ expect {
47
+ subject.dispatch(:index, ActionDispatch::TestRequest.new)
48
+ }.not_to raise_error
45
49
  end
46
50
  end
47
51
 
@@ -49,13 +53,17 @@ describe Cannie::ControllerExtensions do
49
53
  before { klass.check_permissions if: :condition? }
50
54
 
51
55
  it 'raises exception if :if block executed in controller scope returns true and no rules for action/subject' do
52
- subject.stub(:condition?).and_return(true)
53
- expect { subject.dispatch(:action, ActionDispatch::TestRequest.new) }.to raise_error(Cannie::ActionForbidden)
56
+ allow(subject).to receive(:condition?).and_return(true)
57
+ expect {
58
+ subject.dispatch(:action, ActionDispatch::TestRequest.new)
59
+ }.to raise_error(Cannie::ActionForbidden)
54
60
  end
55
61
 
56
62
  it 'does not raise exception if :if block executed in controller scope returns false' do
57
- subject.stub(:condition?).and_return(false)
58
- expect { subject.dispatch(:action, ActionDispatch::TestRequest.new) }.not_to raise_error
63
+ allow(subject).to receive(:condition?).and_return(false)
64
+ expect {
65
+ subject.dispatch(:action, ActionDispatch::TestRequest.new)
66
+ }.not_to raise_error
59
67
  end
60
68
  end
61
69
 
@@ -63,22 +71,26 @@ describe Cannie::ControllerExtensions do
63
71
  before { klass.check_permissions unless: :condition? }
64
72
 
65
73
  it 'raises exception if :unless block executed in controller scope returns false' do
66
- subject.stub(:condition?).and_return(false)
67
- expect { subject.dispatch(:action, ActionDispatch::TestRequest.new) }.to raise_error(Cannie::ActionForbidden)
74
+ allow(subject).to receive(:condition?).and_return(false)
75
+ expect {
76
+ subject.dispatch(:action, ActionDispatch::TestRequest.new)
77
+ }.to raise_error(Cannie::ActionForbidden)
68
78
  end
69
79
 
70
80
  it 'does not raise exception if :unless block executed in controller scope returns false' do
71
- subject.stub(:condition?).and_return(true)
72
- expect { subject.dispatch(:action, ActionDispatch::TestRequest.new) }.not_to raise_error
81
+ allow(subject).to receive(:condition?).and_return(true)
82
+ expect {
83
+ subject.dispatch(:action, ActionDispatch::TestRequest.new)
84
+ }.not_to raise_error
73
85
  end
74
86
  end
75
87
  end
76
88
 
77
89
  describe '.skip_check_permissions' do
78
- it 'sets @_permitted to true to bypass permissions checking' do
90
+ it 'bypasses permissions checking' do
79
91
  klass.skip_check_permissions
80
92
  subject.run_callbacks(:process_action)
81
- expect(subject.permitted?).to be_true
93
+ expect(subject.permitted?).to eq(true)
82
94
  end
83
95
  end
84
96
 
@@ -88,13 +100,13 @@ describe Cannie::ControllerExtensions do
88
100
  end
89
101
 
90
102
  it 'returns true if action allowed on subject' do
91
- subject.stub(:current_permissions).and_return permissions.new('user')
92
- expect(subject.can? :index, on: klass).to be_true
103
+ allow(subject).to receive(:current_permissions).and_return permissions.new('user')
104
+ expect(subject.can? :index, on: klass).to eq(true)
93
105
  end
94
106
 
95
107
  it 'returns false if action not allowed on subject' do
96
- subject.stub(:current_permissions).and_return permissions.new('user')
97
- expect(subject.can? :action, on: klass).to be_false
108
+ allow(subject).to receive(:current_permissions).and_return permissions.new('user')
109
+ expect(subject.can? :action, on: klass).to eq(false)
98
110
  end
99
111
  end
100
112
 
@@ -105,15 +117,15 @@ describe Cannie::ControllerExtensions do
105
117
  end
106
118
  end
107
119
 
108
- before { subject.stub(:current_user).and_return 'User' }
120
+ before { allow(subject).to receive(:current_user).and_return 'User' }
109
121
 
110
122
  it 'creates new Permissions object' do
111
123
  expect(subject.current_permissions).to be_instance_of(Permissions)
112
124
  end
113
125
 
114
126
  it 'passes current_user to Permissions::new' do
115
- subject.stub(:current_user).and_return 'User'
127
+ allow(subject).to receive(:current_user).and_return 'User'
116
128
  expect(subject.current_permissions.user).to eq('User')
117
129
  end
118
130
  end
119
- end
131
+ end
@@ -1,7 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Cannie::Permissions do
4
- subject { Class.new { include Cannie::Permissions } }
3
+ RSpec.describe Cannie::Permissions do
4
+ subject do
5
+ Class.new do
6
+ include Cannie::Permissions
7
+ end
8
+ end
5
9
 
6
10
  let(:permissions) do
7
11
  subject.class_exec do
@@ -12,6 +16,7 @@ describe Cannie::Permissions do
12
16
 
13
17
  allow :new, on: :all
14
18
  end
19
+
15
20
  subject.new('user')
16
21
  end
17
22
 
@@ -58,14 +63,18 @@ describe Cannie::Permissions do
58
63
  it 'creates Rule object for specified controller and action' do
59
64
  subject.allow :index, on: :entries
60
65
  rule = subject.rules.last
61
- expect(rule).to be_instance_of(Cannie::Rule)
62
- expect(rule.action).to eq(:index)
63
- expect(rule.subject).to eq('entries')
66
+ rule_data = [rule.class, rule.action, rule.subject]
67
+ expect(rule_data).to eq([Cannie::Rule, :index, 'entries'])
64
68
  end
65
69
 
66
70
  it 'creates Rule object for each of specified actions and controllers' do
67
71
  subject.allow [:index, :show], on: [:entries, :comments]
68
- expected = [[:index, 'entries'], [:index, 'comments'], [:show, 'entries'], [:show, 'comments']]
72
+ expected = [
73
+ [:index, 'entries'],
74
+ [:index, 'comments'],
75
+ [:show, 'entries'],
76
+ [:show, 'comments']
77
+ ]
69
78
  expect(subject.rules.map { |rule| [rule.action, rule.subject] }).to eq(expected)
70
79
  end
71
80
 
@@ -80,7 +89,11 @@ describe Cannie::Permissions do
80
89
  allow :show, on: :comments
81
90
  end
82
91
 
83
- expected = [[:index, 'entries'], [:show, 'entries'], [:show, 'comments']]
92
+ expected = [
93
+ [:index, 'entries'],
94
+ [:show, 'entries'],
95
+ [:show, 'comments']
96
+ ]
84
97
  expect(subject.rules.map { |rule| [rule.action, rule.subject] }).to eq(expected)
85
98
  end
86
99
  end
@@ -88,29 +101,29 @@ describe Cannie::Permissions do
88
101
  describe '#can?' do
89
102
  describe 'when passed as class' do
90
103
  it 'returns true if it has at least one rule for corresponding action & subject' do
91
- expect(permissions.can?(:index, klass)).to be_true
104
+ expect(permissions.can?(:index, klass)).to eq(true)
92
105
  end
93
106
 
94
107
  it 'returns true for any subject if rule subject set to :all' do
95
- expect(permissions.can?(:new, klass)).to be_true
108
+ expect(permissions.can?(:new, klass)).to eq(true)
96
109
  end
97
110
 
98
111
  it 'returns false if no rules found for corresponding action & subject' do
99
- expect(permissions.can?(:edit, klass)).to be_false
112
+ expect(permissions.can?(:edit, klass)).to eq(false)
100
113
  end
101
114
  end
102
115
 
103
116
  describe 'when passed as string' do
104
117
  it 'returns true if it has at least one rule for corresponding action & subject' do
105
- expect(permissions.can?(:index, klass.controller_path)).to be_true
118
+ expect(permissions.can?(:index, klass.controller_path)).to eq(true)
106
119
  end
107
120
 
108
121
  it 'returns true for any subject if rule subject set to :all' do
109
- expect(permissions.can?(:new, klass.controller_path)).to be_true
122
+ expect(permissions.can?(:new, klass.controller_path)).to eq(true)
110
123
  end
111
124
 
112
125
  it 'returns false if no rules found for corresponding action & subject' do
113
- expect(permissions.can?(:edit, klass.controller_path)).to be_false
126
+ expect(permissions.can?(:edit, klass.controller_path)).to eq(false)
114
127
  end
115
128
  end
116
129
  end
@@ -124,5 +137,4 @@ describe Cannie::Permissions do
124
137
  expect { permissions.permit!(:index, klass) }.not_to raise_error
125
138
  end
126
139
  end
127
-
128
- end
140
+ end
@@ -1,19 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Cannie::Rule do
3
+ RSpec.describe Cannie::Rule do
4
+ let(:rule) { described_class.new :index, 'entries' }
5
+
4
6
  describe '#initialize' do
5
7
  it 'stores passed action' do
6
- rule = described_class.new :index, 'entries'
7
8
  expect(rule.action).to eq(:index)
8
9
  end
9
10
 
10
11
  it 'stores passed subject' do
11
- rule = described_class.new :index, 'entries'
12
12
  expect(rule.subject).to eq('entries')
13
13
  end
14
14
  end
15
15
 
16
- describe 'applies_to?' do
16
+ describe '#applies_to?' do
17
17
  let(:permissions) do
18
18
  Class.new do
19
19
  def initialize(is_admin=false, is_guest=false)
@@ -31,53 +31,52 @@ describe Cannie::Rule do
31
31
  end
32
32
 
33
33
  it 'returns true if no conditions passed in initialize' do
34
- rule = described_class.new(:index, 'entries')
35
- expect(rule.applies_to?(Array)).to be_true
34
+ expect(rule.applies_to?(Array)).to eq(true)
36
35
  end
37
36
 
38
37
  it 'returns true if passed if-condition evaluated in scope of passed argument return true' do
39
38
  rule = described_class.new(:index, 'entries', if: -> { admin? })
40
- expect(rule.applies_to?(permissions.new(true))).to be_true
39
+ expect(rule.applies_to?(permissions.new(true))).to eq(true)
41
40
  end
42
41
 
43
42
  it 'returns false if passed if-condition evaluated in scope of passed argument return false' do
44
43
  rule = described_class.new(:index, 'entries', if: -> { admin? })
45
- expect(rule.applies_to?(permissions.new)).to be_false
44
+ expect(rule.applies_to?(permissions.new)).to eq(false)
46
45
  end
47
46
 
48
47
  it 'evaluates if-condition specified as symbol' do
49
48
  rule = described_class.new(:index, 'entries', if: :admin?)
50
- expect(rule.applies_to?(permissions.new(true))).to be_true
49
+ expect(rule.applies_to?(permissions.new(true))).to eq(true)
51
50
  end
52
51
 
53
52
  it 'evaluates if-condition specified as proc' do
54
53
  rule = described_class.new(:index, 'entries', if: proc { admin? })
55
- expect(rule.applies_to?(permissions.new(true))).to be_true
54
+ expect(rule.applies_to?(permissions.new(true))).to eq(true)
56
55
  end
57
56
 
58
57
  it 'returns true if passed unless-condition evaluated in scope of passed argument return false' do
59
58
  rule = described_class.new(:index, 'entries', unless: -> { admin? })
60
- expect(rule.applies_to?(permissions.new)).to be_true
59
+ expect(rule.applies_to?(permissions.new)).to eq(true)
61
60
  end
62
61
 
63
62
  it 'returns false if passed unless-condition evaluated in scope of passed argument return true' do
64
63
  rule = described_class.new(:index, 'entries', unless: -> { admin? })
65
- expect(rule.applies_to?(permissions.new(true))).to be_false
64
+ expect(rule.applies_to?(permissions.new(true))).to eq(false)
66
65
  end
67
66
 
68
67
  it 'evaluates unless-condition specified as symbol' do
69
68
  rule = described_class.new(:index, 'entries', unless: :admin?)
70
- expect(rule.applies_to?(permissions.new(false))).to be_true
69
+ expect(rule.applies_to?(permissions.new(false))).to eq(true)
71
70
  end
72
71
 
73
72
  it 'evaluates unless-condition specified as proc' do
74
73
  rule = described_class.new(:index, 'entries', unless: proc { admin? })
75
- expect(rule.applies_to?(permissions.new(false))).to be_true
74
+ expect(rule.applies_to?(permissions.new(false))).to eq(true)
76
75
  end
77
76
 
78
77
  it 'returns true if all conditions returned true' do
79
78
  rule = described_class.new(:index, 'entries', if: -> { admin? }, unless: -> { guest? })
80
- expect(rule.applies_to?(permissions.new(true))).to be_true
79
+ expect(rule.applies_to?(permissions.new(true))).to eq(true)
81
80
  end
82
81
  end
83
82
  end
@@ -1,15 +1,15 @@
1
1
  require 'simplecov'
2
2
 
3
- SimpleCov.start
3
+ SimpleCov.start do
4
+ add_filter 'lib/'
5
+ end
4
6
 
5
7
  require 'rubygems'
6
8
 
7
- require 'active_support/concern'
8
9
  require 'action_controller'
9
10
  require 'cannie'
10
11
 
11
12
  RSpec.configure do |config|
12
- config.treat_symbols_as_metadata_keys_with_true_values = true
13
13
  config.filter_run focus: true
14
14
  config.run_all_when_everything_filtered = true
15
15
  end
metadata CHANGED
@@ -1,69 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cannie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2016-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: actionpack
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '4.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '4.0'
55
- - !ruby/object:Gem::Dependency
56
- name: activesupport
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '4.0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
54
  version: '4.0'
69
55
  description: Cannie is a gem for authorization/permissions checking on per-controller/per-action
@@ -73,10 +59,11 @@ executables: []
73
59
  extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
76
- - .gitignore
77
- - .rspec
78
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
79
65
  - Gemfile
66
+ - Gemfile.lock
80
67
  - LICENSE.txt
81
68
  - README.md
82
69
  - Rakefile
@@ -104,17 +91,17 @@ require_paths:
104
91
  - lib
105
92
  required_ruby_version: !ruby/object:Gem::Requirement
106
93
  requirements:
107
- - - '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  required_rubygems_version: !ruby/object:Gem::Requirement
111
98
  requirements:
112
- - - '>='
99
+ - - ">="
113
100
  - !ruby/object:Gem::Version
114
101
  version: '0'
115
102
  requirements: []
116
103
  rubyforge_project:
117
- rubygems_version: 2.1.5
104
+ rubygems_version: 2.5.1
118
105
  signing_key:
119
106
  specification_version: 4
120
107
  summary: Simple gem for checking permissions on per-action basis