invitational 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/Rakefile +6 -1
- data/lib/invitational/version.rb +1 -1
- data/spec/internal/app/models/ability.rb +28 -0
- data/spec/internal/app/models/child.rb +5 -0
- data/spec/internal/app/models/entity.rb +9 -0
- data/spec/internal/app/models/grandparent.rb +9 -0
- data/spec/internal/app/models/invitation.rb +10 -0
- data/spec/internal/app/models/other_entity.rb +7 -0
- data/spec/internal/app/models/system_thing.rb +5 -0
- data/spec/internal/app/models/user.rb +6 -0
- data/spec/internal/config/database.yml +3 -0
- data/spec/internal/config/routes.rb +3 -0
- data/spec/internal/db/combustion_test.sqlite +0 -0
- data/spec/internal/db/schema.rb +35 -0
- data/spec/internal/log/test.log +5958 -0
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/invitational/models/ability_spec.rb +94 -0
- data/spec/invitational/models/entity_spec.rb +51 -0
- data/spec/invitational/models/invitation_spec.rb +145 -0
- data/spec/invitational/models/user_spec.rb +107 -0
- data/spec/invitational/services/checks_for_invitation_spec.rb +91 -0
- data/spec/invitational/services/claims_all_invitations_spec.rb +29 -0
- data/spec/invitational/services/claims_invitation_spec.rb +49 -0
- data/spec/invitational/services/creates_invitation_spec.rb +55 -0
- data/spec/invitational/services/creates_system_user_invitation_spec.rb +52 -0
- data/spec/invitational/services/creates_uber_admin_invitation_spec.rb +52 -0
- data/spec/invitational/services/service_helper.rb +78 -0
- data/spec/spec_helper.rb +18 -0
- metadata +60 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0889fe8e1a1dc03eb4e916f7dbc5d017ef42ebf
|
4
|
+
data.tar.gz: 14411cf23d8c69ab0a4d66679045268a7c871964
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfaf00ad35f5d9052b2bb20fe2fee2833ce534ec8d97823d2bb8d120e45d8453116159a7be958baf74857d75b666e5806c775f8bef13d55c4b1ec8be67e9cdb2
|
7
|
+
data.tar.gz: cfe17e74133867dcd025ea1d00dc004ce2bda11c0ad09ccc632aee1b15bfd8a3a98f0c948734aaa1198955000f67700b690556119cc8f7bbcc015fa299a85867
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -13,6 +13,7 @@ rescue LoadError
|
|
13
13
|
end
|
14
14
|
|
15
15
|
require "bundler/gem_tasks"
|
16
|
+
require 'rspec/core/rake_task'
|
16
17
|
|
17
18
|
RDoc::Task.new(:rdoc) do |rdoc|
|
18
19
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -34,5 +35,9 @@ Rake::TestTask.new(:test) do |t|
|
|
34
35
|
t.verbose = false
|
35
36
|
end
|
36
37
|
|
38
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
39
|
+
t.pattern = Dir.glob('spec/**/*_spec.rb')
|
40
|
+
t.rspec_opts = '--format documentation'
|
41
|
+
end
|
37
42
|
|
38
|
-
task :default => :
|
43
|
+
task :default => :spec
|
data/lib/invitational/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'invitational/cancan'
|
2
|
+
|
3
|
+
class Ability
|
4
|
+
include CanCan::Ability
|
5
|
+
include Invitational::CanCan::Ability
|
6
|
+
|
7
|
+
attr_reader :role_mappings, :user
|
8
|
+
|
9
|
+
def initialize(user)
|
10
|
+
|
11
|
+
@role_mappings = {}
|
12
|
+
@user = user
|
13
|
+
|
14
|
+
can :manage, Entity, roles: [:admin]
|
15
|
+
can :read, Entity, roles: [:user]
|
16
|
+
|
17
|
+
can :read, Child
|
18
|
+
|
19
|
+
can :manage, Child, roles: [:admin, attribute_roles(:entity, [:admin, :user]) ]
|
20
|
+
can :manage, Child, roles: [attribute_roles([:entity, :grandparent], [:admin]) ]
|
21
|
+
|
22
|
+
can :manage, OtherEntity, roles: [:uberadmin]
|
23
|
+
|
24
|
+
can :manage, SystemThing, roles: [system_roles(:employer)]
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
Binary file
|
@@ -0,0 +1,35 @@
|
|
1
|
+
ActiveRecord::Schema.define do
|
2
|
+
|
3
|
+
create_table :users, force: true do |t|
|
4
|
+
t.string :email
|
5
|
+
t.timestamps
|
6
|
+
end
|
7
|
+
|
8
|
+
create_table :grandparents, force: true do |t|
|
9
|
+
t.string :name
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
create_table :entities, force: true do |t|
|
14
|
+
t.string :name
|
15
|
+
t.integer :grandparent_id
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
|
19
|
+
create_table :children, force: true do |t|
|
20
|
+
t.string :name
|
21
|
+
t.integer :entity_id
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table :other_entities, force: true do |t|
|
26
|
+
t.string :name
|
27
|
+
t.timestamps
|
28
|
+
end
|
29
|
+
|
30
|
+
create_table :system_things, force: true do |t|
|
31
|
+
t.string :name
|
32
|
+
t.timestamps
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|