private_person 0.2.4 → 0.2.9

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjkzZWFiNmMyYzRmZTZlNDEzMjQ3ODk4MGE2YjIxZGU3N2U5NDQ3Nw==
5
- data.tar.gz: !binary |-
6
- ZTRhZTJjYzBjOTdjMDkyNWU5N2Y0ZTdhNzRjYTAyZGRiODFiZTMzNQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZTU5MzkyM2JkMTUzNTVhYmNkNjFlYzUwYTE2MGYwNTg3NjIxZTMxNTQ2MmJj
10
- ZjM0ZmQ0NTYwYzNjMmYyMDk5NGVjMDBmN2RmZDkyMjY1ZGE0MTMwYzdkNDlk
11
- NmU3NDYzMTI5MTBjOWVkMjNhNzUxZjA1ZmJmODRkY2I4MjBmMzk=
12
- data.tar.gz: !binary |-
13
- YTVkZGYyZjVjOWZkYWYxMGUwY2RkMzEzNDk1NzA4NTMyODhkNGU3MmY5M2Zh
14
- ZDVhNTRiNjkxZmQ1MmYyMGQ1Y2VhZTcwZDg0NTg4MTEwYzQzOTkxOGNlOGYy
15
- MmZlZWUzZTgxMzM0ZDQxYzA5MzQxNjkyZjk5NzI2YTFmODdkMzE=
2
+ SHA1:
3
+ metadata.gz: 270c8b3bc69026dbc7e3d8b889d032d4ecde66c2
4
+ data.tar.gz: ea2baa6b580f97359fcbd04f79b11926c0d9474d
5
+ SHA512:
6
+ metadata.gz: f2d93fa86a47477ab27f75af20ccfa3dea97546a11472ae1d694449fdb72d2a9d3d58c662bbe0861ac9936e3c1c4a8984dfd0a3b4752356ad0d4bac404143510
7
+ data.tar.gz: 0ef6809ea5be6453c9a5b46c897ba6886c10b6ae2293b462a36591ae0d159dc2dda61e07d62d28396fdc3dad2f9f83fbb4e2a202ef63e80c7d42c12e554c4d2a
data/Gemfile CHANGED
@@ -19,3 +19,4 @@ group :development, :test do
19
19
  end
20
20
 
21
21
  gem 'rails'
22
+ gem 'protected_attributes'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.9
@@ -12,7 +12,7 @@ module PrivatePerson
12
12
  has_one :permissor, :through => :permissions, :as => :permissor
13
13
 
14
14
  def is_public?
15
- !permissions.find_all_by_relationship_type(nil).empty?
15
+ !permissions.by_relationship_type(nil).empty?
16
16
  end
17
17
  end
18
18
  end
@@ -5,19 +5,19 @@ class Permission < ActiveRecord::Base
5
5
  attr_accessible :permissible, :permissible_type, :permissible_id, :relationship_type
6
6
  validates_presence_of :permissor, :permissible_type, :relationship_type
7
7
 
8
- def self.find_all_by_permissor(permissor)
8
+ def self.by_permissor(permissor)
9
9
  where("permissor_type = ? AND permissor_id = ?", permissor.class.name, permissor.id)
10
10
  end
11
11
 
12
- def self.find_all_by_permissible(permissible)
12
+ def self.by_permissible(permissible)
13
13
  where("permissible_type = ? AND permissible_id = ?", permissible.class.name, permissible.id)
14
14
  end
15
15
 
16
- def self.find_all_by_wildcard(permissible_type)
16
+ def self.by_wildcard(permissible_type)
17
17
  where(:permissible_type => permissible_type, :permissible_id => nil)
18
18
  end
19
19
 
20
- def self.find_all_by_relationship_type(relationship_type)
20
+ def self.by_relationship_type(relationship_type)
21
21
  if relationship_type == 'public' or relationship_type.nil?
22
22
  return where("relationship_type = 'public'")
23
23
  end
@@ -13,7 +13,7 @@ module PrivatePerson
13
13
  has_many :permissibles, :through => :permissions, :as => :permissor
14
14
 
15
15
  def permit!(whom, what)
16
- existing = self.permissions_as_permissor.find_all_by_relationship_type(whom).find_all_by_permissible(what)
16
+ existing = self.permissions_as_permissor.by_relationship_type(whom).by_permissible(what)
17
17
 
18
18
  if existing.empty?
19
19
  self.permissions_as_permissor.create!({:relationship_type => whom, :permissible => what})
@@ -22,7 +22,7 @@ module PrivatePerson
22
22
  end
23
23
 
24
24
  def wildcard_permit!(whom, what)
25
- existing = self.permissions_as_permissor.find_all_by_relationship_type(whom).find_all_by_permissible_type(what)
25
+ existing = self.permissions_as_permissor.by_relationship_type(whom).where(:permissible_type, what)
26
26
 
27
27
  if existing.empty?
28
28
  self.permissions_as_permissor.create!({:relationship_type => whom, :permissible_type => what})
@@ -6,22 +6,22 @@ module PrivatePerson
6
6
  if permissible.nil?
7
7
  raise 'Called is_permitted? on nil. Does not compute. Preparing to self destruct.'
8
8
  end
9
- if Permission.find_all_by_permissible(permissible).blocked.exists?
9
+ unless Permission.by_permissible(permissible).blocked.empty?
10
10
  return false
11
11
  end
12
- wildcards = permissions_by(permissor).find_all_by_wildcard(permissible.class.name).legitimate
13
- if wildcards.exists?
12
+ wildcards = permissions_by(permissor).by_wildcard(permissible.class.name).legitimate
13
+ if wildcards.present?
14
14
  return true
15
15
  end
16
- permissions = permissions_by(permissor).find_all_by_permissible(permissible).legitimate
17
- if permissions.exists?
16
+ permissions = permissions_by(permissor).by_permissible(permissible).legitimate
17
+ if permissions.present?
18
18
  return true
19
19
  end
20
20
  return false
21
21
  end
22
22
 
23
23
  def permissions_by(permissor)
24
- Permission.find_all_by_permissor(permissor).find_all_by_relationship_type(relationship_to(permissor))
24
+ Permission.by_permissor(permissor).by_relationship_type(relationship_to(permissor))
25
25
  end
26
26
 
27
27
  def relationship_to(permissor)
@@ -39,7 +39,7 @@ module PrivatePerson
39
39
  # Then check for a slow method
40
40
  for relationship_method in permissor.class.of
41
41
  relationship_members = permissor.send(relationship_method.to_sym)
42
- if relationship_members.exists?(:id => self.id)
42
+ if relationship_members.present? and relationship_members.find(:id => self.id).exists?
43
43
  return relationship_method.to_s
44
44
  end
45
45
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "private_person"
8
- s.version = "0.2.4"
8
+ s.version = "0.2.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Karen Lundgren"]
12
- s.date = "2013-09-13"
12
+ s.date = "2013-09-29"
13
13
  s.description = "Private person is an active record extension gem that allows a model to be given privacy settings over arbitrary models and polymorphic relations, putting users' accounts in control of their own privacy policies."
14
14
  s.email = "webmaster@sourcherryweb.com"
15
15
  s.extra_rdoc_files = [
@@ -46,7 +46,6 @@ Gem::Specification.new do |s|
46
46
  "spec/dummy/config/database.yml",
47
47
  "spec/dummy/config/environment.rb",
48
48
  "spec/dummy/config/environments/development.rb",
49
- "spec/dummy/config/environments/production.rb",
50
49
  "spec/dummy/config/environments/test.rb",
51
50
  "spec/dummy/config/initializers/backtrace_silencers.rb",
52
51
  "spec/dummy/config/initializers/inflections.rb",
@@ -80,7 +79,7 @@ Gem::Specification.new do |s|
80
79
  s.homepage = "http://github.com/nerakdon/private_person"
81
80
  s.licenses = ["MIT"]
82
81
  s.require_paths = ["lib"]
83
- s.rubygems_version = "2.0.7"
82
+ s.rubygems_version = "2.0.3"
84
83
  s.summary = "Private person puts your users in control of their own privacy policies."
85
84
 
86
85
  if s.respond_to? :specification_version then
@@ -88,6 +87,7 @@ Gem::Specification.new do |s|
88
87
 
89
88
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
90
89
  s.add_runtime_dependency(%q<rails>, [">= 0"])
90
+ s.add_runtime_dependency(%q<protected_attributes>, [">= 0"])
91
91
  s.add_development_dependency(%q<rdoc>, [">= 0"])
92
92
  s.add_development_dependency(%q<bundler>, [">= 0"])
93
93
  s.add_development_dependency(%q<jeweler>, [">= 0"])
@@ -100,6 +100,7 @@ Gem::Specification.new do |s|
100
100
  s.add_development_dependency(%q<acts_as_follower>, [">= 0"])
101
101
  else
102
102
  s.add_dependency(%q<rails>, [">= 0"])
103
+ s.add_dependency(%q<protected_attributes>, [">= 0"])
103
104
  s.add_dependency(%q<rdoc>, [">= 0"])
104
105
  s.add_dependency(%q<bundler>, [">= 0"])
105
106
  s.add_dependency(%q<jeweler>, [">= 0"])
@@ -113,6 +114,7 @@ Gem::Specification.new do |s|
113
114
  end
114
115
  else
115
116
  s.add_dependency(%q<rails>, [">= 0"])
117
+ s.add_dependency(%q<protected_attributes>, [">= 0"])
116
118
  s.add_dependency(%q<rdoc>, [">= 0"])
117
119
  s.add_dependency(%q<bundler>, [">= 0"])
118
120
  s.add_dependency(%q<jeweler>, [">= 0"])
data/spec/dummy/.rspec CHANGED
@@ -1 +1 @@
1
- --color
1
+ --color
data/spec/dummy/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
- #!/usr/bin/env rake
2
- # Add your own tasks in files placed in lib/tasks ending in .rake,
3
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
-
5
- require File.expand_path('../config/application', __FILE__)
6
-
7
- Dummy::Application.load_tasks
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -1,5 +1,7 @@
1
1
  class Follow < ActiveRecord::Base
2
2
 
3
+ attr_accessible :followable_type, :followable_id
4
+
3
5
  extend ActsAsFollower::FollowerLib
4
6
  extend ActsAsFollower::FollowScopes
5
7
 
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Dummy::Application
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -1,10 +1,10 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
10
  $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,25 +1,25 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -1,5 +1,5 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -6,8 +6,8 @@ Dummy::Application.configure do
6
6
  # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
@@ -11,8 +11,8 @@ Dummy::Application.configure do
11
11
  config.serve_static_assets = true
12
12
  config.static_cache_control = "public, max-age=3600"
13
13
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
14
+ # Do not eager load code on boot.
15
+ config.eager_load = false
16
16
 
17
17
  # Show full error reports and disable caching
18
18
  config.consider_all_requests_local = true
@@ -1,7 +1,7 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -1,15 +1,15 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
11
- #
12
- # These inflection rules are supported but not enabled by default:
13
- # ActiveSupport::Inflector.inflections do |inflect|
14
- # inflect.acronym 'RESTful'
15
- # end
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -1,5 +1,5 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +1,7 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = '13335d67552fdd1870f1e89aa229a259979c25ad14a60a64b75ce77db7622c9728606f2415d021416725905e8ad5955be6fff9e01702167f1ddc0fb4c5f3cfdf'
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '13335d67552fdd1870f1e89aa229a259979c25ad14a60a64b75ce77db7622c9728606f2415d021416725905e8ad5955be6fff9e01702167f1ddc0fb4c5f3cfdf'
@@ -1,8 +1,8 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rails generate session_migration")
8
- # Dummy::Application.config.session_store :active_record_store
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -1,14 +1,14 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters :format => [:json]
9
- end
10
-
11
- # Disable root element in JSON by default.
12
- ActiveSupport.on_load(:active_record) do
13
- self.include_root_in_json = false
14
- end
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters :format => [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -1,5 +1,5 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
Binary file
@@ -1,6 +1,6 @@
1
- #!/usr/bin/env ruby1.8
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
1
+ #!/usr/bin/env ruby1.8
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -1,7 +1,7 @@
1
- FactoryGirl.define do
2
- factory :page, :aliases => [:permissible] do
3
- sequence(:title) {|n| "page#{n}" }
4
- body 'Lorem Ipsum, baby'
5
- user
6
- end
1
+ FactoryGirl.define do
2
+ factory :page, :aliases => [:permissible] do
3
+ sequence(:title) {|n| "page#{n}" }
4
+ body 'Lorem Ipsum, baby'
5
+ user
6
+ end
7
7
  end
@@ -1,7 +1,7 @@
1
- FactoryGirl.define do
2
- factory :permission do
3
- relationship_type 'none'
4
- permissible
5
- permissor
6
- end
1
+ FactoryGirl.define do
2
+ factory :permission do
3
+ relationship_type 'none'
4
+ permissible
5
+ permissor
6
+ end
7
7
  end
@@ -1,5 +1,5 @@
1
- FactoryGirl.define do
2
- factory :user, :aliases => [:permissor] do
3
- sequence(:nickname) {|n| "person#{n}" }
4
- end
1
+ FactoryGirl.define do
2
+ factory :user, :aliases => [:permissor] do
3
+ sequence(:nickname) {|n| "person#{n}" }
4
+ end
5
5
  end
@@ -19,8 +19,8 @@ describe Permission do
19
19
  describe 'Class Methods' do
20
20
  include_context 'permissions support'
21
21
 
22
- describe '.find_all_by_permissor' do
23
- subject { Permission.find_all_by_permissor(followed_user) }
22
+ describe '.by_permissor' do
23
+ subject { Permission.by_permissor(followed_user) }
24
24
  it { should have_exactly(8).items }
25
25
  it { should include general_permission }
26
26
  it { should include following_users_permission }
@@ -32,18 +32,18 @@ describe Permission do
32
32
  it { should include forbidden_permission }
33
33
  end
34
34
 
35
- describe '.find_all_by_permissible' do
36
- subject { Permission.find_all_by_permissible(following_page) }
35
+ describe '.by_permissible' do
36
+ subject { Permission.by_permissible(following_page) }
37
37
  it { should eq [following_users_permission]}
38
38
  end
39
39
 
40
- describe '.find_all_by_wildcard' do
41
- subject { Permission.find_all_by_wildcard('Page') }
40
+ describe '.by_wildcard' do
41
+ subject { Permission.by_wildcard('Page') }
42
42
  it { should eq [general_permission] }
43
43
  end
44
44
 
45
- describe '.find_all_by_relationship_type' do
46
- subject { Permission.find_all_by_relationship_type('following_users') }
45
+ describe '.by_relationship_type' do
46
+ subject { Permission.by_relationship_type('following_users') }
47
47
  it { should have_exactly(3).items }
48
48
  it { should include general_permission }
49
49
  it { should include following_users_permission }
data/spec/spec_helper.rb CHANGED
@@ -1,36 +1,36 @@
1
- ENV["RAILS_ENV"] ||= 'test'
2
- require File.expand_path("../dummy/config/environment", __FILE__)
3
-
4
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
- $LOAD_PATH.unshift(File.dirname(__FILE__))
6
- require 'rails/all'
7
- require 'sqlite3'
8
- require 'rspec'
9
- require 'rspec/rails'
10
-
11
- require 'factory_girl_rails'
12
- FactoryGirl.definition_file_paths = %w(spec/factories)
13
-
14
- require 'database_cleaner'
15
- require 'shoulda-matchers'
16
- require 'acts_as_follower'
17
- require 'private_person'
18
-
19
- # Requires supporting files with custom matchers and macros, etc,
20
- # in ./support/ and its subdirectories.
21
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
22
-
23
- RSpec.configure do |config|
24
- config.before(:suite) do
25
- DatabaseCleaner.strategy = :transaction
26
- DatabaseCleaner.clean_with(:deletion)
27
- end
28
-
29
- config.before(:each) do
30
- DatabaseCleaner.start
31
- end
32
-
33
- config.after(:each) do
34
- DatabaseCleaner.clean
35
- end
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+ require File.expand_path("../dummy/config/environment", __FILE__)
3
+
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
6
+ require 'rails/all'
7
+ require 'sqlite3'
8
+ require 'rspec'
9
+ require 'rspec/rails'
10
+
11
+ require 'factory_girl_rails'
12
+ FactoryGirl.definition_file_paths = %w(spec/factories)
13
+
14
+ require 'database_cleaner'
15
+ require 'shoulda-matchers'
16
+ require 'acts_as_follower'
17
+ require 'private_person'
18
+
19
+ # Requires supporting files with custom matchers and macros, etc,
20
+ # in ./support/ and its subdirectories.
21
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
22
+
23
+ RSpec.configure do |config|
24
+ config.before(:suite) do
25
+ DatabaseCleaner.strategy = :transaction
26
+ DatabaseCleaner.clean_with(:deletion)
27
+ end
28
+
29
+ config.before(:each) do
30
+ DatabaseCleaner.start
31
+ end
32
+
33
+ config.after(:each) do
34
+ DatabaseCleaner.clean
35
+ end
36
36
  end
@@ -19,6 +19,6 @@ shared_context 'permissions support' do
19
19
  let!(:none_permission) { FactoryGirl.create(:permission, :permissor => followed_user, :permissible => none_page, :relationship_type => 'none') }
20
20
 
21
21
  let!(:permissions) { Permission.all }
22
- let!(:wildcards) { Permission.find_all_by_wildcard('Page') }
22
+ let!(:wildcards) { Permission.by_wildcard('Page') }
23
23
 
24
24
  end
metadata CHANGED
@@ -1,167 +1,181 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: private_person
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Lundgren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-13 00:00:00.000000000 Z
11
+ date: 2013-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: protected_attributes
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rdoc
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ! '>='
45
+ - - '>='
32
46
  - !ruby/object:Gem::Version
33
47
  version: '0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ! '>='
52
+ - - '>='
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ! '>='
59
+ - - '>='
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ! '>='
66
+ - - '>='
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: jeweler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ! '>='
73
+ - - '>='
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ! '>='
80
+ - - '>='
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: sqlite3
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ! '>='
87
+ - - '>='
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ! '>='
94
+ - - '>='
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ! '>='
101
+ - - '>='
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ! '>='
108
+ - - '>='
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rspec-rails
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ! '>='
115
+ - - '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ! '>='
122
+ - - '>='
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: shoulda-matchers
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - ! '>='
129
+ - - '>='
116
130
  - !ruby/object:Gem::Version
117
131
  version: '0'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ! '>='
136
+ - - '>='
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: factory_girl_rails
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ! '>='
143
+ - - '>='
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - ! '>='
150
+ - - '>='
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: database_cleaner
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - ! '>='
157
+ - - '>='
144
158
  - !ruby/object:Gem::Version
145
159
  version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - ! '>='
164
+ - - '>='
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: acts_as_follower
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - ! '>='
171
+ - - '>='
158
172
  - !ruby/object:Gem::Version
159
173
  version: '0'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - ! '>='
178
+ - - '>='
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  description: Private person is an active record extension gem that allows a model
@@ -203,7 +217,6 @@ files:
203
217
  - spec/dummy/config/database.yml
204
218
  - spec/dummy/config/environment.rb
205
219
  - spec/dummy/config/environments/development.rb
206
- - spec/dummy/config/environments/production.rb
207
220
  - spec/dummy/config/environments/test.rb
208
221
  - spec/dummy/config/initializers/backtrace_silencers.rb
209
222
  - spec/dummy/config/initializers/inflections.rb
@@ -243,17 +256,17 @@ require_paths:
243
256
  - lib
244
257
  required_ruby_version: !ruby/object:Gem::Requirement
245
258
  requirements:
246
- - - ! '>='
259
+ - - '>='
247
260
  - !ruby/object:Gem::Version
248
261
  version: '0'
249
262
  required_rubygems_version: !ruby/object:Gem::Requirement
250
263
  requirements:
251
- - - ! '>='
264
+ - - '>='
252
265
  - !ruby/object:Gem::Version
253
266
  version: '0'
254
267
  requirements: []
255
268
  rubyforge_project:
256
- rubygems_version: 2.0.7
269
+ rubygems_version: 2.0.3
257
270
  signing_key:
258
271
  specification_version: 4
259
272
  summary: Private person puts your users in control of their own privacy policies.
@@ -1,58 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
6
-
7
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
-
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
13
-
14
- # Defaults to nil and saved in location specified by config.assets.prefix
15
- # config.assets.manifest = YOUR_PATH
16
-
17
- # Specifies the header that your server uses for sending files
18
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
19
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
20
-
21
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
22
- # config.force_ssl = true
23
-
24
- # See everything in the log (default is :info)
25
- # config.log_level = :debug
26
-
27
- # Prepend all log lines with the following tags
28
- # config.log_tags = [ :subdomain, :uuid ]
29
-
30
- # Use a different logger for distributed setups
31
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
32
-
33
- # Use a different cache store in production
34
- # config.cache_store = :mem_cache_store
35
-
36
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
37
- # config.action_controller.asset_host = "http://assets.example.com"
38
-
39
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
40
- # config.assets.precompile += %w( search.js )
41
-
42
- # Disable delivery errors, bad email addresses will be ignored
43
- # config.action_mailer.raise_delivery_errors = false
44
-
45
- # Enable threaded mode
46
- # config.threadsafe!
47
-
48
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
49
- # the I18n.default_locale when a translation can not be found)
50
- config.i18n.fallbacks = true
51
-
52
- # Send deprecation notices to registered listeners
53
- config.active_support.deprecation = :notify
54
-
55
- # Log the query plan for queries taking more than this (works
56
- # with SQLite, MySQL, and PostgreSQL)
57
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
58
- end