cancancan 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZDhlZWZlYTNiNDExOThhZDQwNDNmNTcxMmEyYTNkODA2MDNlNzkzNQ==
5
- data.tar.gz: !binary |-
6
- NzRlNmFkYTczZWUwNThkMmFiYmQ5OTg4NTAzNzZiMmRmOGNlYWY5YQ==
2
+ SHA1:
3
+ metadata.gz: 8b59519bf23ea010add87e590aa543603311e94d
4
+ data.tar.gz: d5d584471d88253c065dc4fb4cc6019e89f8628c
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZWZjZGM0MGM3YWZhZjRlOWUwMDI0MWExODg1Njk5OWVlZjcxNjYyMjc4OTEx
10
- N2Q3YTEyZDNhNDA4ZTUxOWVhNTg5OTljYmFlY2U0ZDg5NDEwODUxMGI0ZTli
11
- NmIzMmVkYzY0MmI3NGMwM2QxMjk5ZWE2NWQ4MDk1OTg4NDJhM2U=
12
- data.tar.gz: !binary |-
13
- ZjI5OWQyYjg0MzYwYzdiYzAzNjI1MzIxNDI1NmE5OTgyZmI3MDhkMmY2ODg5
14
- MTFlNzA2NWNjNmY4MTlmMzU1N2E4ZWIzYWYzOGE5MDk2MGU5NDZmNDg4ZTUy
15
- Mzk5MjRlNTNkMmI4YzE3YzAwMzJkYzYzZGU2NWEzOTcyNjUzOGE=
6
+ metadata.gz: bc703861ff1b65926ae6f4f1cf0141a3942b06aba4b3d8809c3db037adb658b3bf8976ccb90fbe8373aad8c095ccdef517af992978678aa748f21a0673b4cc14
7
+ data.tar.gz: 688d72ac6ed5133c4166dc56621fa489b31de8320462a24baa7c83bb93103cc9bf7a0592baab9fe32f886bfd744fa9f75a7e379a8fc69ed175a96de88c5c2856
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ .DS_Store
2
+ .idea/*
3
+ *.swp
4
+ **/*.swp
5
+ *.gem
6
+ .bundle
7
+
8
+ gemfiles/*.lock
9
+ Gemfile.lock
10
+
11
+ .rvmrc
12
+ .rbenv-version
13
+ .ruby-version
14
+ .ruby-gemset
15
+ /tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,21 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
+ - ree
8
+ - jruby
9
+ - rbx
10
+ gemfile:
11
+ - gemfiles/rails_3.0.gemfile
12
+ - gemfiles/rails_3.0_datamapper.gemfile
13
+ - gemfiles/rails_3.0_mongoid.gemfile
14
+ services:
15
+ - mongodb
16
+ matrix:
17
+ allow_failures:
18
+ - rvm: rbx
19
+ notifications:
20
+ recipients:
21
+ - bryan@bryanrite.com
data/Appraisals ADDED
@@ -0,0 +1,28 @@
1
+ appraise "rails_3.0" do
2
+ gem "activerecord", "~> 3.0.20", :require => "active_record"
3
+ gem "with_model", "~> 0.2.5"
4
+ gem "meta_where"
5
+
6
+ gemfile.platforms :jruby do
7
+ gem "activerecord-jdbcsqlite3-adapter"
8
+ gem "jdbc-sqlite3"
9
+ end
10
+
11
+ gemfile.platforms :ruby, :mswin, :mingw do
12
+ gem "sqlite3"
13
+ end
14
+ end
15
+
16
+ appraise "rails_3.0_datamapper" do
17
+ gem "dm-core", "~> 1.0.2"
18
+ gem "dm-sqlite-adapter", "~> 1.0.2"
19
+ gem "dm-migrations", "~> 1.0.2"
20
+ end
21
+
22
+ appraise "rails_3.0_mongoid" do
23
+ gem "mongoid", "~> 2.0.0"
24
+
25
+ gemfile.platforms :ruby, :mswin, :mingw do
26
+ gem "bson_ext", "~> 1.1"
27
+ end
28
+ end
data/CHANGELOG.rdoc CHANGED
@@ -1,6 +1,13 @@
1
1
  Master
2
2
 
3
3
 
4
+ 1.7.1 (March 19th, 2014)
5
+
6
+ * Fix ryanb/cancan#992 - Remove Rails 4 deprecations for scoped (thejchap & hitendrasingh)
7
+
8
+ * Fix cancancan#16 - RSpec expectations are not explicitly required in RSpec > 2.13 (justinaiken & bryanrite)
9
+
10
+
4
11
  1.7.0 (February 19th, 2014)
5
12
 
6
13
  * Feature #988 Adds support for strong_parameters (bryanrite)
data/CONTRIBUTING.md CHANGED
@@ -1,11 +1,23 @@
1
- ### Please read before contributing
1
+ ## Contributing to CanCanCan
2
2
 
3
- 1) If you have any questions about CanCan, search the [Wiki](https://github.com/bryanrite/cancancan/wiki) or use [Stack Overflow](http://stackoverflow.com/questions/tagged/cancancan). Do not post questions here.
3
+ ### Reporting an Issue
4
4
 
5
- 2) If you find a security bug, **DO NOT** submit an issue here. Please send an e-mail to [bryan@bryanrite.com](mailto:bryan@bryanrite.com) instead.
5
+ 1. If you have any questions about CanCanCan, search the [Wiki](https://github.com/bryanrite/cancancan/wiki), use [Stack Overflow](http://stackoverflow.com/questions/tagged/cancancan), or [our mailing list](https://groups.google.com/forum/#!forum/cancancan). Do not post questions here.
6
6
 
7
- 3) Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed. In case it was not, create your report including Rails and CanCan versions. If you are getting exceptions, please include the full backtrace.
7
+ 1. If you find a security bug, **DO NOT** submit an issue here. Please send an e-mail to [bryan@bryanrite.com](mailto:bryan@bryanrite.com) instead.
8
8
 
9
- That's it! The more information you give, the more easy it becomes for us to track it down and fix it. Ideal scenario would be adding the issue to CanCan test suite or to a sample application.
9
+ 1. Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed.
10
+
11
+ 1. Create your report including Rails and CanCanCan versions. If you are getting exceptions, please include the full backtrace.
12
+
13
+ That's it! The more information you give, the more easy it becomes for us to track it down and fix it. Ideal scenario would be adding the issue to CanCanCan test suite or to a sample application.
14
+
15
+ ### Adding new Features or Bugfixes
16
+
17
+ CanCanCan uses a [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) development model. The latest "released" version of CanCanCan, the latest gem version, can always be found on `master`, while the next version or nightly is on `develop`.
18
+
19
+ Please make sure you have test coverage for anything you add or fix!
20
+
21
+ Please add a CHANGELOG entry with any relevant tags for issues, pull-requests, and authors.
10
22
 
11
23
  Thanks!
data/Gemfile CHANGED
@@ -1,23 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- case ENV["MODEL_ADAPTER"]
4
- when nil, "active_record"
5
- # Sqlite for CRuby, Rubinius, including Windows and RubyInstaller
6
- gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
7
- # Sqlite for JRuby
8
- gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
9
- gem "activerecord", '~> 3.0.9', :require => "active_record"
10
- gem "with_model", "~> 0.2.5"
11
- gem "meta_where"
12
- when "data_mapper"
13
- gem "dm-core", "~> 1.0.2"
14
- gem "dm-sqlite-adapter", "~> 1.0.2"
15
- gem "dm-migrations", "~> 1.0.2"
16
- when "mongoid"
17
- gem "bson_ext", "~> 1.1"
18
- gem "mongoid", "~> 2.0.0.beta.20"
19
- else
20
- raise "Unknown model adapter: #{ENV["MODEL_ADAPTER"]}"
21
- end
22
-
23
3
  gemspec
data/LICENSE CHANGED
@@ -1,5 +1,7 @@
1
1
  Copyright (c) 2011 Ryan Bates
2
2
 
3
+ MIT License
4
+
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
5
7
  "Software"), to deal in the Software without restriction, including
@@ -17,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -1,7 +1,8 @@
1
- = CanCan
2
- {<img src="https://fury-badge.herokuapp.com/rb/cancancan.png" alt="Gem Version" />}[http://badge.fury.io/rb/cancancan]
3
- {<img src="https://secure.travis-ci.org/bryanrite/cancancan.png?branch=master" />}[http://travis-ci.org/bryanrite/cancancan]
4
- {<img src="https://codeclimate.com/github/bryanrite/cancancan.png" />}[https://codeclimate.com/github/bryanrite/cancancan]
1
+ = CanCanCan
2
+ {<img src="https://badge.fury.io/rb/cancancan.png" alt="Gem Version" />}[http://badge.fury.io/rb/cancancan]
3
+ {<img src="https://travis-ci.org/CanCanCommunity/cancancan.png?branch=master" alt="Build Status" />}[https://travis-ci.org/CanCanCommunity/cancancan]
4
+ {<img src="https://codeclimate.com/github/bryanrite/cancancan.png?" alt="Code Climate" />}[https://codeclimate.com/github/bryanrite/cancancan]
5
+ {<img src="http://inch-pages.github.io/github/CanCanCommunity/cancancan.png" alt="Inline docs" />}[http://inch-pages.github.io/github/CanCanCommunity/cancancan]
5
6
 
6
7
  Wiki[https://github.com/bryanrite/cancancan/wiki] | RDocs[http://rdoc.info/projects/ryanb/cancan] | Screencast[http://railscasts.com/episodes/192-authorization-with-cancan]
7
8
 
@@ -10,7 +11,7 @@ CanCan is an authorization library for Ruby on Rails which restricts what resour
10
11
 
11
12
  == Mission
12
13
 
13
- This repo is a continuation of the dead CanCan[https://github.com/rbates/cancan] project. Our mission is to keep CanCan alive and moving forward, with maintenance fixes and new features. Pull Requests are welcome!
14
+ This repo is a continuation of the dead CanCan[https://github.com/ryanb/cancan] project. Our mission is to keep CanCan alive and moving forward, with maintenance fixes and new features. Pull Requests are welcome!
14
15
 
15
16
  I am currently focusing on the 1.x branch for the immediate future, making sure it is up to date as well as ensuring compatibility with Rails 4+. I will take a look into the 2.x branch and try to see what improvements, reorganizations and redesigns Ryan was attempting and go forward from there.
16
17
 
@@ -19,7 +20,7 @@ Any help is greatly appreciated, feel free to submit pull-requests or open issue
19
20
 
20
21
  == Installation
21
22
 
22
- In <b>Rails 3</b>, add this to your Gemfile and run the +bundle+ command.
23
+ In <b>Rails 3 and 4</b>, add this to your Gemfile and run the +bundle+ command.
23
24
 
24
25
  gem 'cancancan', '~> 1.7'
25
26
 
@@ -34,12 +35,12 @@ Alternatively, you can install it as a plugin.
34
35
 
35
36
  == Getting Started
36
37
 
37
- CanCan expects a +current_user+ method to exist in the controller. First, set up some authentication (such as Authlogic[https://github.com/binarylogic/authlogic] or Devise[https://github.com/plataformatec/devise]). See {Changing Defaults}[https://github.com/bryanrite/cancan/wiki/changing-defaults] if you need different behavior.
38
+ CanCanCan expects a +current_user+ method to exist in the controller. First, set up some authentication (such as Authlogic[https://github.com/binarylogic/authlogic] or Devise[https://github.com/plataformatec/devise]). See {Changing Defaults}[https://github.com/bryanrite/cancancan/wiki/changing-defaults] if you need different behavior.
38
39
 
39
40
 
40
41
  === 1. Define Abilities
41
42
 
42
- User permissions are defined in an +Ability+ class. CanCan 1.5 includes a Rails 3 generator for creating this class.
43
+ User permissions are defined in an +Ability+ class. CanCan 1.5 includes a Rails 3 and 4 generator for creating this class.
43
44
 
44
45
  rails g cancan:ability
45
46
 
@@ -52,7 +53,7 @@ In Rails 2.3, just add a new class in <tt>app/models/ability.rb</tt> with the fo
52
53
  end
53
54
  end
54
55
 
55
- See {Defining Abilities}[https://github.com/bryanrite/cancan/wiki/defining-abilities] for details.
56
+ See {Defining Abilities}[https://github.com/bryanrite/cancancan/wiki/defining-abilities] for details.
56
57
 
57
58
 
58
59
  === 2. Check Abilities & Authorization
@@ -115,6 +116,8 @@ Additionally, <tt>load_and_authorize_resource</tt> can now take a <tt>param_meth
115
116
  end
116
117
  end
117
118
 
119
+ See {Strong Parameters}[https://github.com/bryanrite/cancancan/wiki/Strong-Parameters] for more information.
120
+
118
121
  === 3. Handle Unauthorized Access
119
122
 
120
123
  If the user authorization fails, a <tt>CanCan::AccessDenied</tt> exception will be raised. You can catch this and modify its behavior in the +ApplicationController+.
@@ -151,9 +154,18 @@ This will raise an exception if authorization is not performed in an action. If
151
154
 
152
155
  == Questions or Problems?
153
156
 
154
- If you have any issues with CanCan which you cannot find the solution to in the documentation[https://github.com/bryanrite/cancancan/wiki], please add an {issue on GitHub}[https://github.com/bryanrite/cancancan/issues] or fork the project and send a pull request.
157
+ If you have any issues with CanCan which you cannot find the solution to in the documentation[https://github.com/bryanrite/cancancan/wiki] or our mailing list: http://groups.google.com/group/cancancan, please add an {issue on GitHub}[https://github.com/bryanrite/cancancan/issues] or fork the project and send a pull request.
158
+
159
+
160
+ == Development
161
+
162
+ Cancancan uses {appraisals}[https://github.com/thoughtbot/appraisal] to test the code base against multiple versions of rails, as well as the different model adapters.
163
+
164
+ When first developing, you may need to run <tt>bundle install</tt> and then <tt>appraisal install</tt>, to install the different sets.
165
+
166
+ You can then run all appraisal files (like CI does), with <tt>appraisal rake</tt> or just run a specific set <tt>appraisal rails_3.0 rake</tt>.
155
167
 
156
- To get the specs running you should call +bundle+ and then +rake+. See the {spec/README}[https://github.com/bryanrite/cancancan/blob/master/spec/README.rdoc] for more information.
168
+ See the {CONTRIBUTING}[https://github.com/CanCanCommunity/cancancan/blob/develop/CONTRIBUTING.md] and {spec/README}[https://github.com/bryanrite/cancancan/blob/master/spec/README.rdoc] for more information.
157
169
 
158
170
 
159
171
  == Special Thanks
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require "bundler/gem_tasks"
1
2
  require 'rubygems'
2
3
  require 'rake'
3
4
  require 'rspec/core/rake_task'
@@ -7,12 +8,4 @@ RSpec::Core::RakeTask.new do |t|
7
8
  t.verbose = false
8
9
  end
9
10
 
10
- desc "Run specs for all adapters"
11
- task :spec_all do
12
- %w[active_record data_mapper mongoid].each do |model_adapter|
13
- puts "MODEL_ADAPTER = #{model_adapter}"
14
- system "rake spec MODEL_ADAPTER=#{model_adapter}"
15
- end
16
- end
17
-
18
11
  task :default => :spec
data/cancancan.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cancan/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "cancancan"
8
+ s.version = CanCan::VERSION
9
+ s.authors = ["Bryan Rite", "Ryan Bates"]
10
+ s.email = "bryan@bryanrite.com"
11
+ s.homepage = "https://github.com/CanCanCommunity/cancancan"
12
+ s.summary = "Simple authorization solution for Rails."
13
+ s.description = "Continuation of the simple authorization solution for Rails which is decoupled from user roles. All permissions are stored in a single location."
14
+ s.platform = Gem::Platform::RUBY
15
+ s.license = "MIT"
16
+
17
+ s.files = `git ls-files`.split($/)
18
+ s.test_files = `git ls-files -- Appraisals {spec,features,gemfiles}/*`.split($/)
19
+ s.executables = `git ls-files -- bin/*`.split($/).map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
23
+ s.required_rubygems_version = ">= 1.3.4"
24
+
25
+ s.add_development_dependency 'rspec', '~> 2.14'
26
+ s.add_development_dependency 'supermodel', '~> 0.1.6'
27
+ s.add_development_dependency 'appraisal', '>= 1.0.0.beta3'
28
+
29
+ s.rubyforge_project = s.name
30
+ end
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 3.0.20", :require=>"active_record"
6
+ gem "with_model", "~> 0.2.5"
7
+ gem "meta_where"
8
+
9
+ platforms :jruby do
10
+ gem "activerecord-jdbcsqlite3-adapter"
11
+ gem "jdbc-sqlite3"
12
+ end
13
+
14
+ platforms :ruby, :mswin, :mingw do
15
+ gem "sqlite3"
16
+ end
17
+
18
+ gemspec :path=>".././"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "dm-core", "~> 1.0.2"
6
+ gem "dm-sqlite-adapter", "~> 1.0.2"
7
+ gem "dm-migrations", "~> 1.0.2"
8
+
9
+ gemspec :path=>".././"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mongoid", "~> 2.0.0"
6
+
7
+ platforms :ruby, :mswin, :mingw do
8
+ gem "bson_ext", "~> 1.1"
9
+ end
10
+
11
+ gemspec :path=>".././"
data/lib/cancan.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "cancan/version"
1
2
  require 'cancan/ability'
2
3
  require 'cancan/rule'
3
4
  require 'cancan/controller_resource'
@@ -1,4 +1,12 @@
1
1
  rspec_module = defined?(RSpec::Core) ? 'RSpec' : 'Spec' # for RSpec 1 compatability
2
+
3
+ if rspec_module == 'RSpec'
4
+ require 'rspec/core'
5
+ require 'rspec/expectations'
6
+ else
7
+ ActiveSupport::Deprecation.warn("RSpec v1 will not be supported in the CanCanCan >= 2.0.0")
8
+ end
9
+
2
10
  Kernel.const_get(rspec_module)::Matchers.define :be_able_to do |*args|
3
11
  match do |ability|
4
12
  ability.can?(*args)
@@ -97,7 +97,7 @@ module CanCan
97
97
 
98
98
  def database_records
99
99
  if override_scope
100
- @model_class.scoped.merge(override_scope)
100
+ @model_class.where(nil).merge(override_scope)
101
101
  elsif @model_class.respond_to?(:where) && @model_class.respond_to?(:joins)
102
102
  mergeable_conditions = @rules.select {|rule| rule.unmergeable? }.blank?
103
103
  if mergeable_conditions
@@ -106,7 +106,7 @@ module CanCan
106
106
  @model_class.where(*(@rules.map(&:conditions))).includes(joins)
107
107
  end
108
108
  else
109
- @model_class.scoped(:conditions => conditions, :joins => joins)
109
+ @model_class.all(:conditions => conditions, :joins => joins)
110
110
  end
111
111
  end
112
112
 
data/lib/cancan/rule.rb CHANGED
@@ -111,7 +111,7 @@ module CanCan
111
111
  else
112
112
  attribute = subject.send(name)
113
113
  if value.kind_of?(Hash)
114
- if attribute.kind_of?(Array) || attribute.kind_of?(ActiveRecord::Relation)
114
+ if attribute.kind_of?(Array) || (defined?(ActiveRecord) && attribute.kind_of?(ActiveRecord::Relation))
115
115
  attribute.any? { |element| matches_conditions_hash? element, value }
116
116
  else
117
117
  !attribute.nil? && matches_conditions_hash?(attribute, value)
@@ -0,0 +1,3 @@
1
+ module CanCan
2
+ VERSION = "1.7.1"
3
+ end
data/spec/README.rdoc CHANGED
@@ -5,24 +5,23 @@
5
5
  To run the specs first run the +bundle+ command to install the necessary gems and the +rake+ command to run the specs.
6
6
 
7
7
  bundle
8
- rake
9
8
 
10
- The specs currently require Ruby 1.8.7. Ruby 1.9.2 support will be coming soon.
9
+ Then run the appraisal command to install all the necssary test sets:
11
10
 
11
+ appraisal install
12
12
 
13
- == Model Adapters
13
+ You can then run all test sets:
14
+
15
+ appraisal rake
14
16
 
15
- CanCan offers separate specs for different model adapters (such as Mongoid and Data Mapper). By default it will use Active Record but you can change this by setting the +MODEL_ADAPTER+ environment variable before running. You can run the +bundle+ command with this as well to ensure you have the installed gems.
17
+ Or individual ones:
16
18
 
17
- MODEL_ADAPTER=data_mapper bundle
18
- MODEL_ADAPTER=data_mapper rake
19
+ appraisal rails_3.0 rake
19
20
 
20
- The different model adapters you can specify are:
21
+ A list of the tests is in the +Appraisal+ file.
21
22
 
22
- * active_record (default)
23
- * data_mapper
24
- * mongoid
23
+ The specs support Ruby 1.8.7+
25
24
 
26
- You can also run the +spec_all+ rake task to run specs for each adapter.
25
+ == Model Adapters
27
26
 
28
- rake spec_all
27
+ The model adapter ENV setting has been removed and replaced with the +Appraisal+ file.
@@ -1,5 +1,10 @@
1
- if ENV["MODEL_ADAPTER"].nil? || ENV["MODEL_ADAPTER"] == "active_record"
2
- require "spec_helper"
1
+ require "spec_helper"
2
+
3
+ if defined? CanCan::ModelAdapters::ActiveRecordAdapter
4
+
5
+ RSpec.configure do |config|
6
+ config.extend WithModel
7
+ end
3
8
 
4
9
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
5
10
 
@@ -1,5 +1,6 @@
1
- if ENV["MODEL_ADAPTER"] == "data_mapper"
2
- require "spec_helper"
1
+ require "spec_helper"
2
+
3
+ if defined? CanCan::ModelAdapters::DataMapperAdapter
3
4
 
4
5
  DataMapper.setup(:default, 'sqlite::memory:')
5
6
 
@@ -1,5 +1,6 @@
1
- if ENV["MODEL_ADAPTER"] == "mongoid"
2
- require "spec_helper"
1
+ require "spec_helper"
2
+
3
+ if defined? CanCan::ModelAdapters::MongoidAdapter
3
4
 
4
5
  class MongoidCategory
5
6
  include Mongoid::Document
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,17 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
- Bundler.require(:default)
4
+ Bundler.require
5
5
 
6
- require 'supermodel' # shouldn't Bundler do this already?
7
- require 'active_support/all'
6
+ require 'supermodel'
8
7
  require 'matchers'
9
8
  require 'cancan/matchers'
9
+ require 'i18n'
10
+
11
+ # I8n setting to fix deprecation.
12
+ # Seting it to true will skip the locale validation (Rails 3 behavior).
13
+ # Seting it to false will raise an error if an invalid locale is passed (Rails 4 behavior).
14
+ I18n.enforce_available_locales = false
10
15
 
11
16
  RSpec.configure do |config|
12
17
  config.treat_symbols_as_metadata_keys_with_true_values = true
@@ -22,7 +27,6 @@ RSpec.configure do |config|
22
27
  Project.delete_all
23
28
  Category.delete_all
24
29
  end
25
- config.extend WithModel if ENV["MODEL_ADAPTER"].nil? || ENV["MODEL_ADAPTER"] == "active_record"
26
30
  end
27
31
 
28
32
  # Working around CVE-2012-5664 requires us to convert all ID params
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancancan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Rite
@@ -9,50 +9,50 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-19 00:00:00.000000000 Z
12
+ date: 2014-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '2.14'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '2.14'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rails
29
+ name: supermodel
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 3.0.9
34
+ version: 0.1.6
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 3.0.9
41
+ version: 0.1.6
42
42
  - !ruby/object:Gem::Dependency
43
- name: supermodel
43
+ name: appraisal
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 0.1.4
48
+ version: 1.0.0.beta3
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.1.4
55
+ version: 1.0.0.beta3
56
56
  description: Continuation of the simple authorization solution for Rails which is
57
57
  decoupled from user roles. All permissions are stored in a single location.
58
58
  email: bryan@bryanrite.com
@@ -60,6 +60,22 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - Appraisals
67
+ - CHANGELOG.rdoc
68
+ - CONTRIBUTING.md
69
+ - Gemfile
70
+ - LICENSE
71
+ - README.rdoc
72
+ - Rakefile
73
+ - cancancan.gemspec
74
+ - gemfiles/rails_3.0.gemfile
75
+ - gemfiles/rails_3.0_datamapper.gemfile
76
+ - gemfiles/rails_3.0_mongoid.gemfile
77
+ - init.rb
78
+ - lib/cancan.rb
63
79
  - lib/cancan/ability.rb
64
80
  - lib/cancan/controller_additions.rb
65
81
  - lib/cancan/controller_resource.rb
@@ -73,11 +89,12 @@ files:
73
89
  - lib/cancan/model_adapters/mongoid_adapter.rb
74
90
  - lib/cancan/model_additions.rb
75
91
  - lib/cancan/rule.rb
76
- - lib/cancan.rb
92
+ - lib/cancan/version.rb
77
93
  - lib/cancancan.rb
94
+ - lib/generators/cancan/ability/USAGE
78
95
  - lib/generators/cancan/ability/ability_generator.rb
79
96
  - lib/generators/cancan/ability/templates/ability.rb
80
- - lib/generators/cancan/ability/USAGE
97
+ - spec/README.rdoc
81
98
  - spec/cancan/ability_spec.rb
82
99
  - spec/cancan/controller_additions_spec.rb
83
100
  - spec/cancan/controller_resource_spec.rb
@@ -90,18 +107,11 @@ files:
90
107
  - spec/cancan/model_adapters/mongoid_adapter_spec.rb
91
108
  - spec/cancan/rule_spec.rb
92
109
  - spec/matchers.rb
93
- - spec/README.rdoc
94
110
  - spec/spec.opts
95
111
  - spec/spec_helper.rb
96
- - CHANGELOG.rdoc
97
- - CONTRIBUTING.md
98
- - Gemfile
99
- - LICENSE
100
- - Rakefile
101
- - README.rdoc
102
- - init.rb
103
- homepage: http://github.com/bryanrite/cancancan
104
- licenses: []
112
+ homepage: https://github.com/CanCanCommunity/cancancan
113
+ licenses:
114
+ - MIT
105
115
  metadata: {}
106
116
  post_install_message:
107
117
  rdoc_options: []
@@ -109,18 +119,37 @@ require_paths:
109
119
  - lib
110
120
  required_ruby_version: !ruby/object:Gem::Requirement
111
121
  requirements:
112
- - - ! '>='
122
+ - - ">="
113
123
  - !ruby/object:Gem::Version
114
- version: '0'
124
+ version: 1.8.7
115
125
  required_rubygems_version: !ruby/object:Gem::Requirement
116
126
  requirements:
117
- - - ! '>='
127
+ - - ">="
118
128
  - !ruby/object:Gem::Version
119
129
  version: 1.3.4
120
130
  requirements: []
121
131
  rubyforge_project: cancancan
122
- rubygems_version: 2.1.11
132
+ rubygems_version: 2.2.1
123
133
  signing_key:
124
134
  specification_version: 4
125
135
  summary: Simple authorization solution for Rails.
126
- test_files: []
136
+ test_files:
137
+ - Appraisals
138
+ - gemfiles/rails_3.0.gemfile
139
+ - gemfiles/rails_3.0_datamapper.gemfile
140
+ - gemfiles/rails_3.0_mongoid.gemfile
141
+ - spec/README.rdoc
142
+ - spec/cancan/ability_spec.rb
143
+ - spec/cancan/controller_additions_spec.rb
144
+ - spec/cancan/controller_resource_spec.rb
145
+ - spec/cancan/exceptions_spec.rb
146
+ - spec/cancan/inherited_resource_spec.rb
147
+ - spec/cancan/matchers_spec.rb
148
+ - spec/cancan/model_adapters/active_record_adapter_spec.rb
149
+ - spec/cancan/model_adapters/data_mapper_adapter_spec.rb
150
+ - spec/cancan/model_adapters/default_adapter_spec.rb
151
+ - spec/cancan/model_adapters/mongoid_adapter_spec.rb
152
+ - spec/cancan/rule_spec.rb
153
+ - spec/matchers.rb
154
+ - spec/spec.opts
155
+ - spec/spec_helper.rb