active_metadata 0.4.2 → 0.5.0
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/app/controllers/active_metadata/attachments_controller.rb +2 -2
- data/app/controllers/active_metadata/notes_controller.rb +1 -1
- data/config/routes.rb +12 -6
- data/db/migrate/02_active_metadata_migrations.rb +2 -0
- data/db/test.sqlite3 +0 -0
- data/lib/active_metadata/persistence/active_record/attachment.rb +35 -13
- data/lib/active_metadata/persistence/active_record/note.rb +36 -12
- data/lib/active_metadata/version.rb +1 -1
- data/spec/active_metadata_spec.rb +2 -280
- data/spec/attachments_spec.rb +182 -0
- data/spec/notes_spec.rb +208 -0
- metadata +25 -32
@@ -24,7 +24,7 @@ module ActiveMetadata
|
|
24
24
|
|
25
25
|
def update
|
26
26
|
@document = eval(params[:model_name]).find params[:model_id]
|
27
|
-
@document.
|
27
|
+
@document.update_attachment(params[:id],params[:file])
|
28
28
|
|
29
29
|
#todo: if errors send back the correct answer
|
30
30
|
respond_to do |format|
|
@@ -34,7 +34,7 @@ module ActiveMetadata
|
|
34
34
|
|
35
35
|
def destroy
|
36
36
|
@document = eval(params[:model_name]).find params[:model_id]
|
37
|
-
@document.
|
37
|
+
@document.delete_attachment(params[:id])
|
38
38
|
|
39
39
|
#todo: if errors send back the correct answer
|
40
40
|
respond_to do |format|
|
@@ -49,7 +49,7 @@ module ActiveMetadata
|
|
49
49
|
|
50
50
|
def destroy
|
51
51
|
@document = eval(params[:model_name]).find params[:model_id]
|
52
|
-
@document.
|
52
|
+
@document.delete_note(params[:id])
|
53
53
|
respond_to do |format|
|
54
54
|
# TODO redirect to index
|
55
55
|
format.js
|
data/config/routes.rb
CHANGED
@@ -6,11 +6,14 @@ Rails.application.routes.draw do
|
|
6
6
|
#note
|
7
7
|
match ':model_name/:model_id/:field_name/notes' => 'notes#index', :via => :get, :as => "notes", :path_prefix => mount_at
|
8
8
|
match ':model_name/:model_id/:field_name/notes' => 'notes#create', :via => :post, :as => "create_note", :path_prefix => mount_at
|
9
|
-
match ':model_name/:model_id/:field_name/
|
10
|
-
match ':model_name/:model_id/:field_name/
|
11
|
-
match ':model_name/:model_id/:field_name/
|
12
|
-
match ':model_name/:model_id/:field_name/
|
13
|
-
|
9
|
+
match ':model_name/:model_id/:field_name/notes/:id' => 'notes#destroy', :via => :delete, :as => "destroy_note", :path_prefix => mount_at
|
10
|
+
match ':model_name/:model_id/:field_name/notes/:id/edit' => 'notes#edit', :via => :get, :as => "edit_note", :path_prefix => mount_at
|
11
|
+
match ':model_name/:model_id/:field_name/notes/:id' => 'notes#update', :via => :put, :as => "update_note", :path_prefix => mount_at
|
12
|
+
match ':model_name/:model_id/:field_name/notes/:id' => 'notes#show', :via => :get, :as => "show_note", :path_prefix => mount_at
|
13
|
+
match ':model_name/:model_id/:field_name/notes/starred' => 'notes#starred', :via => :get, :as => "starred_notes", :path_prefix => mount_at
|
14
|
+
match ':model_name/:model_id/:field_name/notes/:id/star' => 'notes#star', :via => :put, :as => "star_note", :path_prefix => mount_at
|
15
|
+
match ':model_name/:model_id/:field_name/notes/:id/unstar' => 'notes#unstar', :via => :put, :as => "unstar_note", :path_prefix => mount_at
|
16
|
+
|
14
17
|
#history
|
15
18
|
match ':model_name/:model_id/:field_name/histories' => 'histories#index', :via => :get, :as => "histories", :path_prefix => mount_at
|
16
19
|
|
@@ -19,7 +22,10 @@ Rails.application.routes.draw do
|
|
19
22
|
match ':model_name/:model_id/:field_name/attachments' => 'attachments#create', :via => :post, :as => "create_attachment", :path_prefix => mount_at
|
20
23
|
match ':model_name/:model_id/:field_name/attachments/:id' => 'attachments#destroy', :via => :delete, :as => "destroy_attachment", :path_prefix => mount_at
|
21
24
|
match ':model_name/:model_id/:field_name/attachments/:id' => 'attachments#update', :via => :put, :as => "update_attachment", :path_prefix => mount_at
|
22
|
-
|
25
|
+
match ':model_name/:model_id/:field_name/attachments/starred' => 'attachments#starred', :via => :get, :as => "starred_attachments", :path_prefix => mount_at
|
26
|
+
match ':model_name/:model_id/:field_name/attachments/:id/star' => 'attachments#star', :via => :put, :as => "star_attachments", :path_prefix => mount_at
|
27
|
+
match ':model_name/:model_id/:field_name/attachments/:id/unstar' => 'attachments#unstar', :via => :put, :as => "unstar_attachments", :path_prefix => mount_at
|
28
|
+
|
23
29
|
#alerts
|
24
30
|
get ':model_name/:model_id/:field_name/watchers' => 'watchers#index', :as => "watchers", :path_prefix => mount_at
|
25
31
|
post ':model_name/:model_id/:field_name/watchers/:user_id' => 'watchers#create',:as => "set_watcher", :path_prefix => mount_at
|
@@ -8,6 +8,7 @@ class ActiveMetadataMigrations < ActiveRecord::Migration
|
|
8
8
|
t.integer :document_id
|
9
9
|
t.integer :created_by
|
10
10
|
t.integer :updated_by
|
11
|
+
t.boolean :starred
|
11
12
|
t.timestamps
|
12
13
|
end
|
13
14
|
|
@@ -41,6 +42,7 @@ class ActiveMetadataMigrations < ActiveRecord::Migration
|
|
41
42
|
t.string :attach_content_type
|
42
43
|
t.integer :attach_file_size
|
43
44
|
t.datetime :attach_updated_at
|
45
|
+
t.boolean :starred
|
44
46
|
t.timestamps
|
45
47
|
end
|
46
48
|
|
data/db/test.sqlite3
CHANGED
Binary file
|
@@ -6,8 +6,9 @@ module ActiveMetadata::Persistence::ActiveRecord::Attachment
|
|
6
6
|
|
7
7
|
module InstanceMethods
|
8
8
|
|
9
|
-
def save_attachment_for(field, file)
|
10
|
-
attachment = Attachment.create! :document_class => metadata_class, :document_id => metadata_id, :label => field, :attach => file,
|
9
|
+
def save_attachment_for(field, file, starred=false)
|
10
|
+
attachment = Attachment.create! :document_class => metadata_class, :document_id => metadata_id, :label => field, :attach => file,
|
11
|
+
:starred => starred, :created_by => current_user_id
|
11
12
|
reload_attachments_cache_for field
|
12
13
|
self.send(:send_notification, field, "", attachment.attach.original_filename, :attachment_message, current_user_id)
|
13
14
|
end
|
@@ -18,40 +19,61 @@ module ActiveMetadata::Persistence::ActiveRecord::Attachment
|
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
+
def delete_attachment(id)
|
22
23
|
a = Attachment.find(id)
|
23
24
|
filename = a.attach.original_filename
|
24
25
|
a.destroy
|
25
|
-
reload_attachments_cache_for
|
26
|
-
self.send(:send_notification,
|
26
|
+
reload_attachments_cache_for a.label
|
27
|
+
self.send(:send_notification, a.label, filename, "", :attachment_message)
|
27
28
|
end
|
28
29
|
|
29
|
-
def
|
30
|
+
def update_attachment(id, newfile, starred=nil)
|
30
31
|
a = Attachment.find(id)
|
31
32
|
old_filename = a.attach.original_filename
|
32
33
|
a.attach = newfile
|
33
34
|
a.updated_by = current_user_id
|
34
|
-
a.
|
35
|
+
a.starred = starred if !starred.nil?
|
36
|
+
a.save
|
35
37
|
new_filename = a.attach.original_filename
|
36
38
|
|
37
|
-
reload_attachments_cache_for
|
38
|
-
self.send(:send_notification,
|
39
|
+
reload_attachments_cache_for a.label
|
40
|
+
self.send(:send_notification, a.label, old_filename, new_filename, :attachment_message, current_user_id)
|
39
41
|
end
|
40
42
|
|
41
43
|
def has_attachments_for field
|
42
44
|
attachments_for(field).size == 0 ? false : true
|
43
45
|
end
|
44
|
-
|
46
|
+
|
47
|
+
def find_attachment_by_id(id)
|
48
|
+
Attachment.find(id)
|
49
|
+
end
|
50
|
+
|
51
|
+
# not cached
|
52
|
+
def starred_attachments_for(field)
|
53
|
+
fetch_attachments_for field,true
|
54
|
+
end
|
55
|
+
|
56
|
+
def star_attachment(id)
|
57
|
+
n = Attachment.find(id)
|
58
|
+
update_attachment id,n.attach,true
|
59
|
+
end
|
60
|
+
|
61
|
+
def unstar_attachment(id)
|
62
|
+
n = Attachment.find(id)
|
63
|
+
update_attachment id,n.attach,false
|
64
|
+
end
|
65
|
+
|
45
66
|
private
|
46
67
|
|
47
68
|
def reload_attachments_cache_for field
|
48
69
|
Rails.cache.write(attachments_cache_key(field),fetch_attachments_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes )
|
49
70
|
end
|
50
71
|
|
51
|
-
def fetch_attachments_for field
|
52
|
-
|
72
|
+
def fetch_attachments_for field, starred=nil
|
73
|
+
conditions = {:document_class => metadata_class, :document_id => metadata_id,:label => field}
|
74
|
+
conditions[:starred] = starred if !starred.nil?
|
75
|
+
Attachment.all(:conditions => conditions , :order => "attach_updated_at DESC")
|
53
76
|
end
|
54
|
-
|
55
77
|
|
56
78
|
end
|
57
79
|
|
@@ -6,16 +6,21 @@ module ActiveMetadata::Persistence::ActiveRecord::Note
|
|
6
6
|
|
7
7
|
module InstanceMethods
|
8
8
|
|
9
|
-
def create_note_for(field, note)
|
10
|
-
Note.create! :document_id => metadata_id, :document_class => metadata_class, :label => field.to_s,:note => note, :created_by => current_user_id
|
11
|
-
reload_notes_cache_for field
|
9
|
+
def create_note_for(field, note, starred=false)
|
10
|
+
Note.create! :document_id => metadata_id, :document_class => metadata_class, :label => field.to_s,:note => note, :created_by => current_user_id, :starred => starred
|
11
|
+
reload_notes_cache_for field
|
12
12
|
self.send(:send_notification, field, "", note, :note_message, current_user_id)
|
13
13
|
end
|
14
14
|
|
15
|
-
def update_note(id, note)
|
15
|
+
def update_note(id, note, starred=nil)
|
16
16
|
n = Note.find(id)
|
17
17
|
old_value = n.note
|
18
|
-
|
18
|
+
attributes = {:note => note, :updated_by => current_user_id, :updated_at => Time.now.utc}
|
19
|
+
#mass assign starred inly if provided
|
20
|
+
unless starred.nil?
|
21
|
+
attributes[:starred] = starred
|
22
|
+
end
|
23
|
+
n.update_attributes! attributes
|
19
24
|
reload_notes_cache_for n.label
|
20
25
|
self.send(:send_notification, n.label, old_value, note, :note_message, current_user_id)
|
21
26
|
end
|
@@ -26,7 +31,7 @@ module ActiveMetadata::Persistence::ActiveRecord::Note
|
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
29
|
-
def
|
34
|
+
def find_note_by_id(id)
|
30
35
|
Note.find(id)
|
31
36
|
end
|
32
37
|
|
@@ -34,26 +39,45 @@ module ActiveMetadata::Persistence::ActiveRecord::Note
|
|
34
39
|
notes.each { |note| create_note_for field, note }
|
35
40
|
end
|
36
41
|
|
37
|
-
def
|
42
|
+
def delete_note(id)
|
38
43
|
n = Note.find(id)
|
39
44
|
old_value = n.note
|
40
45
|
n.destroy
|
41
|
-
reload_notes_cache_for
|
42
|
-
self.send(:send_notification,
|
46
|
+
reload_notes_cache_for n.label
|
47
|
+
self.send(:send_notification, n.label, old_value, "", :note_message)
|
43
48
|
end
|
44
49
|
|
45
50
|
def has_notes_for field
|
46
51
|
notes_for(field).size == 0 ? false : true
|
47
52
|
end
|
48
|
-
|
53
|
+
|
54
|
+
# not cached
|
55
|
+
def starred_notes_for(field)
|
56
|
+
fetch_notes_for field,true
|
57
|
+
end
|
58
|
+
|
59
|
+
def star_note(id)
|
60
|
+
n = Note.find(id)
|
61
|
+
update_note id,n.note,true
|
62
|
+
end
|
63
|
+
|
64
|
+
def unstar_note(id)
|
65
|
+
n = Note.find(id)
|
66
|
+
update_note id,n.note,false
|
67
|
+
end
|
68
|
+
|
49
69
|
private
|
50
70
|
|
51
71
|
def reload_notes_cache_for field
|
52
72
|
Rails.cache.write(notes_cache_key(field),fetch_notes_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes )
|
53
73
|
end
|
54
74
|
|
55
|
-
def fetch_notes_for
|
56
|
-
|
75
|
+
def fetch_notes_for(field, starred=nil)
|
76
|
+
conditions = {:label => field, :document_class => metadata_class, :document_id => metadata_id}
|
77
|
+
unless starred.nil?
|
78
|
+
conditions[:starred] = starred
|
79
|
+
end
|
80
|
+
Note.all(:conditions => conditions, :order => "updated_at DESC")
|
57
81
|
end
|
58
82
|
|
59
83
|
end
|
@@ -28,160 +28,6 @@ describe ActiveMetadata do
|
|
28
28
|
|
29
29
|
end
|
30
30
|
|
31
|
-
context "saving and quering notes" do
|
32
|
-
|
33
|
-
before(:each) do
|
34
|
-
@document = Document.create! { |d| d.name = "John" }
|
35
|
-
@document.reload
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should create a new note for a given field" do
|
39
|
-
@document.create_note_for(:name, "Very important note!")
|
40
|
-
@document.notes_for(:name).should have(1).record
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
it "should verify the content of a note created" do
|
45
|
-
@document.create_note_for(:name, "Very important note!")
|
46
|
-
@document.notes_for(:name).last.note.should eq "Very important note!"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should verify that notes are created for the correct model" do
|
50
|
-
@document.create_note_for(:name, "Very important note!")
|
51
|
-
@document.notes_for(:name).last.document_class.should eq(@document.class.to_s)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should verify the created_by of a note created" do
|
55
|
-
@document.create_note_for(:name, "Very important note!")
|
56
|
-
@document.notes_for(:name).last.created_by.should eq User.current.id
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should verify that notes_for_name return only notes for the self Document" do
|
60
|
-
# fixtures
|
61
|
-
@another_doc = Document.create :name => "Andrea"
|
62
|
-
@another_doc.create_note_for(:name, "Very important note for doc2!")
|
63
|
-
@another_doc.reload
|
64
|
-
@document.create_note_for(:name, "Very important note!")
|
65
|
-
|
66
|
-
# expectations
|
67
|
-
@document.notes_for(:name).count.should eq(1)
|
68
|
-
@document.notes_for(:name).last.note.should eq "Very important note!"
|
69
|
-
@another_doc.notes_for(:name).last.note.should eq "Very important note for doc2!"
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should update a note using update_note_for_name" do
|
74
|
-
@document.create_note_for(:name, "Very important note!")
|
75
|
-
id = @document.notes_for(:name).last.id
|
76
|
-
@document.update_note(id, "New note value!")
|
77
|
-
@document.notes_for(:name).last.note.should eq "New note value!"
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should verify the content of a note created for a second attribute" do
|
81
|
-
@document.create_note_for(:name, "Very important note!")
|
82
|
-
@document.create_note_for(:surname, "Note on surname attribute!")
|
83
|
-
|
84
|
-
@document.notes_for(:name).last.note.should eq "Very important note!"
|
85
|
-
@document.notes_for(:surname).last.note.should eq "Note on surname attribute!"
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should save multiple notes" do
|
89
|
-
notes = ["note number 1", "note number 2"]
|
90
|
-
@document.create_notes_for(:name, notes)
|
91
|
-
@document.notes_for(:name).should have(2).record
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should save the updater id in metadata" do
|
95
|
-
@document.create_note_for(:name, "Very important note!")
|
96
|
-
id = @document.notes_for(:name).last.id
|
97
|
-
@document.update_note id, "new note value"
|
98
|
-
@document.notes_for(:name).last.updated_by.should eq User.current.id
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should save the created_at datetime in metadata" do
|
102
|
-
@document.create_note_for(:name, "Very important note!")
|
103
|
-
@document.notes_for(:name).last.created_at.should be_a_kind_of Time
|
104
|
-
end
|
105
|
-
|
106
|
-
it "should save the updated_at datetime in metadata" do
|
107
|
-
@document.create_note_for(:name, "Very important note!")
|
108
|
-
@document.notes_for(:name).last.updated_at.should be_a_kind_of Time
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should update the updated_at field when a note is updated" do
|
112
|
-
@document.create_note_for(:name, "Very important note!")
|
113
|
-
id = @document.notes_for(:name).last.id
|
114
|
-
sleep 1.seconds
|
115
|
-
@document.update_note id, "new note value"
|
116
|
-
note = @document.notes_for(:name).last
|
117
|
-
note.updated_at.should > note.created_at
|
118
|
-
end
|
119
|
-
|
120
|
-
it "should verify that note are saved with the correct model id if metadata_id_from is defined" do
|
121
|
-
# fixtures
|
122
|
-
@document.create_note_for(:name, "Very important note!")
|
123
|
-
@section = @document.create_section :title => "new section"
|
124
|
-
@section.reload
|
125
|
-
@section.create_note_for(:title, "Very important note for section!")
|
126
|
-
|
127
|
-
# expectations
|
128
|
-
@document.notes_for(:name).last.document_id.should eq @document.id
|
129
|
-
@section.notes_for(:title).last.document_id.should eq @document.id
|
130
|
-
end
|
131
|
-
|
132
|
-
it "should delete a note id" do
|
133
|
-
#fixtures
|
134
|
-
2.times do |i|
|
135
|
-
@document.create_note_for(:name, "Note number #{i}")
|
136
|
-
end
|
137
|
-
|
138
|
-
#expectations
|
139
|
-
notes = @document.notes_for(:name)
|
140
|
-
notes.count.should eq 2
|
141
|
-
note_to_be_deleted = notes[0].note
|
142
|
-
|
143
|
-
@document.delete_note_for(:name,notes[0].id)
|
144
|
-
|
145
|
-
notes = @document.notes_for(:name)
|
146
|
-
notes.count.should eq 1
|
147
|
-
notes.first.note.should_not eq note_to_be_deleted
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
it "should verify that notes_for sort by updated_at descending" do
|
152
|
-
#fixtures
|
153
|
-
3.times do |i|
|
154
|
-
sleep 1.seconds
|
155
|
-
@document.create_note_for(:name, "Note number #{i}")
|
156
|
-
end
|
157
|
-
|
158
|
-
#expectations
|
159
|
-
@document.notes_for(:name).first.note.should eq "Note number 2"
|
160
|
-
@document.notes_for(:name).last.note.should eq "Note number 0"
|
161
|
-
end
|
162
|
-
|
163
|
-
it "should find a note by id" do
|
164
|
-
|
165
|
-
3.times do |i|
|
166
|
-
@document.create_note_for(:name, "Note number #{i}")
|
167
|
-
end
|
168
|
-
|
169
|
-
note = @document.notes_for(:name).last
|
170
|
-
id = note.id
|
171
|
-
|
172
|
-
match_note = @document.note_for :name,id
|
173
|
-
match_note.id.should eq id
|
174
|
-
|
175
|
-
end
|
176
|
-
|
177
|
-
it "should has_notes_for verify if defined field has notes" do
|
178
|
-
@document.has_notes_for(:name).should be_false
|
179
|
-
@document.create_note_for(:name, "new note")
|
180
|
-
@document.has_notes_for(:name).should be_true
|
181
|
-
end
|
182
|
-
|
183
|
-
end
|
184
|
-
|
185
31
|
context "history" do
|
186
32
|
|
187
33
|
before(:each) do
|
@@ -257,132 +103,7 @@ describe ActiveMetadata do
|
|
257
103
|
|
258
104
|
end
|
259
105
|
|
260
|
-
context "
|
261
|
-
|
262
|
-
before(:each) do
|
263
|
-
@document = Document.create! { |d| d.name = "John" }
|
264
|
-
@document.reload
|
265
|
-
doc = File.expand_path('../support/pdf_test.pdf',__FILE__)
|
266
|
-
@attachment = Rack::Test::UploadedFile.new(doc, "application/pdf")
|
267
|
-
doc2 = File.expand_path('../support/pdf_test_2.pdf',__FILE__)
|
268
|
-
@attachment2 = Rack::Test::UploadedFile.new(doc2, "application/pdf")
|
269
|
-
end
|
270
|
-
|
271
|
-
it "should save attachment for a given attribute" do
|
272
|
-
@document.save_attachment_for(:name,@attachment)
|
273
|
-
@document.attachments_for(:name).should have(1).record
|
274
|
-
end
|
275
|
-
|
276
|
-
it "should verify that the attachment metadata id refers to the correct self id" do
|
277
|
-
@document.save_attachment_for(:name,@attachment)
|
278
|
-
@document.attachments_for(:name).last.document_id.should eq @document.id
|
279
|
-
end
|
280
|
-
|
281
|
-
it "should verify that the attachment file name is correctly saved" do
|
282
|
-
@document.save_attachment_for(:name,@attachment)
|
283
|
-
@document.attachments_for(:name).last.attach.original_filename.should eq @attachment.original_filename
|
284
|
-
end
|
285
|
-
|
286
|
-
it "should verify that the attachment content type is correctly saved" do
|
287
|
-
@document.save_attachment_for(:name,@attachment)
|
288
|
-
@document.attachments_for(:name).last.attach.content_type.should eq @attachment.content_type
|
289
|
-
end
|
290
|
-
|
291
|
-
it "should verify that the attachment size is correctly saved" do
|
292
|
-
@document.save_attachment_for(:name,@attachment)
|
293
|
-
@document.attachments_for(:name).last.attach.size.should eq @attachment.size
|
294
|
-
end
|
295
|
-
|
296
|
-
it "should verify that the attachment updated_at is correctly saved" do
|
297
|
-
@document.save_attachment_for(:name,@attachment)
|
298
|
-
@document.attachments_for(:name).last.attach.instance_read(:updated_at).should be_a_kind_of Time
|
299
|
-
end
|
300
|
-
|
301
|
-
it "should verify that the document has been saved in the correct position on filesystem" do
|
302
|
-
@document.save_attachment_for(:name,@attachment)
|
303
|
-
att = @document.attachments_for(:name).first
|
304
|
-
expected_path = File.expand_path "#{ActiveMetadata::CONFIG['attachment_base_path']}/#{att.document_class}/#{@document.id}/#{:name.to_s}/#{att.id}/#{@attachment.original_filename}"
|
305
|
-
File.exists?(expected_path).should be_true
|
306
|
-
end
|
307
|
-
|
308
|
-
it "should delete an attachment by id" do
|
309
|
-
#fixtures
|
310
|
-
2.times do |i|
|
311
|
-
@document.save_attachment_for(:name,@attachment)
|
312
|
-
end
|
313
|
-
|
314
|
-
#expectations
|
315
|
-
attachments = @document.attachments_for(:name)
|
316
|
-
attachments.count.should eq 2
|
317
|
-
attachment_path_to_be_deleted = attachments[0].attach.path
|
318
|
-
|
319
|
-
@document.delete_attachment_for(:name,attachments[0].id)
|
320
|
-
|
321
|
-
attachments = @document.attachments_for(:name)
|
322
|
-
attachments.count.should eq 1
|
323
|
-
attachments.first.attach.path.should_not eq attachment_path_to_be_deleted
|
324
|
-
end
|
325
|
-
|
326
|
-
it "should update an attachment" do
|
327
|
-
@document.save_attachment_for(:name,@attachment)
|
328
|
-
att = @document.attachments_for(:name).last
|
329
|
-
@document.update_attachment_for :name,att.id,@attachment2
|
330
|
-
att2 = @document.attachments_for(:name).last
|
331
|
-
|
332
|
-
File.exists?(att.attach.path).should be_false
|
333
|
-
File.exists?(att2.attach.path).should be_true
|
334
|
-
end
|
335
|
-
|
336
|
-
it "should verify that field attachment_updated_at is modified after an update" do
|
337
|
-
@document.save_attachment_for(:name,@attachment)
|
338
|
-
att = @document.attachments_for(:name).last
|
339
|
-
|
340
|
-
sleep 1.seconds
|
341
|
-
|
342
|
-
@document.update_attachment_for :name,att.id,@attachment2
|
343
|
-
att2 = @document.attachments_for(:name).last
|
344
|
-
|
345
|
-
att2.attach.instance_read(:updated_at).should be > att.attach.instance_read(:updated_at)
|
346
|
-
end
|
347
|
-
|
348
|
-
it "should verify that is possible to upload 2 files with the same name for the same field" do
|
349
|
-
2.times do
|
350
|
-
@document.save_attachment_for(:name,@attachment)
|
351
|
-
end
|
352
|
-
|
353
|
-
#expectations
|
354
|
-
attachments = @document.attachments_for :name
|
355
|
-
attachments.count.should eq 2
|
356
|
-
File.exists?(attachments[0].attach.path).should be_true
|
357
|
-
attachments[0].attach.instance_read(:file_name).should eq "pdf_test.pdf"
|
358
|
-
File.exists?(attachments[1].attach.path).should be_true
|
359
|
-
attachments[1].attach.instance_read(:file_name).should eq "pdf_test.pdf"
|
360
|
-
end
|
361
|
-
|
362
|
-
it "should save the correct creator when an attachment is created" do
|
363
|
-
@document.save_attachment_for(:name,@attachment)
|
364
|
-
@document.attachments_for(:name).last.created_by.should eq User.current.id
|
365
|
-
end
|
366
|
-
|
367
|
-
it "should save the correct updater when anttachment is updated" do
|
368
|
-
@document.save_attachment_for(:name,@attachment)
|
369
|
-
att = @document.attachments_for(:name).last
|
370
|
-
|
371
|
-
@document.update_attachment_for :name,att.id,@attachment2
|
372
|
-
att2 = @document.attachments_for(:name).last
|
373
|
-
|
374
|
-
@document.attachments_for(:name).last.updated_by.should eq User.current.id
|
375
|
-
end
|
376
|
-
|
377
|
-
it "should has_notes_for verify if defined field has attachments" do
|
378
|
-
@document.has_attachments_for(:name).should be_false
|
379
|
-
@document.save_attachment_for(:name,@attachment)
|
380
|
-
@document.has_attachments_for(:name).should be_true
|
381
|
-
end
|
382
|
-
|
383
|
-
end
|
384
|
-
|
385
|
-
context "watchers" do
|
106
|
+
context "watchers" do
|
386
107
|
before(:each) do
|
387
108
|
@document = Document.create! { |d| d.name = "John" }
|
388
109
|
end
|
@@ -434,4 +155,5 @@ describe ActiveMetadata do
|
|
434
155
|
end
|
435
156
|
|
436
157
|
end
|
158
|
+
|
437
159
|
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "rack/test/uploaded_file"
|
3
|
+
require "time"
|
4
|
+
|
5
|
+
describe ActiveMetadata do
|
6
|
+
|
7
|
+
context "attachments" do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@document = Document.create! { |d| d.name = "John" }
|
11
|
+
@document.reload
|
12
|
+
doc = File.expand_path('../support/pdf_test.pdf', __FILE__)
|
13
|
+
@attachment = Rack::Test::UploadedFile.new(doc, "application/pdf")
|
14
|
+
doc2 = File.expand_path('../support/pdf_test_2.pdf', __FILE__)
|
15
|
+
@attachment2 = Rack::Test::UploadedFile.new(doc2, "application/pdf")
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
context "saving and quering" do
|
20
|
+
|
21
|
+
it "should save attachment for a given attribute" do
|
22
|
+
@document.save_attachment_for(:name, @attachment)
|
23
|
+
@document.attachments_for(:name).should have(1).record
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should verify that the attachment metadata id refers to the correct self id" do
|
27
|
+
@document.save_attachment_for(:name, @attachment)
|
28
|
+
@document.attachments_for(:name).last.document_id.should eq @document.id
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should verify that the attachment file name is correctly saved" do
|
32
|
+
@document.save_attachment_for(:name, @attachment)
|
33
|
+
@document.attachments_for(:name).last.attach.original_filename.should eq @attachment.original_filename
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should verify that the attachment content type is correctly saved" do
|
37
|
+
@document.save_attachment_for(:name, @attachment)
|
38
|
+
@document.attachments_for(:name).last.attach.content_type.should eq @attachment.content_type
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should verify that the attachment size is correctly saved" do
|
42
|
+
@document.save_attachment_for(:name, @attachment)
|
43
|
+
@document.attachments_for(:name).last.attach.size.should eq @attachment.size
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should verify that the attachment updated_at is correctly saved" do
|
47
|
+
@document.save_attachment_for(:name, @attachment)
|
48
|
+
@document.attachments_for(:name).last.attach.instance_read(:updated_at).should be_a_kind_of Time
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should verify that the document has been saved in the correct position on filesystem" do
|
52
|
+
@document.save_attachment_for(:name, @attachment)
|
53
|
+
att = @document.attachments_for(:name).first
|
54
|
+
expected_path = File.expand_path "#{ActiveMetadata::CONFIG['attachment_base_path']}/#{att.document_class}/#{@document.id}/#{:name.to_s}/#{att.id}/#{@attachment.original_filename}"
|
55
|
+
File.exists?(expected_path).should be_true
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should delete an attachment by id" do
|
59
|
+
#fixtures
|
60
|
+
2.times do |i|
|
61
|
+
@document.save_attachment_for(:name, @attachment)
|
62
|
+
end
|
63
|
+
|
64
|
+
#expectations
|
65
|
+
attachments = @document.attachments_for(:name)
|
66
|
+
attachments.count.should eq 2
|
67
|
+
attachment_path_to_be_deleted = attachments[0].attach.path
|
68
|
+
|
69
|
+
@document.delete_attachment(attachments[0].id)
|
70
|
+
|
71
|
+
attachments = @document.attachments_for(:name)
|
72
|
+
attachments.count.should eq 1
|
73
|
+
attachments.first.attach.path.should_not eq attachment_path_to_be_deleted
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should update an attachment" do
|
77
|
+
@document.save_attachment_for(:name, @attachment)
|
78
|
+
att = @document.attachments_for(:name).last
|
79
|
+
@document.update_attachment att.id, @attachment2
|
80
|
+
att2 = @document.attachments_for(:name).last
|
81
|
+
|
82
|
+
File.exists?(att.attach.path).should be_false
|
83
|
+
File.exists?(att2.attach.path).should be_true
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should verify that field attachment_updated_at is modified after an update" do
|
87
|
+
@document.save_attachment_for(:name, @attachment)
|
88
|
+
att = @document.attachments_for(:name).last
|
89
|
+
|
90
|
+
sleep 1.seconds
|
91
|
+
|
92
|
+
@document.update_attachment att.id, @attachment2
|
93
|
+
att2 = @document.attachments_for(:name).last
|
94
|
+
|
95
|
+
att2.attach.instance_read(:updated_at).should be > att.attach.instance_read(:updated_at)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should verify that is possible to upload 2 files with the same name for the same field" do
|
99
|
+
2.times do
|
100
|
+
@document.save_attachment_for(:name, @attachment)
|
101
|
+
end
|
102
|
+
|
103
|
+
#expectations
|
104
|
+
attachments = @document.attachments_for :name
|
105
|
+
attachments.count.should eq 2
|
106
|
+
File.exists?(attachments[0].attach.path).should be_true
|
107
|
+
attachments[0].attach.instance_read(:file_name).should eq "pdf_test.pdf"
|
108
|
+
File.exists?(attachments[1].attach.path).should be_true
|
109
|
+
attachments[1].attach.instance_read(:file_name).should eq "pdf_test.pdf"
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should save the correct creator when an attachment is created" do
|
113
|
+
@document.save_attachment_for(:name, @attachment)
|
114
|
+
@document.attachments_for(:name).last.created_by.should eq User.current.id
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should save the correct updater when anttachment is updated" do
|
118
|
+
@document.save_attachment_for(:name, @attachment)
|
119
|
+
att = @document.attachments_for(:name).last
|
120
|
+
|
121
|
+
@document.update_attachment att.id, @attachment2
|
122
|
+
att2 = @document.attachments_for(:name).last
|
123
|
+
|
124
|
+
@document.attachments_for(:name).last.updated_by.should eq User.current.id
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should has_notes_for verify if defined field has attachments" do
|
128
|
+
@document.has_attachments_for(:name).should be_false
|
129
|
+
@document.save_attachment_for(:name, @attachment)
|
130
|
+
@document.has_attachments_for(:name).should be_true
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "managing starred" do
|
136
|
+
|
137
|
+
it "should craete starred attachments" do
|
138
|
+
@document.save_attachment_for(:name, @attachment, true)
|
139
|
+
@document.attachments_for(:name).first.starred?.should be_true
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should update an attachment as starred" do
|
143
|
+
@document.save_attachment_for(:name, @attachment)
|
144
|
+
attachment = @document.attachments_for(:name).first
|
145
|
+
@document.update_attachment(attachment.id, attachment.attach, true)
|
146
|
+
@document.attachments_for(:name).first.starred?.should be_true
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should retrieve only starred attachments for a given label" do
|
150
|
+
@document.save_attachment_for(:name, @attachment, true)
|
151
|
+
@document.save_attachment_for(:name, @attachment2)
|
152
|
+
|
153
|
+
atts = @document.starred_attachments_for(:name)
|
154
|
+
atts.size.should eq 1
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should set an attachment as starred using star method" do
|
158
|
+
@document.save_attachment_for(:name, @attachment2)
|
159
|
+
att = @document.attachments_for(:name).first
|
160
|
+
|
161
|
+
@document.star_attachment(att.id)
|
162
|
+
|
163
|
+
att = @document.find_attachment_by_id(att.id)
|
164
|
+
att.starred?.should be_true
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should unstar" do
|
168
|
+
@document.save_attachment_for(:name, @attachment, true)
|
169
|
+
att = @document.starred_attachments_for(:name).first
|
170
|
+
|
171
|
+
@document.unstar_attachment(att.id)
|
172
|
+
|
173
|
+
att = @document.find_attachment_by_id(att.id)
|
174
|
+
att.starred?.should be_false
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
data/spec/notes_spec.rb
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "time"
|
3
|
+
|
4
|
+
describe ActiveMetadata do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@document = Document.create! { |d| d.name = "John" }
|
8
|
+
@document.reload
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "notes" do
|
12
|
+
|
13
|
+
context "saving and quering" do
|
14
|
+
|
15
|
+
it "should create a new note for a given field" do
|
16
|
+
@document.create_note_for(:name, "Very important note!")
|
17
|
+
@document.notes_for(:name).should have(1).record
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
it "should verify the content of a note created" do
|
22
|
+
@document.create_note_for(:name, "Very important note!")
|
23
|
+
@document.notes_for(:name).last.note.should eq "Very important note!"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should verify that notes are created for the correct model" do
|
27
|
+
@document.create_note_for(:name, "Very important note!")
|
28
|
+
@document.notes_for(:name).last.document_class.should eq(@document.class.to_s)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should verify the created_by of a note created" do
|
32
|
+
@document.create_note_for(:name, "Very important note!")
|
33
|
+
@document.notes_for(:name).last.created_by.should eq User.current.id
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should verify that notes_for_name return only notes for the self Document" do
|
37
|
+
# fixtures
|
38
|
+
@another_doc = Document.create :name => "Andrea"
|
39
|
+
@another_doc.create_note_for(:name, "Very important note for doc2!")
|
40
|
+
@another_doc.reload
|
41
|
+
@document.create_note_for(:name, "Very important note!")
|
42
|
+
|
43
|
+
# expectations
|
44
|
+
@document.notes_for(:name).count.should eq(1)
|
45
|
+
@document.notes_for(:name).last.note.should eq "Very important note!"
|
46
|
+
@another_doc.notes_for(:name).last.note.should eq "Very important note for doc2!"
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should update a note using update_note_for_name" do
|
51
|
+
@document.create_note_for(:name, "Very important note!")
|
52
|
+
id = @document.notes_for(:name).last.id
|
53
|
+
@document.update_note(id, "New note value!")
|
54
|
+
@document.notes_for(:name).last.note.should eq "New note value!"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should verify the content of a note created for a second attribute" do
|
58
|
+
@document.create_note_for(:name, "Very important note!")
|
59
|
+
@document.create_note_for(:surname, "Note on surname attribute!")
|
60
|
+
|
61
|
+
@document.notes_for(:name).last.note.should eq "Very important note!"
|
62
|
+
@document.notes_for(:surname).last.note.should eq "Note on surname attribute!"
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should save multiple notes" do
|
66
|
+
notes = ["note number 1", "note number 2"]
|
67
|
+
@document.create_notes_for(:name, notes)
|
68
|
+
@document.notes_for(:name).should have(2).record
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should save the updater id in metadata" do
|
72
|
+
@document.create_note_for(:name, "Very important note!")
|
73
|
+
id = @document.notes_for(:name).last.id
|
74
|
+
@document.update_note id, "new note value"
|
75
|
+
@document.notes_for(:name).last.updated_by.should eq User.current.id
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should save the created_at datetime in metadata" do
|
79
|
+
@document.create_note_for(:name, "Very important note!")
|
80
|
+
@document.notes_for(:name).last.created_at.should be_a_kind_of Time
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should save the updated_at datetime in metadata" do
|
84
|
+
@document.create_note_for(:name, "Very important note!")
|
85
|
+
@document.notes_for(:name).last.updated_at.should be_a_kind_of Time
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should update the updated_at field when a note is updated" do
|
89
|
+
@document.create_note_for(:name, "Very important note!")
|
90
|
+
id = @document.notes_for(:name).last.id
|
91
|
+
sleep 1.seconds
|
92
|
+
@document.update_note id, "new note value"
|
93
|
+
note = @document.notes_for(:name).last
|
94
|
+
note.updated_at.should > note.created_at
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should verify that note are saved with the correct model id if metadata_id_from is defined" do
|
98
|
+
# fixtures
|
99
|
+
@document.create_note_for(:name, "Very important note!")
|
100
|
+
@section = @document.create_section :title => "new section"
|
101
|
+
@section.reload
|
102
|
+
@section.create_note_for(:title, "Very important note for section!")
|
103
|
+
|
104
|
+
# expectations
|
105
|
+
@document.notes_for(:name).last.document_id.should eq @document.id
|
106
|
+
@section.notes_for(:title).last.document_id.should eq @document.id
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should delete a note id" do
|
110
|
+
#fixtures
|
111
|
+
2.times do |i|
|
112
|
+
@document.create_note_for(:name, "Note number #{i}")
|
113
|
+
end
|
114
|
+
|
115
|
+
#expectations
|
116
|
+
notes = @document.notes_for(:name)
|
117
|
+
notes.count.should eq 2
|
118
|
+
note_to_be_deleted = notes[0].note
|
119
|
+
|
120
|
+
@document.delete_note(notes[0].id)
|
121
|
+
|
122
|
+
notes = @document.notes_for(:name)
|
123
|
+
notes.count.should eq 1
|
124
|
+
notes.first.note.should_not eq note_to_be_deleted
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should verify that notes_for sort by updated_at descending" do
|
129
|
+
#fixtures
|
130
|
+
3.times do |i|
|
131
|
+
sleep 1.seconds
|
132
|
+
@document.create_note_for(:name, "Note number #{i}")
|
133
|
+
end
|
134
|
+
|
135
|
+
#expectations
|
136
|
+
@document.notes_for(:name).first.note.should eq "Note number 2"
|
137
|
+
@document.notes_for(:name).last.note.should eq "Note number 0"
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should find a note by id" do
|
141
|
+
|
142
|
+
3.times do |i|
|
143
|
+
@document.create_note_for(:name, "Note number #{i}")
|
144
|
+
end
|
145
|
+
|
146
|
+
note = @document.notes_for(:name).last
|
147
|
+
id = note.id
|
148
|
+
|
149
|
+
match_note = @document.find_note_by_id id
|
150
|
+
match_note.id.should eq id
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should has_notes_for verify if defined field has notes" do
|
155
|
+
@document.has_notes_for(:name).should be_false
|
156
|
+
@document.create_note_for(:name, "new note")
|
157
|
+
@document.has_notes_for(:name).should be_true
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
describe "managing starred" do
|
163
|
+
|
164
|
+
it "should craete starred note" do
|
165
|
+
@document.create_note_for(:name, "nuova nota", true)
|
166
|
+
@document.notes_for(:name).first.starred?.should be_true
|
167
|
+
end
|
168
|
+
|
169
|
+
it "should update a note as starred" do
|
170
|
+
@document.create_note_for(:name, "nuova nota")
|
171
|
+
note = @document.notes_for(:name).first
|
172
|
+
@document.update_note(note.id, note.note, true)
|
173
|
+
@document.notes_for(:name).first.starred?.should be_true
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should retrieve only starred notes for a given label" do
|
177
|
+
@document.create_note_for(:name, "starred note", true)
|
178
|
+
@document.create_note_for(:name, "nuova nota")
|
179
|
+
|
180
|
+
notes = @document.starred_notes_for(:name)
|
181
|
+
notes.size.should eq 1
|
182
|
+
notes.first.note.should eq "starred note"
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should set a note as starred using star method" do
|
186
|
+
@document.create_note_for(:name, "nota 1")
|
187
|
+
nota = @document.notes_for(:name).first
|
188
|
+
|
189
|
+
@document.star_note(nota.id)
|
190
|
+
|
191
|
+
nota = @document.find_note_by_id(nota.id)
|
192
|
+
nota.starred?.should be_true
|
193
|
+
end
|
194
|
+
|
195
|
+
it "should unstar a note" do
|
196
|
+
@document.create_note_for(:name, "nota 1", true)
|
197
|
+
nota = @document.notes_for(:name).first
|
198
|
+
|
199
|
+
@document.unstar_note(nota.id)
|
200
|
+
|
201
|
+
nota = @document.find_note_by_id(nota.id)
|
202
|
+
nota.starred?.should be_false
|
203
|
+
end
|
204
|
+
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-21 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec-rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70240621249380 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70240621249380
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: sqlite3
|
28
|
-
requirement: &
|
28
|
+
requirement: &70240621248800 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70240621248800
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sqlite3-ruby
|
39
|
-
requirement: &
|
39
|
+
requirement: &70240621247520 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70240621247520
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: cucumber
|
50
|
-
requirement: &
|
50
|
+
requirement: &70240621247060 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70240621247060
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: ci_reporter
|
61
|
-
requirement: &
|
61
|
+
requirement: &70240621246620 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70240621246620
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rails
|
72
|
-
requirement: &
|
72
|
+
requirement: &70240621245860 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - =
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 3.0.1
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70240621245860
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: activerecord
|
83
|
-
requirement: &
|
83
|
+
requirement: &70240621245240 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - =
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 3.0.1
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70240621245240
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: paperclip
|
94
|
-
requirement: &
|
94
|
+
requirement: &70240621236040 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,18 +99,7 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: to_xls
|
105
|
-
requirement: &2165056320 !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
|
-
requirements:
|
108
|
-
- - ! '>='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
type: :runtime
|
112
|
-
prerelease: false
|
113
|
-
version_requirements: *2165056320
|
102
|
+
version_requirements: *70240621236040
|
114
103
|
description: First implementation will write metadata on mongodb
|
115
104
|
email:
|
116
105
|
- acampolonghi@gmail.com
|
@@ -175,9 +164,11 @@ files:
|
|
175
164
|
- features/watchlist/add_a_user_to_a_watcher.feature
|
176
165
|
- features/watchlist/trigger_alert_on_modify.feature
|
177
166
|
- spec/active_metadata_spec.rb
|
167
|
+
- spec/attachments_spec.rb
|
178
168
|
- spec/benchmark_spec.rb
|
179
169
|
- spec/concurrency_spec.rb
|
180
170
|
- spec/controllers/metadata_controller_spec.rb
|
171
|
+
- spec/notes_spec.rb
|
181
172
|
- spec/spec_helper.rb
|
182
173
|
- spec/support/document.rb
|
183
174
|
- spec/support/pdf_test.pdf
|
@@ -199,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
190
|
version: '0'
|
200
191
|
segments:
|
201
192
|
- 0
|
202
|
-
hash:
|
193
|
+
hash: -4250317635104951696
|
203
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
195
|
none: false
|
205
196
|
requirements:
|
@@ -208,10 +199,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
199
|
version: '0'
|
209
200
|
segments:
|
210
201
|
- 0
|
211
|
-
hash:
|
202
|
+
hash: -4250317635104951696
|
212
203
|
requirements: []
|
213
204
|
rubyforge_project: active_metadata
|
214
|
-
rubygems_version: 1.8.
|
205
|
+
rubygems_version: 1.8.10
|
215
206
|
signing_key:
|
216
207
|
specification_version: 3
|
217
208
|
summary: Add metadata to fields in an active record model
|
@@ -224,9 +215,11 @@ test_files:
|
|
224
215
|
- features/watchlist/add_a_user_to_a_watcher.feature
|
225
216
|
- features/watchlist/trigger_alert_on_modify.feature
|
226
217
|
- spec/active_metadata_spec.rb
|
218
|
+
- spec/attachments_spec.rb
|
227
219
|
- spec/benchmark_spec.rb
|
228
220
|
- spec/concurrency_spec.rb
|
229
221
|
- spec/controllers/metadata_controller_spec.rb
|
222
|
+
- spec/notes_spec.rb
|
230
223
|
- spec/spec_helper.rb
|
231
224
|
- spec/support/document.rb
|
232
225
|
- spec/support/pdf_test.pdf
|