repository-manager 0.0.7 → 0.0.8
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.
- data/Gemfile.lock +9 -12
- data/README.md +152 -115
- data/app/models/{app_file.rb → repo_file.rb} +3 -3
- data/app/models/repo_folder.rb +60 -0
- data/app/models/{repository.rb → repo_item.rb} +10 -10
- data/app/models/sharing.rb +58 -0
- data/app/models/sharings_member.rb +6 -0
- data/app/uploaders/{repository_uploader.rb → repo_file_uploader.rb} +1 -1
- data/db/migrate/20131018214212_create_repository_manager.rb +9 -17
- data/lib/generators/repository_manager/install_generator.rb +1 -3
- data/lib/generators/repository_manager/templates/initializer.rb +5 -10
- data/lib/repository-manager.rb +4 -4
- data/lib/repository_manager/engine.rb +0 -1
- data/lib/repository_manager/has_repository.rb +140 -129
- data/lib/repository_manager/version.rb +1 -1
- data/repository-manager.gemspec +4 -5
- data/spec/dummy/config/locales/en.yml +1 -8
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20131016193722_create_users.rb +11 -11
- data/spec/dummy/db/migrate/20131016193834_create_groups.rb +10 -10
- data/spec/dummy/db/migrate/20131016194207_create_groups_users.rb +5 -5
- data/spec/dummy/db/migrate/20131018214212_create_repository_manager.rb +9 -17
- data/spec/dummy/db/schema.rb +16 -16
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/{app_file.rb → repo_file.rb} +1 -1
- data/spec/factories/{folder.rb → repo_folder.rb} +1 -1
- data/spec/has_repository_spec.rb +107 -107
- data/spec/models/associations_spec.rb +45 -45
- data/spec/models/repository_spec.rb +51 -27
- data/spec/models/share_spec.rb +39 -39
- metadata +15 -37
- data/app/models/folder.rb +0 -54
- data/app/models/share.rb +0 -58
- data/app/models/shares_item.rb +0 -10
- data/db/migrate/20131025085844_add_file_to_repositories.rb +0 -8
- data/db/migrate/20131025085845_add_file_to_files.rb +0 -5
- data/spec/dummy/db/migrate/20131025085844_add_file_to_repositories.rb +0 -8
- data/spec/dummy/db/migrate/20131025085845_add_file_to_files.rb +0 -5
@@ -1,19 +1,10 @@
|
|
1
1
|
class CreateRepositoryManager < ActiveRecord::Migration
|
2
2
|
|
3
3
|
def change
|
4
|
-
#create_table :permissions do |t|
|
5
|
-
# t.boolean :can_create, :default => false
|
6
|
-
# t.boolean :can_read, :default => false
|
7
|
-
# t.boolean :can_update, :default => false
|
8
|
-
# t.boolean :can_delete, :default => false
|
9
|
-
# t.boolean :can_share, :default => false
|
10
|
-
#end
|
11
4
|
|
12
|
-
create_table :
|
13
|
-
#t.integer :permission_id
|
14
|
-
#t.integer :user_id
|
5
|
+
create_table :sharings do |t|
|
15
6
|
t.references :owner, polymorphic: true
|
16
|
-
t.
|
7
|
+
t.references :repo_item
|
17
8
|
t.boolean :can_create, :default => false
|
18
9
|
t.boolean :can_read, :default => false
|
19
10
|
t.boolean :can_update, :default => false
|
@@ -21,19 +12,20 @@ class CreateRepositoryManager < ActiveRecord::Migration
|
|
21
12
|
t.boolean :can_share, :default => false
|
22
13
|
end
|
23
14
|
|
24
|
-
create_table :
|
25
|
-
t.
|
26
|
-
|
27
|
-
#t.integer :item_id
|
28
|
-
t.references :item, polymorphic: true
|
15
|
+
create_table :sharings_members do |t|
|
16
|
+
t.references :sharing
|
17
|
+
t.references :member, polymorphic: true
|
29
18
|
t.boolean :can_add, :default => false
|
30
19
|
t.boolean :can_remove, :default => false
|
31
20
|
end
|
32
21
|
|
33
|
-
create_table :
|
22
|
+
create_table :repo_items do |t|
|
34
23
|
t.references :owner, polymorphic: true
|
35
24
|
t.string :ancestry
|
36
25
|
t.string :name
|
26
|
+
t.float :file_size
|
27
|
+
t.string :content_type
|
28
|
+
t.string :file
|
37
29
|
t.string :type
|
38
30
|
end
|
39
31
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20131018214212) do
|
15
15
|
|
16
16
|
create_table "groups", force: true do |t|
|
17
17
|
t.string "name"
|
@@ -25,34 +25,34 @@ ActiveRecord::Schema.define(version: 20131025085845) do
|
|
25
25
|
t.integer "user_id", null: false
|
26
26
|
end
|
27
27
|
|
28
|
-
create_table "
|
28
|
+
create_table "repo_items", force: true do |t|
|
29
29
|
t.integer "owner_id"
|
30
30
|
t.string "owner_type"
|
31
31
|
t.string "ancestry"
|
32
32
|
t.string "name"
|
33
|
-
t.string "type"
|
34
33
|
t.float "file_size"
|
35
34
|
t.string "content_type"
|
36
35
|
t.string "file"
|
36
|
+
t.string "type"
|
37
37
|
end
|
38
38
|
|
39
|
-
create_table "
|
39
|
+
create_table "sharings", force: true do |t|
|
40
40
|
t.integer "owner_id"
|
41
41
|
t.string "owner_type"
|
42
|
-
t.integer "
|
43
|
-
t.boolean "can_create",
|
44
|
-
t.boolean "can_read",
|
45
|
-
t.boolean "can_update",
|
46
|
-
t.boolean "can_delete",
|
47
|
-
t.boolean "can_share",
|
42
|
+
t.integer "repo_item_id"
|
43
|
+
t.boolean "can_create", default: false
|
44
|
+
t.boolean "can_read", default: false
|
45
|
+
t.boolean "can_update", default: false
|
46
|
+
t.boolean "can_delete", default: false
|
47
|
+
t.boolean "can_share", default: false
|
48
48
|
end
|
49
49
|
|
50
|
-
create_table "
|
51
|
-
t.integer "
|
52
|
-
t.integer "
|
53
|
-
t.string "
|
54
|
-
t.boolean "can_add",
|
55
|
-
t.boolean "can_remove",
|
50
|
+
create_table "sharings_members", force: true do |t|
|
51
|
+
t.integer "sharing_id"
|
52
|
+
t.integer "member_id"
|
53
|
+
t.string "member_type"
|
54
|
+
t.boolean "can_add", default: false
|
55
|
+
t.boolean "can_remove", default: false
|
56
56
|
end
|
57
57
|
|
58
58
|
create_table "users", force: true do |t|
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/spec/has_repository_spec.rb
CHANGED
@@ -13,222 +13,222 @@ describe 'HasRepository' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should be associate with shares" do
|
16
|
-
|
17
|
-
@user1.
|
18
|
-
expect(@user1.
|
16
|
+
sharing = Sharing.create
|
17
|
+
@user1.sharings << sharing
|
18
|
+
expect(@user1.sharings.last).to eq(sharing)
|
19
19
|
end
|
20
20
|
|
21
|
-
it "can add a file to
|
21
|
+
it "can add a file to repo_item" do
|
22
22
|
#TODO
|
23
23
|
end
|
24
24
|
|
25
|
-
it "can add a folder to
|
25
|
+
it "can add a folder to repo_item" do
|
26
26
|
#TODO
|
27
27
|
end
|
28
28
|
|
29
|
-
it 'can share his own
|
30
|
-
rep = FactoryGirl.create(:
|
29
|
+
it 'can share his own repo_item with other users' do
|
30
|
+
rep = FactoryGirl.create(:repo_file)
|
31
31
|
rep.owner = @user1
|
32
32
|
rep.save
|
33
33
|
|
34
|
-
#expect(@user1.
|
35
|
-
#expect(@user2.
|
36
|
-
#expect(@user3.
|
37
|
-
#expect(@user1.
|
38
|
-
#expect(@user2.
|
39
|
-
#expect(@user3.
|
34
|
+
#expect(@user1.sharings.count).to eq(0)
|
35
|
+
#expect(@user2.sharings.count).to eq(0)
|
36
|
+
#expect(@user3.sharings.count).to eq(0)
|
37
|
+
#expect(@user1.sharings_owners.count).to eq(0)
|
38
|
+
#expect(@user2.sharings_owners.count).to eq(0)
|
39
|
+
#expect(@user3.sharings_owners.count).to eq(0)
|
40
40
|
|
41
|
-
#Add the 2 users to
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
#Add the 2 users to members
|
42
|
+
members = []
|
43
|
+
members << @user2
|
44
|
+
members << @user3
|
45
45
|
|
46
|
-
@user1.share(rep,
|
46
|
+
@user1.share(rep, members)
|
47
47
|
|
48
|
-
#expect(@user1.
|
49
|
-
expect(@user2.
|
50
|
-
expect(@user3.
|
51
|
-
expect(@user1.
|
52
|
-
expect(@user2.
|
53
|
-
#expect(@user2.
|
48
|
+
#expect(@user1.sharings.count).to eq(0)
|
49
|
+
expect(@user2.sharings.count).to eq(1)
|
50
|
+
expect(@user3.sharings.count).to eq(1)
|
51
|
+
expect(@user1.sharings_owners.count).to eq(1)
|
52
|
+
expect(@user2.repo_items.count).to eq(0)
|
53
|
+
#expect(@user2.sharingd_repo_items.count).to eq(1)
|
54
54
|
|
55
|
-
#expect(@user2.
|
56
|
-
#expect(@user3.
|
55
|
+
#expect(@user2.sharings_owners.count).to eq(0)
|
56
|
+
#expect(@user3.sharings_owners.count).to eq(0)
|
57
57
|
|
58
58
|
end
|
59
59
|
|
60
|
-
it 'can not share a
|
61
|
-
rep = FactoryGirl.create(:
|
60
|
+
it 'can not share a repo_item without sharings and without the permission' do
|
61
|
+
rep = FactoryGirl.create(:repo_file)
|
62
62
|
rep.owner = @user3
|
63
63
|
rep.save
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
members = []
|
66
|
+
members << @user2
|
67
67
|
|
68
|
-
@user1.share(rep,
|
68
|
+
@user1.share(rep, members)
|
69
69
|
|
70
|
-
expect(@user2.
|
71
|
-
expect(@user1.
|
70
|
+
expect(@user2.sharings.count).to eq(0)
|
71
|
+
expect(@user1.sharings_owners.count).to eq(0)
|
72
72
|
end
|
73
73
|
|
74
|
-
it 'can not share a
|
75
|
-
rep = FactoryGirl.create(:
|
74
|
+
it 'can not share a repo_item with sharing but without the permission' do
|
75
|
+
rep = FactoryGirl.create(:repo_folder)
|
76
76
|
rep.owner = @user3
|
77
77
|
rep.save
|
78
78
|
|
79
|
-
|
80
|
-
|
79
|
+
members = []
|
80
|
+
members << @user2
|
81
81
|
|
82
82
|
# here user3 can share because he is the owner
|
83
|
-
@user3.share(rep,
|
83
|
+
@user3.share(rep, members)
|
84
84
|
# here user2 should can share because he has the authorisation
|
85
|
-
|
86
|
-
|
87
|
-
@user2.share(rep,
|
85
|
+
members = []
|
86
|
+
members << @user1
|
87
|
+
@user2.share(rep, members)
|
88
88
|
|
89
|
-
expect(@user1.
|
90
|
-
expect(@user2.
|
89
|
+
expect(@user1.sharings.count).to eq(0)
|
90
|
+
expect(@user2.sharings_owners.count).to eq(0)
|
91
91
|
end
|
92
92
|
|
93
|
-
it 'can share a
|
94
|
-
rep = FactoryGirl.create(:
|
93
|
+
it 'can share a repo_item with sharing and with the permission' do
|
94
|
+
rep = FactoryGirl.create(:repo_folder)
|
95
95
|
rep.owner = @user3
|
96
96
|
rep.save
|
97
97
|
|
98
|
-
|
99
|
-
|
98
|
+
members = []
|
99
|
+
members << @user2
|
100
100
|
|
101
101
|
#Here user3 let user2 share this repo too
|
102
|
-
options = {
|
102
|
+
options = {repo_item_permissions: {can_share: true}}
|
103
103
|
|
104
104
|
# here user3 can share because he is the owner
|
105
|
-
@user3.share(rep,
|
105
|
+
@user3.share(rep, members, options)
|
106
106
|
# here user2 should can share because he has the authorisation
|
107
|
-
|
108
|
-
|
109
|
-
@user2.share(rep,
|
107
|
+
members = []
|
108
|
+
members << @user1
|
109
|
+
@user2.share(rep, members)
|
110
110
|
|
111
|
-
expect(@user1.
|
112
|
-
expect(@user2.
|
111
|
+
expect(@user1.sharings.count).to eq(1)
|
112
|
+
expect(@user2.sharings_owners.count).to eq(1)
|
113
113
|
end
|
114
114
|
|
115
|
-
it 'default
|
116
|
-
rep = FactoryGirl.create(:
|
115
|
+
it 'default sharings permissions are to false' do
|
116
|
+
rep = FactoryGirl.create(:repo_folder)
|
117
117
|
rep.owner = @user3
|
118
118
|
rep.save
|
119
119
|
|
120
|
-
|
121
|
-
|
120
|
+
members = []
|
121
|
+
members << @user2
|
122
122
|
|
123
123
|
#Here user3 let user2 share this repo too
|
124
|
-
options = {
|
124
|
+
options = {repo_item_permissions: {can_read: true, can_share: true}}
|
125
125
|
|
126
126
|
# here user3 can share because he is the owner
|
127
|
-
@user3.share(rep,
|
127
|
+
@user3.share(rep, members, options)
|
128
128
|
# here user2 should can share because he has the authorisation
|
129
129
|
# But he has only the authorisation of read (can_read = true), He can't share with more permissions
|
130
|
-
|
131
|
-
|
130
|
+
members = []
|
131
|
+
members << @user1
|
132
132
|
#Here the permissions should be : :can_read => true, and all others false
|
133
|
-
@user2.share(rep,
|
133
|
+
@user2.share(rep, members)
|
134
134
|
|
135
|
-
|
135
|
+
sharing_of_user_1 = @user1.sharings.last
|
136
136
|
|
137
|
-
expect(
|
138
|
-
expect(
|
139
|
-
expect(
|
140
|
-
#expect(@user1.
|
141
|
-
#expect(@user2.
|
137
|
+
expect(sharing_of_user_1.can_read?).to eq(false)
|
138
|
+
expect(sharing_of_user_1.can_update?).to eq(false)
|
139
|
+
expect(sharing_of_user_1.can_share?).to eq(false)
|
140
|
+
#expect(@user1.sharings.count).to eq(1)
|
141
|
+
#expect(@user2.sharings_owners.count).to eq(1)
|
142
142
|
end
|
143
143
|
|
144
|
-
it 'can share a
|
145
|
-
rep = FactoryGirl.create(:
|
144
|
+
it 'can share a repo_item with sharing and with restricted permissions' do
|
145
|
+
rep = FactoryGirl.create(:repo_folder)
|
146
146
|
rep.owner = @user3
|
147
147
|
rep.save
|
148
148
|
|
149
|
-
|
150
|
-
|
149
|
+
members = []
|
150
|
+
members << @user2
|
151
151
|
|
152
152
|
#Here user3 let user2 share this repo too
|
153
|
-
options = {
|
153
|
+
options = {repo_item_permissions: {can_read: true, can_share: true}}
|
154
154
|
|
155
155
|
# here user3 can share because he is the owner
|
156
|
-
@user3.share(rep,
|
156
|
+
@user3.share(rep, members, options)
|
157
157
|
# here user2 should can share because he has the authorisation
|
158
158
|
# But he has only the authorisation of read (can_read = true), He can't share with more permissions
|
159
|
-
|
160
|
-
|
159
|
+
members = []
|
160
|
+
members << @user1
|
161
161
|
|
162
|
-
options = {
|
162
|
+
options = {repo_item_permissions: {can_read: true, can_update: true, can_share: true}}
|
163
163
|
|
164
164
|
#Here the permissions should be : :can_read => true, :can_share => true and all others false
|
165
|
-
@user2.share(rep,
|
165
|
+
@user2.share(rep, members, options)
|
166
166
|
|
167
|
-
|
167
|
+
sharing_of_user_1 = @user1.sharings.last
|
168
168
|
|
169
|
-
expect(
|
170
|
-
expect(
|
171
|
-
expect(
|
172
|
-
#expect(@user1.
|
173
|
-
#expect(@user2.
|
169
|
+
expect(sharing_of_user_1.can_read?).to eq(true)
|
170
|
+
expect(sharing_of_user_1.can_update?).to eq(false)
|
171
|
+
expect(sharing_of_user_1.can_share?).to eq(true)
|
172
|
+
#expect(@user1.sharings.count).to eq(1)
|
173
|
+
#expect(@user2.sharings_owners.count).to eq(1)
|
174
174
|
end
|
175
175
|
|
176
|
-
it 'can share a
|
177
|
-
rep = FactoryGirl.create(:
|
176
|
+
it 'can share a repo_item with sharing permissions' do
|
177
|
+
rep = FactoryGirl.create(:repo_folder)
|
178
178
|
rep.owner = @user3
|
179
179
|
rep.save
|
180
180
|
|
181
|
-
|
182
|
-
|
181
|
+
members = []
|
182
|
+
members << @user2
|
183
183
|
|
184
|
-
options = {
|
184
|
+
options = {sharing_permissions: {can_add: true, can_remove: false}}
|
185
185
|
|
186
186
|
# here user3 can share because he is the owner
|
187
|
-
@user3.share(rep,
|
187
|
+
@user3.share(rep, members, options)
|
188
188
|
|
189
|
-
|
189
|
+
sharing_member_of_user_2 = @user2.sharings_members.last
|
190
190
|
|
191
|
-
expect(
|
192
|
-
expect(
|
193
|
-
#expect(@user1.
|
194
|
-
#expect(@user2.
|
191
|
+
expect(sharing_member_of_user_2.can_add?).to eq(true)
|
192
|
+
expect(sharing_member_of_user_2.can_remove?).to eq(false)
|
193
|
+
#expect(@user1.sharings.count).to eq(1)
|
194
|
+
#expect(@user2.sharings_owners.count).to eq(1)
|
195
195
|
end
|
196
196
|
|
197
|
-
it 'can share a
|
198
|
-
parent = FactoryGirl.create(:
|
197
|
+
it 'can share a repo_item with ancestor sharing permissions' do
|
198
|
+
parent = FactoryGirl.create(:repo_folder)
|
199
199
|
parent.owner = @user3
|
200
200
|
middle = @user3.create_folder('Middle', parent)
|
201
201
|
children = @user3.create_folder('Children', middle)
|
202
202
|
|
203
|
-
file = FactoryGirl.build(:
|
203
|
+
file = FactoryGirl.build(:repo_file)
|
204
204
|
file.owner = @user3
|
205
205
|
file.save
|
206
206
|
|
207
|
-
children.
|
207
|
+
children.add(file)
|
208
208
|
|
209
|
-
options = {
|
209
|
+
options = {repo_item_permissions: {can_read: true, can_update: true, can_share: false}}
|
210
210
|
@user3.share(parent, @user1, options)
|
211
211
|
|
212
|
-
options = {
|
212
|
+
options = {repo_item_permissions: {can_read: true, can_update: true, can_share: true}}
|
213
213
|
@user3.share(children, @user1, options)
|
214
214
|
|
215
215
|
@user1.share(middle, @user2)
|
216
|
-
expect(@user2.
|
216
|
+
expect(@user2.sharings.count).to eq(0)
|
217
217
|
@user1.share(file, @user2)
|
218
|
-
expect(@user2.
|
218
|
+
expect(@user2.sharings.count).to eq(1)
|
219
219
|
end
|
220
220
|
|
221
221
|
it "can create a folder" do
|
222
222
|
folder = @user1.create_folder('test folder')
|
223
|
-
#folder = @user1.
|
223
|
+
#folder = @user1.repo_items.last
|
224
224
|
expect(folder.name).to eq('test folder')
|
225
|
-
expect(folder.type).to eq('
|
225
|
+
expect(folder.type).to eq('RepoFolder')
|
226
226
|
end
|
227
227
|
|
228
228
|
it "can create a file" do
|
229
229
|
file = @user1.create_file(File.open("#{Rails.root}/../fixture/textfile.txt"))
|
230
230
|
expect(file.name).to eq('textfile.txt')
|
231
|
-
expect(@user1.
|
231
|
+
expect(@user1.repo_items.count).to eq(1)
|
232
232
|
end
|
233
233
|
|
234
234
|
end
|
@@ -4,47 +4,47 @@ describe "Associations" do
|
|
4
4
|
|
5
5
|
it "test if user can have a own file" do
|
6
6
|
user = FactoryGirl.build(:user)
|
7
|
-
file =
|
7
|
+
file = RepoItem.new
|
8
8
|
file.owner = user
|
9
9
|
expect(file.owner).to eq(user)
|
10
10
|
end
|
11
11
|
|
12
|
-
it "test if user can have a own
|
12
|
+
it "test if user can have a own sharing" do
|
13
13
|
user = User.new
|
14
|
-
|
15
|
-
|
16
|
-
expect(
|
14
|
+
sharing = Sharing.new
|
15
|
+
sharing.owner = user
|
16
|
+
expect(sharing.owner).to eq(user)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should be possible for a user to share a file" do
|
20
20
|
|
21
21
|
user = FactoryGirl.create(:user)
|
22
22
|
user2 = FactoryGirl.create(:user)
|
23
|
-
expect(user2.
|
24
|
-
expect(user.
|
23
|
+
expect(user2.sharings.count).to eq(0)
|
24
|
+
expect(user.repo_items.count).to eq(0)
|
25
25
|
|
26
|
-
file =
|
26
|
+
file = RepoItem.new
|
27
27
|
file.owner = user
|
28
28
|
|
29
|
-
#pp user.
|
29
|
+
#pp user.repo_items
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
file.
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
sharing = Sharing.new(can_read:true, can_create:true)
|
32
|
+
sharing.owner = user
|
33
|
+
file.sharings << sharing
|
34
|
+
sharings_member = SharingsMember.new
|
35
|
+
sharings_member.member=user2
|
36
|
+
sharing.sharings_members << sharings_member
|
37
37
|
|
38
|
-
#expect(user2.
|
39
|
-
#expect(file.
|
38
|
+
#expect(user2.sharings.count).to eq(0)
|
39
|
+
#expect(file.sharings.count).to eq(0)
|
40
40
|
|
41
|
-
#
|
42
|
-
#
|
41
|
+
#SharingsMember.save
|
42
|
+
#sharing.save
|
43
43
|
file.save
|
44
44
|
|
45
|
-
expect(user.
|
46
|
-
expect(user2.
|
47
|
-
expect(file.
|
45
|
+
expect(user.repo_items.count).to eq(1)
|
46
|
+
expect(user2.sharings.count).to eq(1)
|
47
|
+
expect(file.sharings.count).to eq(1)
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should be possible for a group to share a file" do
|
@@ -53,37 +53,37 @@ describe "Associations" do
|
|
53
53
|
user2 = FactoryGirl.create(:user)
|
54
54
|
group = FactoryGirl.create(:group)
|
55
55
|
group2 = FactoryGirl.create(:group)
|
56
|
-
expect(group.
|
57
|
-
expect(group.
|
56
|
+
expect(group.sharings.count).to eq(0)
|
57
|
+
expect(group.repo_items.count).to eq(0)
|
58
58
|
|
59
|
-
file =
|
59
|
+
file = RepoItem.new
|
60
60
|
file.owner = user
|
61
61
|
|
62
|
-
#pp user.
|
62
|
+
#pp user.repo_items
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
file.
|
67
|
-
|
68
|
-
|
69
|
-
|
64
|
+
sharing = Sharing.new(can_read:true, can_create:true)
|
65
|
+
sharing.owner = group
|
66
|
+
file.sharings << sharing
|
67
|
+
sm = SharingsMember.new
|
68
|
+
sm.member=group2
|
69
|
+
sharing.sharings_members << sm
|
70
70
|
|
71
|
-
#expect(user2.
|
72
|
-
#expect(file.
|
71
|
+
#expect(user2.sharings.count).to eq(0)
|
72
|
+
#expect(file.sharings.count).to eq(0)
|
73
73
|
|
74
|
-
#
|
75
|
-
#
|
74
|
+
#SharingsMember.save
|
75
|
+
#sharing.save
|
76
76
|
file.save
|
77
77
|
|
78
|
-
expect(user.
|
79
|
-
expect(user2.
|
80
|
-
expect(user.
|
81
|
-
expect(group.
|
82
|
-
expect(group.
|
83
|
-
#Il est auteur d'un
|
84
|
-
expect(group.
|
85
|
-
expect(group2.
|
86
|
-
expect(file.
|
78
|
+
expect(user.repo_items.count).to eq(1)
|
79
|
+
expect(user2.sharings.count).to eq(0)
|
80
|
+
expect(user.sharings.count).to eq(0)
|
81
|
+
expect(group.repo_items.count).to eq(0)
|
82
|
+
expect(group.sharings.count).to eq(0)
|
83
|
+
#Il est auteur d'un sharing
|
84
|
+
expect(group.sharings_owners.count).to eq(1)
|
85
|
+
expect(group2.sharings.count).to eq(1)
|
86
|
+
expect(file.sharings.count).to eq(1)
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|