enju_purchase_request 0.1.1 → 0.2.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +3 -3
- data/app/controllers/concerns/enju_purchase_request/controller.rb +19 -0
- data/app/controllers/order_lists_controller.rb +13 -3
- data/app/controllers/orders_controller.rb +13 -3
- data/app/controllers/purchase_requests_controller.rb +15 -10
- data/app/models/concerns/enju_purchase_request/enju_user.rb +10 -0
- data/app/models/order.rb +3 -4
- data/app/models/order_list.rb +2 -2
- data/app/models/order_list_transition.rb +5 -4
- data/app/models/purchase_request.rb +7 -8
- data/app/policies/bookstore_policy.rb +23 -0
- data/app/policies/order_list_policy.rb +21 -0
- data/app/policies/order_policy.rb +21 -0
- data/app/policies/purchase_request_policy.rb +25 -0
- data/app/views/orders/index.html.erb +5 -3
- data/app/views/purchase_requests/_index.html.erb +7 -7
- data/app/views/purchase_requests/_index_order_list.html.erb +6 -4
- data/app/views/purchase_requests/show.html.erb +1 -1
- data/db/migrate/20160703190738_add_most_recent_to_order_list_transitions.rb +9 -0
- data/lib/enju_purchase_request/version.rb +1 -1
- data/lib/enju_purchase_request.rb +0 -25
- data/lib/tasks/enju_purchase_request_tasks.rake +8 -0
- data/spec/controllers/order_lists_controller_spec.rb +13 -11
- data/spec/controllers/orders_controller_spec.rb +9 -9
- data/spec/controllers/purchase_requests_controller_spec.rb +4 -4
- data/spec/dummy/app/controllers/application_controller.rb +7 -4
- data/spec/dummy/app/models/user.rb +2 -3
- data/spec/dummy/config/application.rb +7 -24
- data/spec/dummy/config/environments/development.rb +22 -18
- data/spec/dummy/config/environments/production.rb +46 -34
- data/spec/dummy/config/environments/test.rb +21 -14
- data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
- data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
- data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
- data/spec/dummy/db/migrate/20081212151614_create_bookmark_stats.rb +0 -3
- data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
- data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
- data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
- data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +18 -0
- data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +18 -0
- data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -1
- data/spec/dummy/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +5 -1
- data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -1
- data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
- data/spec/dummy/db/migrate/20141013152011_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/spec/dummy/db/migrate/20141013152013_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
- data/spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +5 -0
- data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
- data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160815045420_add_most_recent_to_bookmark_stat_transitions.rb +9 -0
- data/spec/dummy/db/schema.rb +123 -10
- data/spec/fixtures/library_groups.yml +1 -0
- data/spec/fixtures/order_list_transitions.yml +10 -6
- data/spec/fixtures/order_lists.yml +2 -3
- data/spec/fixtures/orders.yml +3 -4
- data/spec/fixtures/purchase_requests.yml +6 -7
- data/spec/models/order_list_spec.rb +3 -4
- data/spec/models/order_spec.rb +4 -6
- data/spec/models/purchase_request_spec.rb +7 -9
- data/spec/rails_helper.rb +53 -0
- data/spec/spec_helper.rb +82 -43
- data/spec/support/devise.rb +2 -2
- metadata +261 -194
- data/app/models/enju_purchase_request/ability.rb +0 -30
- data/lib/enju_purchase_request/user.rb +0 -14
- data/spec/dummy/app/models/ability.rb +0 -30
- data/spec/dummy/app/views/page/403.html.erb +0 -9
- data/spec/dummy/app/views/page/403.mobile.erb +0 -5
- data/spec/dummy/app/views/page/403.xml.erb +0 -4
- data/spec/dummy/app/views/page/404.html.erb +0 -9
- data/spec/dummy/app/views/page/404.mobile.erb +0 -5
- data/spec/dummy/app/views/page/404.xml.erb +0 -4
- data/spec/dummy/config/application.yml +0 -38
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160815045420) do
|
15
15
|
|
16
16
|
create_table "accepts", force: :cascade do |t|
|
17
17
|
t.integer "basket_id"
|
@@ -195,6 +195,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
195
195
|
t.integer "bookmark_stat_id"
|
196
196
|
t.datetime "created_at"
|
197
197
|
t.datetime "updated_at"
|
198
|
+
t.boolean "most_recent"
|
198
199
|
end
|
199
200
|
|
200
201
|
add_index "bookmark_stat_transitions", ["bookmark_stat_id"], name: "index_bookmark_stat_transitions_on_bookmark_stat_id"
|
@@ -206,13 +207,10 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
206
207
|
t.datetime "started_at"
|
207
208
|
t.datetime "completed_at"
|
208
209
|
t.text "note"
|
209
|
-
t.string "state"
|
210
210
|
t.datetime "created_at"
|
211
211
|
t.datetime "updated_at"
|
212
212
|
end
|
213
213
|
|
214
|
-
add_index "bookmark_stats", ["state"], name: "index_bookmark_stats_on_state"
|
215
|
-
|
216
214
|
create_table "bookmarks", force: :cascade do |t|
|
217
215
|
t.integer "user_id", null: false
|
218
216
|
t.integer "manifestation_id"
|
@@ -260,6 +258,17 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
260
258
|
t.datetime "updated_at"
|
261
259
|
end
|
262
260
|
|
261
|
+
create_table "colors", force: :cascade do |t|
|
262
|
+
t.integer "library_group_id"
|
263
|
+
t.string "property"
|
264
|
+
t.string "code"
|
265
|
+
t.integer "position"
|
266
|
+
t.datetime "created_at"
|
267
|
+
t.datetime "updated_at"
|
268
|
+
end
|
269
|
+
|
270
|
+
add_index "colors", ["library_group_id"], name: "index_colors_on_library_group_id"
|
271
|
+
|
263
272
|
create_table "content_types", force: :cascade do |t|
|
264
273
|
t.string "name", null: false
|
265
274
|
t.text "display_name"
|
@@ -475,10 +484,22 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
475
484
|
add_index "libraries", ["library_group_id"], name: "index_libraries_on_library_group_id"
|
476
485
|
add_index "libraries", ["name"], name: "index_libraries_on_name", unique: true
|
477
486
|
|
487
|
+
create_table "library_group_translations", force: :cascade do |t|
|
488
|
+
t.integer "library_group_id", null: false
|
489
|
+
t.string "locale", null: false
|
490
|
+
t.datetime "created_at", null: false
|
491
|
+
t.datetime "updated_at", null: false
|
492
|
+
t.text "login_banner"
|
493
|
+
t.text "footer_banner"
|
494
|
+
end
|
495
|
+
|
496
|
+
add_index "library_group_translations", ["library_group_id"], name: "index_library_group_translations_on_library_group_id"
|
497
|
+
add_index "library_group_translations", ["locale"], name: "index_library_group_translations_on_locale"
|
498
|
+
|
478
499
|
create_table "library_groups", force: :cascade do |t|
|
479
|
-
t.string "name",
|
500
|
+
t.string "name", null: false
|
480
501
|
t.text "display_name"
|
481
|
-
t.string "short_name",
|
502
|
+
t.string "short_name", null: false
|
482
503
|
t.text "my_networks"
|
483
504
|
t.text "login_banner"
|
484
505
|
t.text "note"
|
@@ -487,12 +508,18 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
487
508
|
t.datetime "created_at"
|
488
509
|
t.datetime "updated_at"
|
489
510
|
t.text "admin_networks"
|
490
|
-
t.boolean "allow_bookmark_external_url",
|
491
|
-
t.string "url",
|
511
|
+
t.boolean "allow_bookmark_external_url", default: false, null: false
|
512
|
+
t.string "url", default: "http://localhost:3000/"
|
492
513
|
t.text "settings"
|
514
|
+
t.text "html_snippet"
|
515
|
+
t.integer "max_number_of_results", default: 500
|
516
|
+
t.boolean "family_name_first", default: true
|
517
|
+
t.integer "pub_year_facet_range_interval", default: 10
|
518
|
+
t.integer "user_id"
|
493
519
|
end
|
494
520
|
|
495
521
|
add_index "library_groups", ["short_name"], name: "index_library_groups_on_short_name"
|
522
|
+
add_index "library_groups", ["user_id"], name: "index_library_groups_on_user_id"
|
496
523
|
|
497
524
|
create_table "licenses", force: :cascade do |t|
|
498
525
|
t.string "name", null: false
|
@@ -600,6 +627,75 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
600
627
|
t.datetime "updated_at"
|
601
628
|
end
|
602
629
|
|
630
|
+
create_table "message_request_transitions", force: :cascade do |t|
|
631
|
+
t.string "to_state"
|
632
|
+
t.text "metadata", default: "{}"
|
633
|
+
t.integer "sort_key"
|
634
|
+
t.integer "message_request_id"
|
635
|
+
t.datetime "created_at"
|
636
|
+
t.datetime "updated_at"
|
637
|
+
t.boolean "most_recent"
|
638
|
+
end
|
639
|
+
|
640
|
+
add_index "message_request_transitions", ["message_request_id"], name: "index_message_request_transitions_on_message_request_id"
|
641
|
+
add_index "message_request_transitions", ["sort_key", "message_request_id"], name: "index_message_request_transitions_on_sort_key_and_request_id", unique: true
|
642
|
+
|
643
|
+
create_table "message_requests", force: :cascade do |t|
|
644
|
+
t.integer "sender_id"
|
645
|
+
t.integer "receiver_id"
|
646
|
+
t.integer "message_template_id"
|
647
|
+
t.datetime "sent_at"
|
648
|
+
t.datetime "deleted_at"
|
649
|
+
t.text "body"
|
650
|
+
t.datetime "created_at"
|
651
|
+
t.datetime "updated_at"
|
652
|
+
end
|
653
|
+
|
654
|
+
create_table "message_templates", force: :cascade do |t|
|
655
|
+
t.string "status", null: false
|
656
|
+
t.text "title", null: false
|
657
|
+
t.text "body", null: false
|
658
|
+
t.integer "position"
|
659
|
+
t.string "locale", default: "en"
|
660
|
+
t.datetime "created_at"
|
661
|
+
t.datetime "updated_at"
|
662
|
+
end
|
663
|
+
|
664
|
+
add_index "message_templates", ["status"], name: "index_message_templates_on_status", unique: true
|
665
|
+
|
666
|
+
create_table "message_transitions", force: :cascade do |t|
|
667
|
+
t.string "to_state"
|
668
|
+
t.text "metadata", default: "{}"
|
669
|
+
t.integer "sort_key"
|
670
|
+
t.integer "message_id"
|
671
|
+
t.datetime "created_at"
|
672
|
+
t.datetime "updated_at"
|
673
|
+
t.boolean "most_recent"
|
674
|
+
end
|
675
|
+
|
676
|
+
add_index "message_transitions", ["message_id"], name: "index_message_transitions_on_message_id"
|
677
|
+
add_index "message_transitions", ["sort_key", "message_id"], name: "index_message_transitions_on_sort_key_and_message_id", unique: true
|
678
|
+
|
679
|
+
create_table "messages", force: :cascade do |t|
|
680
|
+
t.datetime "read_at"
|
681
|
+
t.integer "receiver_id"
|
682
|
+
t.integer "sender_id"
|
683
|
+
t.string "subject", null: false
|
684
|
+
t.text "body"
|
685
|
+
t.integer "message_request_id"
|
686
|
+
t.integer "parent_id"
|
687
|
+
t.datetime "created_at"
|
688
|
+
t.datetime "updated_at"
|
689
|
+
t.integer "lft"
|
690
|
+
t.integer "rgt"
|
691
|
+
t.integer "depth"
|
692
|
+
end
|
693
|
+
|
694
|
+
add_index "messages", ["message_request_id"], name: "index_messages_on_message_request_id"
|
695
|
+
add_index "messages", ["parent_id"], name: "index_messages_on_parent_id"
|
696
|
+
add_index "messages", ["receiver_id"], name: "index_messages_on_receiver_id"
|
697
|
+
add_index "messages", ["sender_id"], name: "index_messages_on_sender_id"
|
698
|
+
|
603
699
|
create_table "order_list_transitions", force: :cascade do |t|
|
604
700
|
t.string "to_state"
|
605
701
|
t.text "metadata", default: "{}"
|
@@ -607,6 +703,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
607
703
|
t.integer "order_list_id"
|
608
704
|
t.datetime "created_at"
|
609
705
|
t.datetime "updated_at"
|
706
|
+
t.boolean "most_recent"
|
610
707
|
end
|
611
708
|
|
612
709
|
add_index "order_list_transitions", ["order_list_id"], name: "index_order_list_transitions_on_order_list_id"
|
@@ -956,7 +1053,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
956
1053
|
t.datetime "created_at"
|
957
1054
|
end
|
958
1055
|
|
959
|
-
add_index "taggings", ["tag_id"], name: "
|
1056
|
+
add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
|
960
1057
|
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
961
1058
|
|
962
1059
|
create_table "tags", force: :cascade do |t|
|
@@ -967,6 +1064,8 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
967
1064
|
t.integer "taggings_count", default: 0
|
968
1065
|
end
|
969
1066
|
|
1067
|
+
add_index "tags", ["name"], name: "index_tags_on_name", unique: true
|
1068
|
+
|
970
1069
|
create_table "user_export_file_transitions", force: :cascade do |t|
|
971
1070
|
t.string "to_state"
|
972
1071
|
t.text "metadata", default: "{}"
|
@@ -974,6 +1073,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
974
1073
|
t.integer "user_export_file_id"
|
975
1074
|
t.datetime "created_at"
|
976
1075
|
t.datetime "updated_at"
|
1076
|
+
t.boolean "most_recent"
|
977
1077
|
end
|
978
1078
|
|
979
1079
|
add_index "user_export_file_transitions", ["sort_key", "user_export_file_id"], name: "index_user_export_file_transitions_on_sort_key_and_file_id", unique: true
|
@@ -1019,6 +1119,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1019
1119
|
t.integer "user_import_file_id"
|
1020
1120
|
t.datetime "created_at"
|
1021
1121
|
t.datetime "updated_at"
|
1122
|
+
t.boolean "most_recent"
|
1022
1123
|
end
|
1023
1124
|
|
1024
1125
|
add_index "user_import_file_transitions", ["sort_key", "user_import_file_id"], name: "index_user_import_file_transitions_on_sort_key_and_file_id", unique: true
|
@@ -1030,7 +1131,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1030
1131
|
t.datetime "executed_at"
|
1031
1132
|
t.string "user_import_file_name"
|
1032
1133
|
t.string "user_import_content_type"
|
1033
|
-
t.
|
1134
|
+
t.integer "user_import_file_size"
|
1034
1135
|
t.datetime "user_import_updated_at"
|
1035
1136
|
t.string "user_import_fingerprint"
|
1036
1137
|
t.string "edit_mode"
|
@@ -1048,6 +1149,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1048
1149
|
t.text "body"
|
1049
1150
|
t.datetime "created_at"
|
1050
1151
|
t.datetime "updated_at"
|
1152
|
+
t.text "error_message"
|
1051
1153
|
end
|
1052
1154
|
|
1053
1155
|
create_table "users", force: :cascade do |t|
|
@@ -1089,4 +1191,15 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1089
1191
|
|
1090
1192
|
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
|
1091
1193
|
|
1194
|
+
create_table "withdraws", force: :cascade do |t|
|
1195
|
+
t.integer "basket_id"
|
1196
|
+
t.integer "item_id"
|
1197
|
+
t.integer "librarian_id"
|
1198
|
+
t.datetime "created_at", null: false
|
1199
|
+
t.datetime "updated_at", null: false
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
add_index "withdraws", ["basket_id"], name: "index_withdraws_on_basket_id"
|
1203
|
+
add_index "withdraws", ["item_id"], name: "index_withdraws_on_item_id"
|
1204
|
+
|
1092
1205
|
end
|
@@ -3,26 +3,30 @@ order_list_transition_00001:
|
|
3
3
|
to_state: not_ordered
|
4
4
|
order_list_id: 1
|
5
5
|
sort_key: 0
|
6
|
+
most_recent: true
|
6
7
|
order_list_transition_00002:
|
7
8
|
id: 2
|
8
9
|
to_state: not_ordered
|
9
10
|
order_list_id: 2
|
10
11
|
sort_key: 0
|
12
|
+
most_recent: true
|
11
13
|
order_list_transition_00003:
|
12
14
|
id: 3
|
13
15
|
to_state: not_ordered
|
14
16
|
order_list_id: 3
|
15
17
|
sort_key: 0
|
18
|
+
most_recent: true
|
16
19
|
|
17
20
|
# == Schema Information
|
18
21
|
#
|
19
22
|
# Table name: order_list_transitions
|
20
23
|
#
|
21
|
-
# id
|
22
|
-
# to_state
|
23
|
-
# metadata
|
24
|
-
# sort_key
|
24
|
+
# id :integer not null, primary key
|
25
|
+
# to_state :string
|
26
|
+
# metadata :text default({})
|
27
|
+
# sort_key :integer
|
25
28
|
# order_list_id :integer
|
26
|
-
# created_at
|
27
|
-
# updated_at
|
29
|
+
# created_at :datetime
|
30
|
+
# updated_at :datetime
|
31
|
+
# most_recent :boolean
|
28
32
|
#
|
data/spec/fixtures/orders.yml
CHANGED
@@ -43,8 +43,7 @@ order_00005:
|
|
43
43
|
# order_list_id :integer not null
|
44
44
|
# purchase_request_id :integer not null
|
45
45
|
# position :integer
|
46
|
-
# state :string
|
47
|
-
# created_at :datetime
|
48
|
-
# updated_at :datetime
|
46
|
+
# state :string
|
47
|
+
# created_at :datetime
|
48
|
+
# updated_at :datetime
|
49
49
|
#
|
50
|
-
|
@@ -133,17 +133,16 @@ purchase_request_00006:
|
|
133
133
|
# title :text not null
|
134
134
|
# author :text
|
135
135
|
# publisher :text
|
136
|
-
# isbn :string
|
136
|
+
# isbn :string
|
137
137
|
# date_of_publication :datetime
|
138
138
|
# price :integer
|
139
|
-
# url :string
|
139
|
+
# url :string
|
140
140
|
# note :text
|
141
141
|
# accepted_at :datetime
|
142
142
|
# denied_at :datetime
|
143
|
-
# created_at :datetime
|
144
|
-
# updated_at :datetime
|
143
|
+
# created_at :datetime
|
144
|
+
# updated_at :datetime
|
145
145
|
# deleted_at :datetime
|
146
|
-
# state :string
|
147
|
-
# pub_date :string
|
146
|
+
# state :string
|
147
|
+
# pub_date :string
|
148
148
|
#
|
149
|
-
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'rails_helper'
|
3
2
|
|
4
3
|
describe OrderList do
|
5
4
|
fixtures :all
|
@@ -23,6 +22,6 @@ end
|
|
23
22
|
# note :text
|
24
23
|
# ordered_at :datetime
|
25
24
|
# deleted_at :datetime
|
26
|
-
# created_at :datetime
|
27
|
-
# updated_at :datetime
|
25
|
+
# created_at :datetime
|
26
|
+
# updated_at :datetime
|
28
27
|
#
|
data/spec/models/order_spec.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'rails_helper'
|
3
2
|
|
4
3
|
describe Order do
|
5
4
|
#pending "add some examples to (or delete) #{__FILE__}"
|
@@ -14,8 +13,7 @@ end
|
|
14
13
|
# order_list_id :integer not null
|
15
14
|
# purchase_request_id :integer not null
|
16
15
|
# position :integer
|
17
|
-
# state :string
|
18
|
-
# created_at :datetime
|
19
|
-
# updated_at :datetime
|
16
|
+
# state :string
|
17
|
+
# created_at :datetime
|
18
|
+
# updated_at :datetime
|
20
19
|
#
|
21
|
-
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'rails_helper'
|
3
2
|
|
4
3
|
describe PurchaseRequest do
|
5
4
|
#pending "add some examples to (or delete) #{__FILE__}"
|
@@ -15,17 +14,16 @@ end
|
|
15
14
|
# title :text not null
|
16
15
|
# author :text
|
17
16
|
# publisher :text
|
18
|
-
# isbn :string
|
17
|
+
# isbn :string
|
19
18
|
# date_of_publication :datetime
|
20
19
|
# price :integer
|
21
|
-
# url :string
|
20
|
+
# url :string
|
22
21
|
# note :text
|
23
22
|
# accepted_at :datetime
|
24
23
|
# denied_at :datetime
|
25
|
-
# created_at :datetime
|
26
|
-
# updated_at :datetime
|
24
|
+
# created_at :datetime
|
25
|
+
# updated_at :datetime
|
27
26
|
# deleted_at :datetime
|
28
|
-
# state :string
|
29
|
-
# pub_date :string
|
27
|
+
# state :string
|
28
|
+
# pub_date :string
|
30
29
|
#
|
31
|
-
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
SimpleCov.start 'rails'
|
4
|
+
Coveralls.wear!
|
5
|
+
|
6
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
7
|
+
ENV["RAILS_ENV"] ||= 'test'
|
8
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
9
|
+
require 'rspec/rails'
|
10
|
+
require 'factory_girl'
|
11
|
+
require 'sunspot-rails-tester'
|
12
|
+
|
13
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
14
|
+
# in spec/support/ and its subdirectories.
|
15
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# == Mock Framework
|
19
|
+
#
|
20
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
21
|
+
#
|
22
|
+
# config.mock_with :mocha
|
23
|
+
# config.mock_with :flexmock
|
24
|
+
# config.mock_with :rr
|
25
|
+
config.mock_with :rspec
|
26
|
+
|
27
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
28
|
+
config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
|
29
|
+
|
30
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
31
|
+
# examples within a transaction, remove the following line or assign false
|
32
|
+
# instead of true.
|
33
|
+
config.use_transactional_fixtures = true
|
34
|
+
|
35
|
+
config.extend ControllerMacros, :type => :controller
|
36
|
+
|
37
|
+
$original_sunspot_session = Sunspot.session
|
38
|
+
|
39
|
+
config.before do
|
40
|
+
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
|
41
|
+
end
|
42
|
+
|
43
|
+
config.before :each, :solr => true do
|
44
|
+
Sunspot::Rails::Tester.start_original_sunspot_session
|
45
|
+
Sunspot.session = $original_sunspot_session
|
46
|
+
Sunspot.remove_all!
|
47
|
+
end
|
48
|
+
|
49
|
+
config.infer_spec_type_from_file_location!
|
50
|
+
end
|
51
|
+
|
52
|
+
FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
|
53
|
+
FactoryGirl.find_definitions
|