enju_bookmark 0.1.2.pre11 → 0.1.2.pre12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/bookmark_stats/show.csv.erb +1 -1
  3. data/app/views/bookmark_stats/show.html.erb +1 -1
  4. data/lib/enju_bookmark/version.rb +1 -1
  5. data/spec/controllers/bookmarks_controller_spec.rb +4 -2
  6. data/spec/dummy/app/controllers/application_controller.rb +2 -72
  7. data/spec/dummy/app/models/user.rb +5 -24
  8. data/spec/dummy/config/application.rb +2 -3
  9. data/spec/dummy/db/development.sqlite3 +0 -0
  10. data/spec/dummy/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +8 -8
  11. data/spec/dummy/db/migrate/012_create_owns.rb +2 -2
  12. data/spec/dummy/db/migrate/015_create_creates.rb +2 -2
  13. data/spec/dummy/db/migrate/035_create_reserves.rb +1 -1
  14. data/spec/dummy/db/migrate/047_create_produces.rb +2 -2
  15. data/spec/dummy/db/migrate/125_create_donates.rb +2 -2
  16. data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +2 -2
  17. data/spec/dummy/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +2 -2
  18. data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
  19. data/spec/dummy/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +2 -2
  20. data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
  21. data/spec/dummy/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
  22. data/spec/dummy/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
  23. data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
  24. data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
  25. data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -5
  26. data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +6 -11
  27. data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
  28. data/spec/dummy/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
  29. data/spec/dummy/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
  30. data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
  31. data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +26 -0
  32. data/spec/dummy/db/schema.rb +152 -146
  33. data/spec/dummy/db/test.sqlite3 +0 -0
  34. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  35. data/spec/dummy/solr/data/test/index/segments_qx +0 -0
  36. data/spec/factories/library.rb +13 -0
  37. data/spec/factories/user.rb +34 -6
  38. data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
  39. data/spec/fixtures/{patrons.yml → agents.yml} +46 -46
  40. data/spec/fixtures/library_groups.yml +6 -6
  41. data/spec/fixtures/user_groups.yml +51 -0
  42. data/spec/fixtures/users.yml +7 -0
  43. metadata +53 -59
  44. data/spec/dummy/app/models/role.rb +0 -46
  45. data/spec/dummy/app/models/user_group.rb +0 -36
  46. data/spec/dummy/app/models/user_has_role.rb +0 -22
  47. data/spec/dummy/db/migrate/20081028083142_create_patron_import_files.rb +0 -22
  48. data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
  49. data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
  50. data/spec/dummy/db/migrate/20100925074559_create_patron_import_results.rb +0 -12
  51. data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
  52. data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +0 -13
  53. data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +0 -5
  54. data/spec/dummy/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +0 -5
  55. data/spec/dummy/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +0 -9
  56. data/spec/dummy/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +0 -6
  57. data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +0 -5
  58. data/spec/dummy/solr/data/test/index/segments_eq +0 -0
  59. data/spec/fixtures/series_has_manifestations.yml +0 -35
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20121119153944) do
14
+ ActiveRecord::Schema.define(:version => 20130221154434) do
15
15
 
16
16
  create_table "accepts", :force => true do |t|
17
17
  t.integer "basket_id"
@@ -24,6 +24,125 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
24
24
  add_index "accepts", ["basket_id"], :name => "index_accepts_on_basket_id"
25
25
  add_index "accepts", ["item_id"], :name => "index_accepts_on_item_id"
26
26
 
27
+ create_table "agent_import_files", :force => true do |t|
28
+ t.integer "parent_id"
29
+ t.string "content_type"
30
+ t.integer "size"
31
+ t.integer "user_id"
32
+ t.text "note"
33
+ t.datetime "executed_at"
34
+ t.string "state"
35
+ t.string "agent_import_file_name"
36
+ t.string "agent_import_content_type"
37
+ t.integer "agent_import_file_size"
38
+ t.datetime "agent_import_updated_at"
39
+ t.datetime "created_at", :null => false
40
+ t.datetime "updated_at", :null => false
41
+ t.string "agent_import_fingerprint"
42
+ t.text "error_message"
43
+ t.string "edit_mode"
44
+ end
45
+
46
+ add_index "agent_import_files", ["parent_id"], :name => "index_agent_import_files_on_parent_id"
47
+ add_index "agent_import_files", ["state"], :name => "index_agent_import_files_on_state"
48
+ add_index "agent_import_files", ["user_id"], :name => "index_agent_import_files_on_user_id"
49
+
50
+ create_table "agent_import_results", :force => true do |t|
51
+ t.integer "agent_import_file_id"
52
+ t.integer "agent_id"
53
+ t.integer "user_id"
54
+ t.text "body"
55
+ t.datetime "created_at", :null => false
56
+ t.datetime "updated_at", :null => false
57
+ end
58
+
59
+ create_table "agent_relationship_types", :force => true do |t|
60
+ t.string "name", :null => false
61
+ t.text "display_name"
62
+ t.text "note"
63
+ t.integer "position"
64
+ t.datetime "created_at", :null => false
65
+ t.datetime "updated_at", :null => false
66
+ end
67
+
68
+ create_table "agent_relationships", :force => true do |t|
69
+ t.integer "parent_id"
70
+ t.integer "child_id"
71
+ t.integer "agent_relationship_type_id"
72
+ t.datetime "created_at", :null => false
73
+ t.datetime "updated_at", :null => false
74
+ t.integer "position"
75
+ end
76
+
77
+ add_index "agent_relationships", ["child_id"], :name => "index_agent_relationships_on_child_id"
78
+ add_index "agent_relationships", ["parent_id"], :name => "index_agent_relationships_on_parent_id"
79
+
80
+ create_table "agent_types", :force => true do |t|
81
+ t.string "name", :null => false
82
+ t.text "display_name"
83
+ t.text "note"
84
+ t.integer "position"
85
+ t.datetime "created_at", :null => false
86
+ t.datetime "updated_at", :null => false
87
+ end
88
+
89
+ create_table "agents", :force => true do |t|
90
+ t.integer "user_id"
91
+ t.string "last_name"
92
+ t.string "middle_name"
93
+ t.string "first_name"
94
+ t.string "last_name_transcription"
95
+ t.string "middle_name_transcription"
96
+ t.string "first_name_transcription"
97
+ t.string "corporate_name"
98
+ t.string "corporate_name_transcription"
99
+ t.string "full_name"
100
+ t.text "full_name_transcription"
101
+ t.text "full_name_alternative"
102
+ t.datetime "created_at", :null => false
103
+ t.datetime "updated_at", :null => false
104
+ t.datetime "deleted_at"
105
+ t.string "zip_code_1"
106
+ t.string "zip_code_2"
107
+ t.text "address_1"
108
+ t.text "address_2"
109
+ t.text "address_1_note"
110
+ t.text "address_2_note"
111
+ t.string "telephone_number_1"
112
+ t.string "telephone_number_2"
113
+ t.string "fax_number_1"
114
+ t.string "fax_number_2"
115
+ t.text "other_designation"
116
+ t.text "place"
117
+ t.string "postal_code"
118
+ t.text "street"
119
+ t.text "locality"
120
+ t.text "region"
121
+ t.datetime "date_of_birth"
122
+ t.datetime "date_of_death"
123
+ t.integer "language_id", :default => 1, :null => false
124
+ t.integer "country_id", :default => 1, :null => false
125
+ t.integer "agent_type_id", :default => 1, :null => false
126
+ t.integer "lock_version", :default => 0, :null => false
127
+ t.text "note"
128
+ t.integer "required_role_id", :default => 1, :null => false
129
+ t.integer "required_score", :default => 0, :null => false
130
+ t.string "state"
131
+ t.text "email"
132
+ t.text "url"
133
+ t.text "full_name_alternative_transcription"
134
+ t.string "birth_date"
135
+ t.string "death_date"
136
+ t.string "agent_identifier"
137
+ end
138
+
139
+ add_index "agents", ["agent_identifier"], :name => "index_agents_on_agent_identifier"
140
+ add_index "agents", ["country_id"], :name => "index_agents_on_country_id"
141
+ add_index "agents", ["full_name"], :name => "index_agents_on_full_name"
142
+ add_index "agents", ["language_id"], :name => "index_agents_on_language_id"
143
+ add_index "agents", ["required_role_id"], :name => "index_agents_on_required_role_id"
144
+ add_index "agents", ["user_id"], :name => "index_agents_on_user_id", :unique => true
145
+
27
146
  create_table "baskets", :force => true do |t|
28
147
  t.integer "user_id"
29
148
  t.text "note"
@@ -237,7 +356,7 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
237
356
  end
238
357
 
239
358
  create_table "creates", :force => true do |t|
240
- t.integer "patron_id", :null => false
359
+ t.integer "agent_id", :null => false
241
360
  t.integer "work_id", :null => false
242
361
  t.integer "position"
243
362
  t.datetime "created_at", :null => false
@@ -245,18 +364,18 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
245
364
  t.integer "create_type_id"
246
365
  end
247
366
 
248
- add_index "creates", ["patron_id"], :name => "index_creates_on_patron_id"
367
+ add_index "creates", ["agent_id"], :name => "index_creates_on_agent_id"
249
368
  add_index "creates", ["work_id"], :name => "index_creates_on_work_id"
250
369
 
251
370
  create_table "donates", :force => true do |t|
252
- t.integer "patron_id", :null => false
371
+ t.integer "agent_id", :null => false
253
372
  t.integer "item_id", :null => false
254
373
  t.datetime "created_at", :null => false
255
374
  t.datetime "updated_at", :null => false
256
375
  end
257
376
 
377
+ add_index "donates", ["agent_id"], :name => "index_donates_on_agent_id"
258
378
  add_index "donates", ["item_id"], :name => "index_donates_on_item_id"
259
- add_index "donates", ["patron_id"], :name => "index_donates_on_patron_id"
260
379
 
261
380
  create_table "exemplifies", :force => true do |t|
262
381
  t.integer "manifestation_id", :null => false
@@ -565,134 +684,15 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
565
684
  end
566
685
 
567
686
  create_table "owns", :force => true do |t|
568
- t.integer "patron_id", :null => false
687
+ t.integer "agent_id", :null => false
569
688
  t.integer "item_id", :null => false
570
689
  t.integer "position"
571
690
  t.datetime "created_at", :null => false
572
691
  t.datetime "updated_at", :null => false
573
692
  end
574
693
 
694
+ add_index "owns", ["agent_id"], :name => "index_owns_on_agent_id"
575
695
  add_index "owns", ["item_id"], :name => "index_owns_on_item_id"
576
- add_index "owns", ["patron_id"], :name => "index_owns_on_patron_id"
577
-
578
- create_table "patron_import_files", :force => true do |t|
579
- t.integer "parent_id"
580
- t.string "content_type"
581
- t.integer "size"
582
- t.integer "user_id"
583
- t.text "note"
584
- t.datetime "executed_at"
585
- t.string "state"
586
- t.string "patron_import_file_name"
587
- t.string "patron_import_content_type"
588
- t.integer "patron_import_file_size"
589
- t.datetime "patron_import_updated_at"
590
- t.datetime "created_at", :null => false
591
- t.datetime "updated_at", :null => false
592
- t.string "patron_import_fingerprint"
593
- t.text "error_message"
594
- t.string "edit_mode"
595
- end
596
-
597
- add_index "patron_import_files", ["parent_id"], :name => "index_patron_import_files_on_parent_id"
598
- add_index "patron_import_files", ["state"], :name => "index_patron_import_files_on_state"
599
- add_index "patron_import_files", ["user_id"], :name => "index_patron_import_files_on_user_id"
600
-
601
- create_table "patron_import_results", :force => true do |t|
602
- t.integer "patron_import_file_id"
603
- t.integer "patron_id"
604
- t.integer "user_id"
605
- t.text "body"
606
- t.datetime "created_at", :null => false
607
- t.datetime "updated_at", :null => false
608
- end
609
-
610
- create_table "patron_relationship_types", :force => true do |t|
611
- t.string "name", :null => false
612
- t.text "display_name"
613
- t.text "note"
614
- t.integer "position"
615
- t.datetime "created_at", :null => false
616
- t.datetime "updated_at", :null => false
617
- end
618
-
619
- create_table "patron_relationships", :force => true do |t|
620
- t.integer "parent_id"
621
- t.integer "child_id"
622
- t.integer "patron_relationship_type_id"
623
- t.datetime "created_at", :null => false
624
- t.datetime "updated_at", :null => false
625
- t.integer "position"
626
- end
627
-
628
- add_index "patron_relationships", ["child_id"], :name => "index_patron_relationships_on_child_id"
629
- add_index "patron_relationships", ["parent_id"], :name => "index_patron_relationships_on_parent_id"
630
-
631
- create_table "patron_types", :force => true do |t|
632
- t.string "name", :null => false
633
- t.text "display_name"
634
- t.text "note"
635
- t.integer "position"
636
- t.datetime "created_at", :null => false
637
- t.datetime "updated_at", :null => false
638
- end
639
-
640
- create_table "patrons", :force => true do |t|
641
- t.integer "user_id"
642
- t.string "last_name"
643
- t.string "middle_name"
644
- t.string "first_name"
645
- t.string "last_name_transcription"
646
- t.string "middle_name_transcription"
647
- t.string "first_name_transcription"
648
- t.string "corporate_name"
649
- t.string "corporate_name_transcription"
650
- t.string "full_name"
651
- t.text "full_name_transcription"
652
- t.text "full_name_alternative"
653
- t.datetime "created_at", :null => false
654
- t.datetime "updated_at", :null => false
655
- t.datetime "deleted_at"
656
- t.string "zip_code_1"
657
- t.string "zip_code_2"
658
- t.text "address_1"
659
- t.text "address_2"
660
- t.text "address_1_note"
661
- t.text "address_2_note"
662
- t.string "telephone_number_1"
663
- t.string "telephone_number_2"
664
- t.string "fax_number_1"
665
- t.string "fax_number_2"
666
- t.text "other_designation"
667
- t.text "place"
668
- t.string "postal_code"
669
- t.text "street"
670
- t.text "locality"
671
- t.text "region"
672
- t.datetime "date_of_birth"
673
- t.datetime "date_of_death"
674
- t.integer "language_id", :default => 1, :null => false
675
- t.integer "country_id", :default => 1, :null => false
676
- t.integer "patron_type_id", :default => 1, :null => false
677
- t.integer "lock_version", :default => 0, :null => false
678
- t.text "note"
679
- t.integer "required_role_id", :default => 1, :null => false
680
- t.integer "required_score", :default => 0, :null => false
681
- t.string "state"
682
- t.text "email"
683
- t.text "url"
684
- t.text "full_name_alternative_transcription"
685
- t.string "birth_date"
686
- t.string "death_date"
687
- t.string "patron_identifier"
688
- end
689
-
690
- add_index "patrons", ["country_id"], :name => "index_patrons_on_country_id"
691
- add_index "patrons", ["full_name"], :name => "index_patrons_on_full_name"
692
- add_index "patrons", ["language_id"], :name => "index_patrons_on_language_id"
693
- add_index "patrons", ["patron_identifier"], :name => "index_patrons_on_patron_identifier"
694
- add_index "patrons", ["required_role_id"], :name => "index_patrons_on_required_role_id"
695
- add_index "patrons", ["user_id"], :name => "index_patrons_on_user_id", :unique => true
696
696
 
697
697
  create_table "picture_files", :force => true do |t|
698
698
  t.integer "picture_attachable_id"
@@ -723,7 +723,7 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
723
723
  end
724
724
 
725
725
  create_table "produces", :force => true do |t|
726
- t.integer "patron_id", :null => false
726
+ t.integer "agent_id", :null => false
727
727
  t.integer "manifestation_id", :null => false
728
728
  t.integer "position"
729
729
  t.datetime "created_at", :null => false
@@ -731,8 +731,8 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
731
731
  t.integer "produce_type_id"
732
732
  end
733
733
 
734
+ add_index "produces", ["agent_id"], :name => "index_produces_on_agent_id"
734
735
  add_index "produces", ["manifestation_id"], :name => "index_produces_on_manifestation_id"
735
- add_index "produces", ["patron_id"], :name => "index_produces_on_patron_id"
736
736
 
737
737
  create_table "realize_types", :force => true do |t|
738
738
  t.string "name"
@@ -744,7 +744,7 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
744
744
  end
745
745
 
746
746
  create_table "realizes", :force => true do |t|
747
- t.integer "patron_id", :null => false
747
+ t.integer "agent_id", :null => false
748
748
  t.integer "expression_id", :null => false
749
749
  t.integer "position"
750
750
  t.datetime "created_at", :null => false
@@ -752,8 +752,8 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
752
752
  t.integer "realize_type_id"
753
753
  end
754
754
 
755
+ add_index "realizes", ["agent_id"], :name => "index_realizes_on_agent_id"
755
756
  add_index "realizes", ["expression_id"], :name => "index_realizes_on_expression_id"
756
- add_index "realizes", ["patron_id"], :name => "index_realizes_on_patron_id"
757
757
 
758
758
  create_table "request_status_types", :force => true do |t|
759
759
  t.string "name", :null => false
@@ -807,7 +807,7 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
807
807
  t.datetime "expired_at"
808
808
  t.datetime "deleted_at"
809
809
  t.string "state"
810
- t.boolean "expiration_notice_to_patron", :default => false
810
+ t.boolean "expiration_notice_to_agent", :default => false
811
811
  t.boolean "expiration_notice_to_library", :default => false
812
812
  end
813
813
 
@@ -923,12 +923,12 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
923
923
  t.string "series_statement_identifier"
924
924
  t.string "issn"
925
925
  t.boolean "periodical"
926
- t.integer "root_manifestation_id"
926
+ t.integer "manifestation_id"
927
927
  t.text "note"
928
928
  t.text "title_subseries_transcription"
929
929
  end
930
930
 
931
- add_index "series_statements", ["root_manifestation_id"], :name => "index_series_statements_on_manifestation_id"
931
+ add_index "series_statements", ["manifestation_id"], :name => "index_series_statements_on_manifestation_id"
932
932
  add_index "series_statements", ["series_statement_identifier"], :name => "index_series_statements_on_series_statement_identifier"
933
933
 
934
934
  create_table "shelves", :force => true do |t|
@@ -1070,11 +1070,6 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
1070
1070
  add_index "user_reserve_stats", ["state"], :name => "index_user_reserve_stats_on_state"
1071
1071
 
1072
1072
  create_table "users", :force => true do |t|
1073
- t.integer "user_group_id"
1074
- t.integer "required_role_id"
1075
- t.string "username"
1076
- t.text "note"
1077
- t.string "locale"
1078
1073
  t.datetime "created_at", :null => false
1079
1074
  t.datetime "updated_at", :null => false
1080
1075
  t.string "email", :default => "", :null => false
@@ -1087,24 +1082,35 @@ ActiveRecord::Schema.define(:version => 20121119153944) do
1087
1082
  t.datetime "last_sign_in_at"
1088
1083
  t.string "current_sign_in_ip"
1089
1084
  t.string "last_sign_in_ip"
1090
- t.string "password_salt"
1091
- t.string "confirmation_token"
1092
- t.datetime "confirmed_at"
1093
1085
  t.datetime "confirmation_sent_at"
1094
1086
  t.string "unconfirmed_email"
1095
- t.integer "failed_attempts", :default => 0
1096
- t.string "unlock_token"
1097
- t.datetime "locked_at"
1098
- t.string "authentication_token"
1099
- t.datetime "deleted_at"
1100
1087
  t.boolean "save_checkout_history", :default => false, :null => false
1101
1088
  t.string "checkout_icalendar_token"
1102
1089
  t.boolean "share_bookmarks"
1090
+ t.string "username"
1091
+ t.string "user_number"
1092
+ t.string "state"
1093
+ t.string "locale"
1094
+ t.datetime "deleted_at"
1095
+ t.datetime "expired_at"
1096
+ t.integer "library_id", :default => 1, :null => false
1097
+ t.integer "required_role_id", :default => 1, :null => false
1098
+ t.integer "user_group_id", :default => 1, :null => false
1099
+ t.text "note"
1100
+ t.text "keyword_list"
1101
+ t.integer "failed_attempts"
1102
+ t.string "unlock_token"
1103
+ t.datetime "locked_at"
1104
+ t.datetime "confirmed_at"
1103
1105
  end
1104
1106
 
1105
1107
  add_index "users", ["checkout_icalendar_token"], :name => "index_users_on_checkout_icalendar_token", :unique => true
1106
1108
  add_index "users", ["email"], :name => "index_users_on_email"
1107
1109
  add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
1110
+ add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
1111
+ add_index "users", ["user_group_id"], :name => "index_users_on_user_group_id"
1112
+ add_index "users", ["user_number"], :name => "index_users_on_user_number", :unique => true
1113
+ add_index "users", ["username"], :name => "index_users_on_username", :unique => true
1108
1114
 
1109
1115
  create_table "versions", :force => true do |t|
1110
1116
  t.string "item_type", :null => false
Binary file
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+ factory :library do |f|
3
+ f.sequence(:name){|n| "library#{n}"}
4
+ f.sequence(:short_display_name){|n| "library_#{n}"}
5
+ f.library_group_id{LibraryGroup.first.id}
6
+ end
7
+ end
8
+
9
+ FactoryGirl.define do
10
+ factory :invalid_library, :class => Library do |f|
11
+ f.library_group_id{LibraryGroup.first.id}
12
+ end
13
+ end
@@ -2,28 +2,56 @@ FactoryGirl.define do
2
2
  factory :admin, :class => User do |f|
3
3
  f.sequence(:username){|n| "admin_#{n}"}
4
4
  f.sequence(:email){|n| "admin_#{n}@example.jp"}
5
- f.role {Role.find_by_name('Administrator')}
5
+ f.email_confirmation{|u| u.email}
6
+ f.library_id{FactoryGirl.create(:library).id}
6
7
  f.password 'adminpassword'
7
8
  f.password_confirmation 'adminpassword'
8
- f.required_role {Role.find_by_name('User')}
9
+ f.user_group_id{UserGroup.where(:name => 'User').first.id}
10
+ f.required_role_id{Role.find_by_name('User').id}
11
+ f.locale 'ja'
12
+ f.after(:create) do |user|
13
+ user_has_role = UserHasRole.new
14
+ user_has_role.assign_attributes({:user_id => user.id, :role_id => Role.find_by_name('Administrator').id})
15
+ user_has_role.save
16
+ user.reload
17
+ end
9
18
  end
10
19
 
11
20
  factory :librarian, :class => User do |f|
12
21
  f.sequence(:username){|n| "librarian_#{n}"}
13
22
  f.sequence(:email){|n| "librarian_#{n}@example.jp"}
14
- f.role {Role.find_by_name('Librarian')}
23
+ f.email_confirmation{|u| u.email}
24
+ f.library_id{FactoryGirl.create(:library).id}
15
25
  f.password 'librarianpassword'
16
26
  f.password_confirmation 'librarianpassword'
17
- f.required_role {Role.find_by_name('User')}
27
+ f.user_group_id{UserGroup.where(:name => 'User').first.id}
28
+ f.required_role_id{Role.find_by_name('User').id}
29
+ f.locale 'ja'
30
+ f.after(:create) do |user|
31
+ user_has_role = UserHasRole.new
32
+ user_has_role.assign_attributes({:user_id => user.id, :role_id => Role.find_by_name('Librarian').id})
33
+ user_has_role.save
34
+ user.reload
35
+ end
18
36
  end
19
37
 
20
38
  factory :user, :class => User do |f|
21
39
  f.sequence(:username){|n| "user_#{n}"}
22
40
  f.sequence(:email){|n| "user_#{n}@example.jp"}
23
- f.role {Role.find_by_name('User')}
41
+ f.email_confirmation{|u| u.email}
42
+ f.library_id{FactoryGirl.create(:library).id}
24
43
  f.password 'userpassword'
25
44
  f.password_confirmation 'userpassword'
26
- f.required_role {Role.find_by_name('User')}
45
+ f.user_group_id{UserGroup.where(:name => '(not specified)').first.id}
46
+ f.required_role_id{Role.find_by_name('User').id}
47
+ f.locale 'ja'
48
+ f.sequence(:user_number){|n| "user_number_#{n}"}
49
+ f.after(:create) do |user|
50
+ user_has_role = UserHasRole.new
51
+ user_has_role.assign_attributes({:user_id => user.id, :role_id => Role.find_by_name('User').id})
52
+ user_has_role.save
53
+ user.reload
54
+ end
27
55
  end
28
56
 
29
57
  factory :invalid_user, :class => User do |f|
@@ -1,19 +1,19 @@
1
1
  ---
2
- patron_type_00001:
2
+ agent_type_00001:
3
3
  id: 1
4
4
  name: Person
5
5
  display_name: Person
6
6
  note:
7
7
  position: 1
8
8
 
9
- patron_type_00002:
9
+ agent_type_00002:
10
10
  id: 2
11
11
  name: CorporateBody
12
12
  display_name: CorporateBody
13
13
  note:
14
14
  position: 2
15
15
 
16
- patron_type_00003:
16
+ agent_type_00003:
17
17
  id: 3
18
18
  name: Conference
19
19
  display_name: Conference
@@ -22,7 +22,7 @@ patron_type_00003:
22
22
 
23
23
  # == Schema Information
24
24
  #
25
- # Table name: patron_types
25
+ # Table name: agent_types
26
26
  #
27
27
  # id :integer not null, primary key
28
28
  # name :string(255) not null