allowy 1.0.0 → 2.0.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: 6e70d04247b27e11e8d0d39d0ce3ae32c2c873ad
4
- data.tar.gz: d8d7186771b7dd8ce1176ce9fe082b9bf6fd205f
3
+ metadata.gz: a57eaeb7cde5ce2812a99438b3f1db2341c2fdac
4
+ data.tar.gz: 7f9f72f90ca54a18c64cbda8ac15e957ed14040a
5
5
  SHA512:
6
- metadata.gz: 8c0870403d5852d0d0dbff52004ffec7fb88da6378fdefd81c60c73cfd366c104ebe964ecc1191f079712e99e054f21712cac19f5c5e270586d637028675ebf3
7
- data.tar.gz: 9e571abf64019ca7aa3bcf5d1cb4bf344b142c1db220ca5de0522dd10d5e8bafbc2772ed369d4e8e1d94a3fbf460f9cfc99fe189cfaf2b5505fb032f7396660d
6
+ metadata.gz: 2e79765e66f531df1471f472f8dcaa50d9e6350e09680ae006d2884ba70665dcac854e893298394d64e28cb8d9f9116f3ff785ad66a9c88d3ea012acada4b54c
7
+ data.tar.gz: 6cbb86ae3ed61d41bdc501a5fe828f31d2469ac15abbf0078ff15a68d9c0714c432c3203b19a38287170e75b9f6748c046bcf004987bd639ad18868c20ed2d92
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.1.1"
4
+ - jruby-19mode
5
+ - rbx
6
+ script: bundle exec rspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Dmytrii Nagirniak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -330,9 +330,4 @@ bundle install
330
330
  bundle exec rspec spec/
331
331
  ```
332
332
 
333
-
334
- Pull requests are very welcome, but please include the specs.
335
-
336
- # License
337
-
338
- [MIT] (http://www.opensource.org/licenses/mit-license.php)
333
+ Pull requests are very welcome, but please include the specs.
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "https://github.com/dnagir/allowy"
11
11
  s.summary = %q{Authorization with simplicity and explicitness in mind}
12
12
  s.description = %q{Allowy provides CanCan-like way of checking permission but doesn't enforce a tight DSL giving you more control}
13
+ s.licenses = ["MIT"]
13
14
 
14
15
  s.rubyforge_project = "allowy"
15
16
 
@@ -23,6 +24,7 @@ Gem::Specification.new do |s|
23
24
  s.add_runtime_dependency "activesupport", ">= 3.2"
24
25
 
25
26
  s.add_development_dependency "rspec"
27
+ s.add_development_dependency "its"
26
28
  s.add_development_dependency "pry"
27
29
  s.add_development_dependency "guard"
28
30
  s.add_development_dependency "guard-rspec"
@@ -25,6 +25,8 @@ module Allowy
25
25
  def negative_failure_message
26
26
  say "expected NOT to be able to"
27
27
  end
28
+
29
+ alias_method :failure_message_when_negated, :negative_failure_message
28
30
  end
29
31
 
30
32
  def be_able_to(*args)
@@ -12,19 +12,19 @@ module Allowy
12
12
 
13
13
 
14
14
  def should_authorize_for(*args)
15
- allowy.should_receive(:authorize!).with(*args)
15
+ expect(allowy).to receive(:authorize!).with(*args)
16
16
  end
17
17
 
18
18
  def should_not_authorize_for(*args)
19
- allowy.should_not_receive(:authorize!).with(*args)
19
+ expect(allowy).not_to receive(:authorize!).with(*args)
20
20
  end
21
21
 
22
22
  module ClassMethods
23
23
  def ignore_authorization!
24
24
  before(:each) do
25
25
  registry = double 'Registry'
26
- registry.stub(:can? => true, :cannot? => false, :authorize! => nil, access_control_for!: registry)
27
- @controller.stub(:current_allowy).and_return registry
26
+ allow(registry).to receive_messages(:can? => true, :cannot? => false, :authorize! => nil, access_control_for!: registry)
27
+ allow(@controller).to receive(:current_allowy).and_return registry
28
28
  end
29
29
  end
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module Allowy
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -9,7 +9,8 @@ module Allowy
9
9
  describe "#context as an arbitrary object" do
10
10
  subject { access.context }
11
11
  its(:to_s) { should == '123' }
12
- its(:zero?) { should be_false }
12
+ its(:zero?) { should == false }
13
+
13
14
  it "should be able to access the context" do
14
15
  access.should be_able_to :context_is_123
15
16
  end
@@ -11,25 +11,25 @@ module Allowy
11
11
  let(:access) { double("Access") }
12
12
 
13
13
  it "should create a registry" do
14
- Registry.should_receive(:new).with(subject)
14
+ expect(Registry).to receive(:new).with(subject)
15
15
  subject.current_allowy
16
16
  end
17
17
 
18
18
  it "should be able to check using can?" do
19
- subject.current_allowy.should_receive(:access_control_for!).with(123).and_return access
20
- access.should_receive(:can?).with(:edit, 123)
19
+ expect(subject.current_allowy).to receive(:access_control_for!).with(123).and_return access
20
+ expect(access).to receive(:can?).with(:edit, 123)
21
21
  subject.can?(:edit, 123)
22
22
  end
23
23
 
24
24
  it "should be able to check using cannot?" do
25
- subject.current_allowy.should_receive(:access_control_for!).with(123).and_return access
26
- access.should_receive(:cannot?).with(:edit, 123)
25
+ expect(subject.current_allowy).to receive(:access_control_for!).with(123).and_return access
26
+ expect(access).to receive(:cannot?).with(:edit, 123)
27
27
  subject.cannot?(:edit, 123)
28
28
  end
29
29
 
30
30
  it "should call authorize!" do
31
- access.should_receive(:authorize!).with :edit, 123
32
- subject.current_allowy.stub(:access_control_for! => access)
31
+ expect(access).to receive(:authorize!).with :edit, 123
32
+ allow(subject.current_allowy).to receive(:access_control_for!).and_return access
33
33
  subject.authorize! :edit, 123
34
34
  end
35
35
  end
@@ -17,6 +17,7 @@ module Allowy
17
17
  should_authorize_for(:create, 123)
18
18
  allowy.authorize!(:create, 123)
19
19
  end
20
+
20
21
  it "works when not authorised" do
21
22
  should_not_authorize_for(:create, 123)
22
23
  allowy.authorize!(:edit, 123)
@@ -1,10 +1,13 @@
1
1
  require 'pry'
2
+ require 'its'
2
3
  require 'allowy'
3
4
  require 'allowy/matchers'
4
5
 
5
6
  RSpec.configure do |c|
6
- c.treat_symbols_as_metadata_keys_with_true_values = true
7
7
  c.run_all_when_everything_filtered = true
8
+ c.expect_with :rspec do |c|
9
+ c.syntax = [:should, :expect]
10
+ end
8
11
  end
9
12
 
10
13
  class SampleAccess
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: 1.0.0
4
+ version: 2.0.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: 2014-08-06 00:00:00.000000000 Z
11
+ date: 2014-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: its
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: pry
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -104,8 +118,10 @@ extra_rdoc_files: []
104
118
  files:
105
119
  - ".gitignore"
106
120
  - ".rspec"
121
+ - ".travis.yml"
107
122
  - Gemfile
108
123
  - Guardfile
124
+ - LICENSE
109
125
  - README.md
110
126
  - Rakefile
111
127
  - allowy.gemspec
@@ -123,7 +139,8 @@ files:
123
139
  - spec/rspec_spec.rb
124
140
  - spec/spec_helper.rb
125
141
  homepage: https://github.com/dnagir/allowy
126
- licenses: []
142
+ licenses:
143
+ - MIT
127
144
  metadata: {}
128
145
  post_install_message:
129
146
  rdoc_options: []