enju_message 0.1.14.pre24 → 0.1.14.pre25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/messages_controller.rb +2 -6
- data/app/models/enju_message/ability.rb +3 -2
- data/app/models/message.rb +4 -4
- data/app/views/messages/new.html.erb +2 -2
- data/config/locales/translation_en.yml +1 -0
- data/config/locales/translation_ja.yml +1 -0
- data/lib/enju_message/version.rb +1 -1
- data/spec/controllers/messages_controller_spec.rb +53 -0
- data/spec/dummy/db/schema.rb +18 -274
- data/spec/models/message_spec.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8142b6f6323115bd8fbb9e97ed5ff0f43db917c7
|
4
|
+
data.tar.gz: 21795810e3d5c2fa3a1ee221d8fc2032910ef159
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cf6d6627d4e87e3bac290bc0e428d14dea88811c38860bd4c8755fbf3b88e94af2d76634c831c70026e6316881747965ac4e3eda80da4e31f540d67b38d5433
|
7
|
+
data.tar.gz: d60dc9912499fa081effc6c37ff796701b541eb1d16d9c5b7ff13ceda9192fed658815666d7706f8ff55a8be54e32551981628b40f34b87f261090e2a01298b0
|
@@ -121,17 +121,13 @@ class MessagesController < ApplicationController
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def destroy_selected
|
124
|
-
|
125
|
-
unless current_user.has_role?('Librarian')
|
126
|
-
access_denied
|
127
|
-
end
|
128
|
-
else
|
124
|
+
unless current_user
|
129
125
|
redirect_to new_user_session_url
|
130
126
|
return
|
131
127
|
end
|
132
128
|
respond_to do |format|
|
133
129
|
if params[:delete].present?
|
134
|
-
messages = params[:delete].map{|m| Message.
|
130
|
+
messages = params[:delete].map{|m| Message.where(id: m).first}
|
135
131
|
end
|
136
132
|
if messages.present?
|
137
133
|
messages.each do |message|
|
@@ -6,6 +6,7 @@ module EnjuMessage
|
|
6
6
|
case user.try(:role).try(:name)
|
7
7
|
when 'Administrator'
|
8
8
|
can :manage, Message
|
9
|
+
can :destroy_selected, Message
|
9
10
|
can [:read, :update, :destroy, :delete], MessageRequest
|
10
11
|
can [:read, :update], MessageTemplate
|
11
12
|
when 'Librarian'
|
@@ -13,13 +14,13 @@ module EnjuMessage
|
|
13
14
|
can [:update], Message do |message|
|
14
15
|
message.sender == user
|
15
16
|
end
|
16
|
-
can [:show, :destroy, :delete], Message do |message|
|
17
|
+
can [:show, :destroy, :delete, :destroy_selected], Message do |message|
|
17
18
|
message.receiver == user
|
18
19
|
end
|
19
20
|
can [:read, :update, :destroy, :delete], MessageRequest
|
20
21
|
can :read, MessageTemplate
|
21
22
|
when 'User'
|
22
|
-
can [:
|
23
|
+
can [:show, :destroy, :delete, :destroy_selected], Message do |message|
|
23
24
|
message.receiver == user
|
24
25
|
end
|
25
26
|
can :index, Message
|
data/app/models/message.rb
CHANGED
@@ -6,15 +6,15 @@ class Message < ActiveRecord::Base
|
|
6
6
|
belongs_to :sender, class_name: 'User'
|
7
7
|
belongs_to :receiver, class_name: 'User'
|
8
8
|
validates_presence_of :subject, :body #, :sender
|
9
|
-
validates_presence_of :
|
10
|
-
|
11
|
-
before_save :set_receiver
|
9
|
+
validates_presence_of :receiver, message: :invalid
|
10
|
+
before_validation :set_receiver
|
12
11
|
after_save :index
|
13
12
|
after_destroy :remove_from_index
|
14
13
|
after_create :send_notification
|
15
14
|
|
16
15
|
acts_as_nested_set
|
17
16
|
attr_accessor :recipient
|
17
|
+
validates :recipient, presence: true, on: :create
|
18
18
|
|
19
19
|
delegate :can_transition_to?, :transition_to!, :transition_to, :current_state,
|
20
20
|
to: :state_machine
|
@@ -43,7 +43,7 @@ class Message < ActiveRecord::Base
|
|
43
43
|
|
44
44
|
def set_receiver
|
45
45
|
if recipient
|
46
|
-
self.receiver = User.
|
46
|
+
self.receiver = User.where(username: recipient).first
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -4,11 +4,11 @@
|
|
4
4
|
<fieldset>
|
5
5
|
|
6
6
|
<%= simple_form_for(@message, url: messages_path, validate: true) do |f| -%>
|
7
|
-
<%= f.
|
7
|
+
<%= f.error_messages -%>
|
8
8
|
|
9
9
|
<div class="field">
|
10
10
|
<label for="message_recepient"><%= t('message.recipient') -%>:</label>
|
11
|
-
<%- if @message.
|
11
|
+
<%- if @message.receiver -%>
|
12
12
|
<%= link_to @message.receiver.username, profile_path(@message.receiver) -%>
|
13
13
|
<%= f.hidden_field :recipient, value: @message.recipient -%>
|
14
14
|
<%- else -%>
|
data/lib/enju_message/version.rb
CHANGED
@@ -229,6 +229,8 @@ describe MessagesController do
|
|
229
229
|
before(:each) do
|
230
230
|
@attrs = {:recipient => users(:user1).username, :subject => 'test',:body => 'test'}
|
231
231
|
@invalid_attrs = {:recipient => users(:user1).username, :subject => 'test', :body => ''}
|
232
|
+
@invalid_user_attrs = {:recipient => "invalid_user", :subject => 'test', :body => 'test'}
|
233
|
+
@blank_user_attrs = {:recipient => "", :subject => 'test', :body => 'test'}
|
232
234
|
end
|
233
235
|
|
234
236
|
describe "When logged in as Administrator" do
|
@@ -258,6 +260,24 @@ describe MessagesController do
|
|
258
260
|
response.should be_success
|
259
261
|
end
|
260
262
|
end
|
263
|
+
describe "with invalid recipient" do
|
264
|
+
it "re-renders the 'new' template" do
|
265
|
+
post :create, :message => @invalid_user_attrs
|
266
|
+
message = assigns(:message)
|
267
|
+
message.should_not be_valid
|
268
|
+
message.errors.should have_key :receiver
|
269
|
+
message.errors.added?(:receiver, :invalid).should be_truthy
|
270
|
+
response.should render_template("new")
|
271
|
+
end
|
272
|
+
it "re-renders the 'new' template" do
|
273
|
+
post :create, :message => @blank_user_attrs
|
274
|
+
message = assigns(:message)
|
275
|
+
message.should_not be_valid
|
276
|
+
message.errors.should have_key :recipient
|
277
|
+
message.errors.added?(:recipient, :blank).should be_truthy
|
278
|
+
response.should render_template("new")
|
279
|
+
end
|
280
|
+
end
|
261
281
|
end
|
262
282
|
|
263
283
|
describe "When logged in as Librarian" do
|
@@ -425,12 +445,22 @@ describe MessagesController do
|
|
425
445
|
end
|
426
446
|
|
427
447
|
describe "DELETE destroy" do
|
448
|
+
describe "When logged in as Librarian" do
|
449
|
+
login_fixture_librarian
|
450
|
+
|
451
|
+
it "should destroy own message" do
|
452
|
+
@message = FactoryGirl.create(:message, recipient: @user.username)
|
453
|
+
delete :destroy, :id => @message.id
|
454
|
+
response.should redirect_to messages_url
|
455
|
+
end
|
456
|
+
end
|
428
457
|
describe "When logged in as User" do
|
429
458
|
login_fixture_user
|
430
459
|
|
431
460
|
it "should destroy own message" do
|
432
461
|
delete :destroy, :id => 2
|
433
462
|
response.should redirect_to messages_url
|
463
|
+
response.should_not be_forbidden
|
434
464
|
end
|
435
465
|
|
436
466
|
it "should not destroy other user's message" do
|
@@ -442,6 +472,7 @@ describe MessagesController do
|
|
442
472
|
describe "When not logged in" do
|
443
473
|
it "destroys the requested message" do
|
444
474
|
delete :destroy, :id => 1
|
475
|
+
response.should redirect_to(new_user_session_url)
|
445
476
|
end
|
446
477
|
|
447
478
|
it "should be redirected to new_user_session_url" do
|
@@ -450,4 +481,26 @@ describe MessagesController do
|
|
450
481
|
end
|
451
482
|
end
|
452
483
|
end
|
484
|
+
|
485
|
+
describe "POST destroy_selected" do
|
486
|
+
describe "When logged in as Librarian" do
|
487
|
+
login_fixture_librarian
|
488
|
+
it "should destroy own message" do
|
489
|
+
message = FactoryGirl.create(:message, recipient: @user.username)
|
490
|
+
post :destroy_selected, delete: [ message.id ]
|
491
|
+
response.should_not be_forbidden
|
492
|
+
response.should redirect_to(messages_url)
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
describe "When logged in as User" do
|
497
|
+
login_fixture_user
|
498
|
+
it "should destroy own message" do
|
499
|
+
message = FactoryGirl.create(:message, recipient: @user.username)
|
500
|
+
post :destroy_selected, delete: [ message.id ]
|
501
|
+
response.should_not be_forbidden
|
502
|
+
response.should redirect_to(messages_url)
|
503
|
+
end
|
504
|
+
end
|
505
|
+
end
|
453
506
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -43,7 +43,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
43
43
|
t.integer "user_id"
|
44
44
|
t.text "note"
|
45
45
|
t.datetime "executed_at"
|
46
|
-
t.string "
|
46
|
+
t.string "agent_import_file_name"
|
47
47
|
t.string "agent_import_content_type"
|
48
48
|
t.integer "agent_import_file_size"
|
49
49
|
t.datetime "agent_import_updated_at"
|
@@ -199,18 +199,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
199
199
|
t.datetime "updated_at"
|
200
200
|
end
|
201
201
|
|
202
|
-
create_table "carrier_type_has_checkout_types", force: :cascade do |t|
|
203
|
-
t.integer "carrier_type_id", null: false
|
204
|
-
t.integer "checkout_type_id", null: false
|
205
|
-
t.text "note"
|
206
|
-
t.integer "position"
|
207
|
-
t.datetime "created_at"
|
208
|
-
t.datetime "updated_at"
|
209
|
-
end
|
210
|
-
|
211
|
-
add_index "carrier_type_has_checkout_types", ["carrier_type_id"], name: "index_carrier_type_has_checkout_types_on_m_form_id"
|
212
|
-
add_index "carrier_type_has_checkout_types", ["checkout_type_id"], name: "index_carrier_type_has_checkout_types_on_checkout_type_id"
|
213
|
-
|
214
202
|
create_table "carrier_types", force: :cascade do |t|
|
215
203
|
t.string "name", null: false
|
216
204
|
t.text "display_name"
|
@@ -220,93 +208,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
220
208
|
t.datetime "updated_at"
|
221
209
|
end
|
222
210
|
|
223
|
-
create_table "checked_items", force: :cascade do |t|
|
224
|
-
t.integer "item_id", null: false
|
225
|
-
t.integer "basket_id", null: false
|
226
|
-
t.datetime "due_date", null: false
|
227
|
-
t.datetime "created_at"
|
228
|
-
t.datetime "updated_at"
|
229
|
-
t.integer "librarian_id"
|
230
|
-
end
|
231
|
-
|
232
|
-
add_index "checked_items", ["basket_id"], name: "index_checked_items_on_basket_id"
|
233
|
-
add_index "checked_items", ["item_id"], name: "index_checked_items_on_item_id"
|
234
|
-
|
235
|
-
create_table "checkins", force: :cascade do |t|
|
236
|
-
t.integer "item_id", null: false
|
237
|
-
t.integer "librarian_id"
|
238
|
-
t.integer "basket_id"
|
239
|
-
t.datetime "created_at"
|
240
|
-
t.datetime "updated_at"
|
241
|
-
t.integer "lock_version", default: 0, null: false
|
242
|
-
end
|
243
|
-
|
244
|
-
add_index "checkins", ["basket_id"], name: "index_checkins_on_basket_id"
|
245
|
-
add_index "checkins", ["item_id"], name: "index_checkins_on_item_id"
|
246
|
-
add_index "checkins", ["librarian_id"], name: "index_checkins_on_librarian_id"
|
247
|
-
|
248
|
-
create_table "checkout_stat_has_manifestations", force: :cascade do |t|
|
249
|
-
t.integer "manifestation_checkout_stat_id", null: false
|
250
|
-
t.integer "manifestation_id", null: false
|
251
|
-
t.integer "checkouts_count"
|
252
|
-
t.datetime "created_at"
|
253
|
-
t.datetime "updated_at"
|
254
|
-
end
|
255
|
-
|
256
|
-
add_index "checkout_stat_has_manifestations", ["manifestation_checkout_stat_id"], name: "index_checkout_stat_has_manifestations_on_checkout_stat_id"
|
257
|
-
add_index "checkout_stat_has_manifestations", ["manifestation_id"], name: "index_checkout_stat_has_manifestations_on_manifestation_id"
|
258
|
-
|
259
|
-
create_table "checkout_stat_has_users", force: :cascade do |t|
|
260
|
-
t.integer "user_checkout_stat_id", null: false
|
261
|
-
t.integer "user_id", null: false
|
262
|
-
t.integer "checkouts_count", default: 0, null: false
|
263
|
-
t.datetime "created_at"
|
264
|
-
t.datetime "updated_at"
|
265
|
-
end
|
266
|
-
|
267
|
-
add_index "checkout_stat_has_users", ["user_checkout_stat_id"], name: "index_checkout_stat_has_users_on_user_checkout_stat_id"
|
268
|
-
add_index "checkout_stat_has_users", ["user_id"], name: "index_checkout_stat_has_users_on_user_id"
|
269
|
-
|
270
|
-
create_table "checkout_types", force: :cascade do |t|
|
271
|
-
t.string "name", null: false
|
272
|
-
t.text "display_name"
|
273
|
-
t.text "note"
|
274
|
-
t.integer "position"
|
275
|
-
t.datetime "created_at"
|
276
|
-
t.datetime "updated_at"
|
277
|
-
end
|
278
|
-
|
279
|
-
add_index "checkout_types", ["name"], name: "index_checkout_types_on_name"
|
280
|
-
|
281
|
-
create_table "checkouts", force: :cascade do |t|
|
282
|
-
t.integer "user_id"
|
283
|
-
t.integer "item_id", null: false
|
284
|
-
t.integer "checkin_id"
|
285
|
-
t.integer "librarian_id"
|
286
|
-
t.integer "basket_id"
|
287
|
-
t.datetime "due_date"
|
288
|
-
t.integer "checkout_renewal_count", default: 0, null: false
|
289
|
-
t.integer "lock_version", default: 0, null: false
|
290
|
-
t.datetime "created_at"
|
291
|
-
t.datetime "updated_at"
|
292
|
-
end
|
293
|
-
|
294
|
-
add_index "checkouts", ["basket_id"], name: "index_checkouts_on_basket_id"
|
295
|
-
add_index "checkouts", ["checkin_id"], name: "index_checkouts_on_checkin_id"
|
296
|
-
add_index "checkouts", ["item_id", "basket_id"], name: "index_checkouts_on_item_id_and_basket_id", unique: true
|
297
|
-
add_index "checkouts", ["item_id"], name: "index_checkouts_on_item_id"
|
298
|
-
add_index "checkouts", ["librarian_id"], name: "index_checkouts_on_librarian_id"
|
299
|
-
add_index "checkouts", ["user_id"], name: "index_checkouts_on_user_id"
|
300
|
-
|
301
|
-
create_table "circulation_statuses", force: :cascade do |t|
|
302
|
-
t.string "name", null: false
|
303
|
-
t.text "display_name"
|
304
|
-
t.text "note"
|
305
|
-
t.integer "position"
|
306
|
-
t.datetime "created_at"
|
307
|
-
t.datetime "updated_at"
|
308
|
-
end
|
309
|
-
|
310
211
|
create_table "content_types", force: :cascade do |t|
|
311
212
|
t.string "name", null: false
|
312
213
|
t.text "display_name"
|
@@ -446,16 +347,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
446
347
|
add_index "import_requests", ["manifestation_id"], name: "index_import_requests_on_manifestation_id"
|
447
348
|
add_index "import_requests", ["user_id"], name: "index_import_requests_on_user_id"
|
448
349
|
|
449
|
-
create_table "item_has_use_restrictions", force: :cascade do |t|
|
450
|
-
t.integer "item_id", null: false
|
451
|
-
t.integer "use_restriction_id", null: false
|
452
|
-
t.datetime "created_at"
|
453
|
-
t.datetime "updated_at"
|
454
|
-
end
|
455
|
-
|
456
|
-
add_index "item_has_use_restrictions", ["item_id"], name: "index_item_has_use_restrictions_on_item_id"
|
457
|
-
add_index "item_has_use_restrictions", ["use_restriction_id"], name: "index_item_has_use_restrictions_on_use_restriction_id"
|
458
|
-
|
459
350
|
create_table "items", force: :cascade do |t|
|
460
351
|
t.string "call_number"
|
461
352
|
t.string "item_identifier"
|
@@ -473,8 +364,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
473
364
|
t.datetime "acquired_at"
|
474
365
|
t.integer "bookstore_id"
|
475
366
|
t.integer "budget_type_id"
|
476
|
-
t.integer "circulation_status_id", default: 5, null: false
|
477
|
-
t.integer "checkout_type_id", default: 1, null: false
|
478
367
|
t.string "binding_item_identifier"
|
479
368
|
t.string "binding_call_number"
|
480
369
|
t.datetime "binded_at"
|
@@ -483,8 +372,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
483
372
|
|
484
373
|
add_index "items", ["binding_item_identifier"], name: "index_items_on_binding_item_identifier"
|
485
374
|
add_index "items", ["bookstore_id"], name: "index_items_on_bookstore_id"
|
486
|
-
add_index "items", ["checkout_type_id"], name: "index_items_on_checkout_type_id"
|
487
|
-
add_index "items", ["circulation_status_id"], name: "index_items_on_circulation_status_id"
|
488
375
|
add_index "items", ["item_identifier"], name: "index_items_on_item_identifier"
|
489
376
|
add_index "items", ["manifestation_id"], name: "index_items_on_manifestation_id"
|
490
377
|
add_index "items", ["required_role_id"], name: "index_items_on_required_role_id"
|
@@ -506,21 +393,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
506
393
|
add_index "languages", ["iso_639_3"], name: "index_languages_on_iso_639_3"
|
507
394
|
add_index "languages", ["name"], name: "index_languages_on_name", unique: true
|
508
395
|
|
509
|
-
create_table "lending_policies", force: :cascade do |t|
|
510
|
-
t.integer "item_id", null: false
|
511
|
-
t.integer "user_group_id", null: false
|
512
|
-
t.integer "loan_period", default: 0, null: false
|
513
|
-
t.datetime "fixed_due_date"
|
514
|
-
t.integer "renewal", default: 0, null: false
|
515
|
-
t.integer "fine", default: 0, null: false
|
516
|
-
t.text "note"
|
517
|
-
t.integer "position"
|
518
|
-
t.datetime "created_at"
|
519
|
-
t.datetime "updated_at"
|
520
|
-
end
|
521
|
-
|
522
|
-
add_index "lending_policies", ["item_id", "user_group_id"], name: "index_lending_policies_on_item_id_and_user_group_id", unique: true
|
523
|
-
|
524
396
|
create_table "libraries", force: :cascade do |t|
|
525
397
|
t.string "name", null: false
|
526
398
|
t.text "display_name"
|
@@ -578,19 +450,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
578
450
|
t.datetime "updated_at"
|
579
451
|
end
|
580
452
|
|
581
|
-
create_table "manifestation_checkout_stats", force: :cascade do |t|
|
582
|
-
t.datetime "start_date"
|
583
|
-
t.datetime "end_date"
|
584
|
-
t.text "note"
|
585
|
-
t.string "state"
|
586
|
-
t.datetime "created_at"
|
587
|
-
t.datetime "updated_at"
|
588
|
-
t.datetime "started_at"
|
589
|
-
t.datetime "completed_at"
|
590
|
-
end
|
591
|
-
|
592
|
-
add_index "manifestation_checkout_stats", ["state"], name: "index_manifestation_checkout_stats_on_state"
|
593
|
-
|
594
453
|
create_table "manifestation_relationship_types", force: :cascade do |t|
|
595
454
|
t.string "name", null: false
|
596
455
|
t.text "display_name"
|
@@ -612,19 +471,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
612
471
|
add_index "manifestation_relationships", ["child_id"], name: "index_manifestation_relationships_on_child_id"
|
613
472
|
add_index "manifestation_relationships", ["parent_id"], name: "index_manifestation_relationships_on_parent_id"
|
614
473
|
|
615
|
-
create_table "manifestation_reserve_stats", force: :cascade do |t|
|
616
|
-
t.datetime "start_date"
|
617
|
-
t.datetime "end_date"
|
618
|
-
t.text "note"
|
619
|
-
t.string "state"
|
620
|
-
t.datetime "created_at"
|
621
|
-
t.datetime "updated_at"
|
622
|
-
t.datetime "started_at"
|
623
|
-
t.datetime "completed_at"
|
624
|
-
end
|
625
|
-
|
626
|
-
add_index "manifestation_reserve_stats", ["state"], name: "index_manifestation_reserve_stats_on_state"
|
627
|
-
|
628
474
|
create_table "manifestations", force: :cascade do |t|
|
629
475
|
t.text "original_title", null: false
|
630
476
|
t.text "title_alternative"
|
@@ -657,7 +503,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
657
503
|
t.integer "required_score", default: 0, null: false
|
658
504
|
t.integer "frequency_id", default: 1, null: false
|
659
505
|
t.boolean "subscription_master", default: false, null: false
|
660
|
-
t.string "
|
506
|
+
t.string "attachment_file_name"
|
661
507
|
t.string "attachment_content_type"
|
662
508
|
t.integer "attachment_file_size"
|
663
509
|
t.datetime "attachment_updated_at"
|
@@ -679,7 +525,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
679
525
|
t.text "attachment_meta"
|
680
526
|
t.integer "month_of_publication"
|
681
527
|
t.boolean "fulltext_content"
|
682
|
-
t.string "doi"
|
683
528
|
t.boolean "serial"
|
684
529
|
t.text "statement_of_responsibility"
|
685
530
|
t.text "publication_place"
|
@@ -690,7 +535,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
690
535
|
|
691
536
|
add_index "manifestations", ["access_address"], name: "index_manifestations_on_access_address"
|
692
537
|
add_index "manifestations", ["date_of_publication"], name: "index_manifestations_on_date_of_publication"
|
693
|
-
add_index "manifestations", ["doi"], name: "index_manifestations_on_doi"
|
694
538
|
add_index "manifestations", ["manifestation_identifier"], name: "index_manifestations_on_manifestation_identifier"
|
695
539
|
add_index "manifestations", ["updated_at"], name: "index_manifestations_on_updated_at"
|
696
540
|
|
@@ -790,7 +634,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
790
634
|
t.integer "position"
|
791
635
|
t.datetime "created_at"
|
792
636
|
t.datetime "updated_at"
|
793
|
-
t.string "
|
637
|
+
t.string "picture_file_name"
|
794
638
|
t.string "picture_content_type"
|
795
639
|
t.integer "picture_file_size"
|
796
640
|
t.datetime "picture_updated_at"
|
@@ -880,53 +724,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
880
724
|
t.datetime "updated_at"
|
881
725
|
end
|
882
726
|
|
883
|
-
create_table "reserve_stat_has_manifestations", force: :cascade do |t|
|
884
|
-
t.integer "manifestation_reserve_stat_id", null: false
|
885
|
-
t.integer "manifestation_id", null: false
|
886
|
-
t.integer "reserves_count"
|
887
|
-
t.datetime "created_at"
|
888
|
-
t.datetime "updated_at"
|
889
|
-
end
|
890
|
-
|
891
|
-
add_index "reserve_stat_has_manifestations", ["manifestation_id"], name: "index_reserve_stat_has_manifestations_on_manifestation_id"
|
892
|
-
add_index "reserve_stat_has_manifestations", ["manifestation_reserve_stat_id"], name: "index_reserve_stat_has_manifestations_on_m_reserve_stat_id"
|
893
|
-
|
894
|
-
create_table "reserve_stat_has_users", force: :cascade do |t|
|
895
|
-
t.integer "user_reserve_stat_id", null: false
|
896
|
-
t.integer "user_id", null: false
|
897
|
-
t.integer "reserves_count"
|
898
|
-
t.datetime "created_at"
|
899
|
-
t.datetime "updated_at"
|
900
|
-
end
|
901
|
-
|
902
|
-
add_index "reserve_stat_has_users", ["user_id"], name: "index_reserve_stat_has_users_on_user_id"
|
903
|
-
add_index "reserve_stat_has_users", ["user_reserve_stat_id"], name: "index_reserve_stat_has_users_on_user_reserve_stat_id"
|
904
|
-
|
905
|
-
create_table "reserves", force: :cascade do |t|
|
906
|
-
t.integer "user_id", null: false
|
907
|
-
t.integer "manifestation_id", null: false
|
908
|
-
t.integer "item_id"
|
909
|
-
t.integer "request_status_type_id", null: false
|
910
|
-
t.datetime "checked_out_at"
|
911
|
-
t.datetime "created_at"
|
912
|
-
t.datetime "updated_at"
|
913
|
-
t.datetime "canceled_at"
|
914
|
-
t.datetime "expired_at"
|
915
|
-
t.datetime "deleted_at"
|
916
|
-
t.string "state"
|
917
|
-
t.boolean "expiration_notice_to_patron", default: false
|
918
|
-
t.boolean "expiration_notice_to_library", default: false
|
919
|
-
t.datetime "retained_at"
|
920
|
-
t.datetime "postponed_at"
|
921
|
-
t.integer "lock_version", default: 0, null: false
|
922
|
-
end
|
923
|
-
|
924
|
-
add_index "reserves", ["item_id"], name: "index_reserves_on_item_id"
|
925
|
-
add_index "reserves", ["manifestation_id"], name: "index_reserves_on_manifestation_id"
|
926
|
-
add_index "reserves", ["request_status_type_id"], name: "index_reserves_on_request_status_type_id"
|
927
|
-
add_index "reserves", ["state"], name: "index_reserves_on_state"
|
928
|
-
add_index "reserves", ["user_id"], name: "index_reserves_on_user_id"
|
929
|
-
|
930
727
|
create_table "resource_export_file_transitions", force: :cascade do |t|
|
931
728
|
t.string "to_state"
|
932
729
|
t.text "metadata", default: "{}"
|
@@ -941,6 +738,10 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
941
738
|
|
942
739
|
create_table "resource_export_files", force: :cascade do |t|
|
943
740
|
t.integer "user_id"
|
741
|
+
t.string "resource_export_file_name"
|
742
|
+
t.string "resource_export_content_type"
|
743
|
+
t.integer "resource_export_file_size"
|
744
|
+
t.datetime "resource_export_updated_at"
|
944
745
|
t.datetime "executed_at"
|
945
746
|
t.datetime "created_at"
|
946
747
|
t.datetime "updated_at"
|
@@ -965,7 +766,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
965
766
|
t.integer "user_id"
|
966
767
|
t.text "note"
|
967
768
|
t.datetime "executed_at"
|
968
|
-
t.string "
|
769
|
+
t.string "resource_import_file_name"
|
969
770
|
t.string "resource_import_content_type"
|
970
771
|
t.integer "resource_import_file_size"
|
971
772
|
t.datetime "resource_import_updated_at"
|
@@ -1101,28 +902,6 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1101
902
|
add_index "subscriptions", ["order_list_id"], name: "index_subscriptions_on_order_list_id"
|
1102
903
|
add_index "subscriptions", ["user_id"], name: "index_subscriptions_on_user_id"
|
1103
904
|
|
1104
|
-
create_table "use_restrictions", force: :cascade do |t|
|
1105
|
-
t.string "name", null: false
|
1106
|
-
t.text "display_name"
|
1107
|
-
t.text "note"
|
1108
|
-
t.integer "position"
|
1109
|
-
t.datetime "created_at"
|
1110
|
-
t.datetime "updated_at"
|
1111
|
-
end
|
1112
|
-
|
1113
|
-
create_table "user_checkout_stats", force: :cascade do |t|
|
1114
|
-
t.datetime "start_date"
|
1115
|
-
t.datetime "end_date"
|
1116
|
-
t.text "note"
|
1117
|
-
t.string "state"
|
1118
|
-
t.datetime "created_at"
|
1119
|
-
t.datetime "updated_at"
|
1120
|
-
t.datetime "started_at"
|
1121
|
-
t.datetime "completed_at"
|
1122
|
-
end
|
1123
|
-
|
1124
|
-
add_index "user_checkout_stats", ["state"], name: "index_user_checkout_stats_on_state"
|
1125
|
-
|
1126
905
|
create_table "user_export_file_transitions", force: :cascade do |t|
|
1127
906
|
t.string "to_state"
|
1128
907
|
t.text "metadata", default: "{}"
|
@@ -1137,31 +916,15 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1137
916
|
|
1138
917
|
create_table "user_export_files", force: :cascade do |t|
|
1139
918
|
t.integer "user_id"
|
919
|
+
t.string "user_export_file_name"
|
920
|
+
t.string "user_export_content_type"
|
921
|
+
t.integer "user_export_file_size"
|
922
|
+
t.datetime "user_export_updated_at"
|
1140
923
|
t.datetime "executed_at"
|
1141
924
|
t.datetime "created_at"
|
1142
925
|
t.datetime "updated_at"
|
1143
926
|
end
|
1144
927
|
|
1145
|
-
create_table "user_group_has_checkout_types", force: :cascade do |t|
|
1146
|
-
t.integer "user_group_id", null: false
|
1147
|
-
t.integer "checkout_type_id", null: false
|
1148
|
-
t.integer "checkout_limit", default: 0, null: false
|
1149
|
-
t.integer "checkout_period", default: 0, null: false
|
1150
|
-
t.integer "checkout_renewal_limit", default: 0, null: false
|
1151
|
-
t.integer "reservation_limit", default: 0, null: false
|
1152
|
-
t.integer "reservation_expired_period", default: 7, null: false
|
1153
|
-
t.boolean "set_due_date_before_closing_day", default: false, null: false
|
1154
|
-
t.datetime "fixed_due_date"
|
1155
|
-
t.text "note"
|
1156
|
-
t.integer "position"
|
1157
|
-
t.datetime "created_at"
|
1158
|
-
t.datetime "updated_at"
|
1159
|
-
t.integer "current_checkout_count"
|
1160
|
-
end
|
1161
|
-
|
1162
|
-
add_index "user_group_has_checkout_types", ["checkout_type_id"], name: "index_user_group_has_checkout_types_on_checkout_type_id"
|
1163
|
-
add_index "user_group_has_checkout_types", ["user_group_id"], name: "index_user_group_has_checkout_types_on_user_group_id"
|
1164
|
-
|
1165
928
|
create_table "user_groups", force: :cascade do |t|
|
1166
929
|
t.string "name"
|
1167
930
|
t.text "display_name"
|
@@ -1170,11 +933,8 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1170
933
|
t.datetime "created_at"
|
1171
934
|
t.datetime "updated_at"
|
1172
935
|
t.datetime "deleted_at"
|
1173
|
-
t.integer "valid_period_for_new_user",
|
936
|
+
t.integer "valid_period_for_new_user", default: 0, null: false
|
1174
937
|
t.datetime "expired_at"
|
1175
|
-
t.integer "number_of_day_to_notify_overdue", default: 1, null: false
|
1176
|
-
t.integer "number_of_day_to_notify_due_date", default: 7, null: false
|
1177
|
-
t.integer "number_of_time_to_notify_overdue", default: 3, null: false
|
1178
938
|
end
|
1179
939
|
|
1180
940
|
create_table "user_has_roles", force: :cascade do |t|
|
@@ -1203,7 +963,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1203
963
|
t.integer "user_id"
|
1204
964
|
t.text "note"
|
1205
965
|
t.datetime "executed_at"
|
1206
|
-
t.string "
|
966
|
+
t.string "user_import_file_name"
|
1207
967
|
t.string "user_import_content_type"
|
1208
968
|
t.string "user_import_file_size"
|
1209
969
|
t.datetime "user_import_updated_at"
|
@@ -1225,44 +985,28 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1225
985
|
t.datetime "updated_at"
|
1226
986
|
end
|
1227
987
|
|
1228
|
-
create_table "user_reserve_stats", force: :cascade do |t|
|
1229
|
-
t.datetime "start_date"
|
1230
|
-
t.datetime "end_date"
|
1231
|
-
t.text "note"
|
1232
|
-
t.string "state"
|
1233
|
-
t.datetime "created_at"
|
1234
|
-
t.datetime "updated_at"
|
1235
|
-
t.datetime "started_at"
|
1236
|
-
t.datetime "completed_at"
|
1237
|
-
end
|
1238
|
-
|
1239
|
-
add_index "user_reserve_stats", ["state"], name: "index_user_reserve_stats_on_state"
|
1240
|
-
|
1241
988
|
create_table "users", force: :cascade do |t|
|
1242
|
-
t.string "email",
|
1243
|
-
t.string "encrypted_password",
|
989
|
+
t.string "email", default: "", null: false
|
990
|
+
t.string "encrypted_password", default: "", null: false
|
1244
991
|
t.string "reset_password_token"
|
1245
992
|
t.datetime "reset_password_sent_at"
|
1246
993
|
t.datetime "remember_created_at"
|
1247
|
-
t.integer "sign_in_count",
|
994
|
+
t.integer "sign_in_count", default: 0
|
1248
995
|
t.datetime "current_sign_in_at"
|
1249
996
|
t.datetime "last_sign_in_at"
|
1250
997
|
t.string "current_sign_in_ip"
|
1251
998
|
t.string "last_sign_in_ip"
|
1252
999
|
t.datetime "created_at"
|
1253
1000
|
t.datetime "updated_at"
|
1254
|
-
t.boolean "save_checkout_history", default: false, null: false
|
1255
|
-
t.string "checkout_icalendar_token"
|
1256
1001
|
t.string "username"
|
1257
1002
|
t.datetime "deleted_at"
|
1258
1003
|
t.datetime "expired_at"
|
1259
|
-
t.integer "failed_attempts",
|
1004
|
+
t.integer "failed_attempts", default: 0
|
1260
1005
|
t.string "unlock_token"
|
1261
1006
|
t.datetime "locked_at"
|
1262
1007
|
t.datetime "confirmed_at"
|
1263
1008
|
end
|
1264
1009
|
|
1265
|
-
add_index "users", ["checkout_icalendar_token"], name: "index_users_on_checkout_icalendar_token", unique: true
|
1266
1010
|
add_index "users", ["email"], name: "index_users_on_email"
|
1267
1011
|
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
1268
1012
|
add_index "users", ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
data/spec/models/message_spec.rb
CHANGED
@@ -35,6 +35,11 @@ describe Message do
|
|
35
35
|
message.read?.should be_truthy
|
36
36
|
message.current_state.should eq 'read'
|
37
37
|
end
|
38
|
+
|
39
|
+
it "should require valid recipient" do
|
40
|
+
@message.recipient = 'invalidusername'
|
41
|
+
@message.save.should be_falsy
|
42
|
+
end
|
38
43
|
end
|
39
44
|
|
40
45
|
# == Schema Information
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.14.
|
4
|
+
version: 0.1.14.pre25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosuke Tanabe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_form
|
@@ -522,7 +522,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
522
522
|
version: 1.3.1
|
523
523
|
requirements: []
|
524
524
|
rubyforge_project:
|
525
|
-
rubygems_version: 2.4.5
|
525
|
+
rubygems_version: 2.4.5.1
|
526
526
|
signing_key:
|
527
527
|
specification_version: 4
|
528
528
|
summary: enju_message plugin
|