allowy 0.4.0 → 0.5.0

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: b0c812f02b362a9cd39e6d21e78d34ac26eb4fb8
4
- data.tar.gz: 431339350e36a7c4679085622a0ae615050225a2
3
+ metadata.gz: 6226c1034c094d096ce0d675ece0e96742691b35
4
+ data.tar.gz: 7996daebd96790d93fdf834e5a31a6fd94757600
5
5
  SHA512:
6
- metadata.gz: 5500d84fd789ce65f61be27367c7e5b954c1d463a1bd7f79d50d6691353d69fc97a9cf21b088a00ad6f234822657ac8d29bdbec5a2c8e850ce39b208e59fc113
7
- data.tar.gz: 470b7c6b540808ca3cee9a51db70601b315d95c0c4574c4cfe8a63576fde312a93c9ca40cc5ab02722526f091fe966b7ed5cf2e0af25004c37f9e20bc19bc938
6
+ metadata.gz: c3afa5620c56fee9b6d539542ea6a2e37019fe30f19e0dafe2fa04ede0b2dabfc994b5c8cb3782dc33f996db10ffe2aa77db7c3258e4dd73399f4cbfb8ebe417
7
+ data.tar.gz: d9237a944aba5343928381310eff16abd08369f8085067fa78fc037b0196ec6e497cfafebe5eddfdebdce50b93eefda92db7395a1e1be772f8420345386d6a3c
@@ -12,8 +12,6 @@ module Allowy
12
12
  end
13
13
 
14
14
  def access_control_for(subject)
15
- return unless subject
16
-
17
15
  # Try subject as decorated object
18
16
  clazz = class_for "#{subject.class.source_class.name}Access" if subject.class.respond_to?(:source_class)
19
17
 
@@ -1,3 +1,3 @@
1
1
  module Allowy
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -40,7 +40,7 @@ module Allowy
40
40
  end
41
41
 
42
42
  it "should not raise error" do
43
- expect { subject.authorize! :read, 'allow' }.not_to raise_error AccessDenied
43
+ expect { subject.authorize! :read, 'allow' }.not_to raise_error
44
44
  end
45
45
  end
46
46
 
@@ -8,7 +8,7 @@ module Allowy
8
8
  describe Context do
9
9
 
10
10
  subject { SampleContext.new }
11
- let(:access) { stub }
11
+ let(:access) { double("Access") }
12
12
 
13
13
  it "should create a registry" do
14
14
  Registry.should_receive(:new).with(subject)
@@ -25,6 +25,14 @@ module Allowy
25
25
  lambda { subject.access_control_for!(nil) }.should raise_error UndefinedAccessControl
26
26
  end
27
27
 
28
+ it "should return NilClassAccess when subject is nil and NilClassAccess is defined" do
29
+ nil_class_access = Class.new do
30
+ include Allowy::AccessControl
31
+ end
32
+ stub_const("NilClassAccess", nil_class_access)
33
+ subject.access_control_for!(nil).should be_a nil_class_access
34
+ end
35
+
28
36
  it "should return the same AC instance" do
29
37
  first = subject.access_control_for!(Sample)
30
38
  secnd = subject.access_control_for!(Sample)
@@ -4,7 +4,7 @@ require 'allowy/rspec'
4
4
  module Allowy
5
5
  describe ControllerAuthorizationMacros do
6
6
  include ControllerAuthorizationMacros
7
- before { @controller = stub("FakeController") }
7
+ before { @controller = double("FakeController") }
8
8
 
9
9
  ignore_authorization!
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allowy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmytrii Nagirniak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-28 00:00:00.000000000 Z
11
+ date: 2014-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n