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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/controllers/concerns/enju_purchase_request/controller.rb +19 -0
  4. data/app/controllers/order_lists_controller.rb +13 -3
  5. data/app/controllers/orders_controller.rb +13 -3
  6. data/app/controllers/purchase_requests_controller.rb +15 -10
  7. data/app/models/concerns/enju_purchase_request/enju_user.rb +10 -0
  8. data/app/models/order.rb +3 -4
  9. data/app/models/order_list.rb +2 -2
  10. data/app/models/order_list_transition.rb +5 -4
  11. data/app/models/purchase_request.rb +7 -8
  12. data/app/policies/bookstore_policy.rb +23 -0
  13. data/app/policies/order_list_policy.rb +21 -0
  14. data/app/policies/order_policy.rb +21 -0
  15. data/app/policies/purchase_request_policy.rb +25 -0
  16. data/app/views/orders/index.html.erb +5 -3
  17. data/app/views/purchase_requests/_index.html.erb +7 -7
  18. data/app/views/purchase_requests/_index_order_list.html.erb +6 -4
  19. data/app/views/purchase_requests/show.html.erb +1 -1
  20. data/db/migrate/20160703190738_add_most_recent_to_order_list_transitions.rb +9 -0
  21. data/lib/enju_purchase_request/version.rb +1 -1
  22. data/lib/enju_purchase_request.rb +0 -25
  23. data/lib/tasks/enju_purchase_request_tasks.rake +8 -0
  24. data/spec/controllers/order_lists_controller_spec.rb +13 -11
  25. data/spec/controllers/orders_controller_spec.rb +9 -9
  26. data/spec/controllers/purchase_requests_controller_spec.rb +4 -4
  27. data/spec/dummy/app/controllers/application_controller.rb +7 -4
  28. data/spec/dummy/app/models/user.rb +2 -3
  29. data/spec/dummy/config/application.rb +7 -24
  30. data/spec/dummy/config/environments/development.rb +22 -18
  31. data/spec/dummy/config/environments/production.rb +46 -34
  32. data/spec/dummy/config/environments/test.rb +21 -14
  33. data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
  34. data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
  35. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
  36. data/spec/dummy/db/migrate/20081212151614_create_bookmark_stats.rb +0 -3
  37. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
  38. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
  39. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
  40. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +18 -0
  41. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +18 -0
  42. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -1
  43. data/spec/dummy/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +5 -1
  44. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -1
  45. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  46. data/spec/dummy/db/migrate/20141013152011_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
  47. data/spec/dummy/db/migrate/20141013152013_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
  48. data/spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +5 -0
  49. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  50. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  51. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  52. data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
  53. data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
  54. data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
  55. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  56. data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
  57. data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
  58. data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
  59. data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
  60. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  61. data/spec/dummy/db/migrate/20160815045420_add_most_recent_to_bookmark_stat_transitions.rb +9 -0
  62. data/spec/dummy/db/schema.rb +123 -10
  63. data/spec/fixtures/library_groups.yml +1 -0
  64. data/spec/fixtures/order_list_transitions.yml +10 -6
  65. data/spec/fixtures/order_lists.yml +2 -3
  66. data/spec/fixtures/orders.yml +3 -4
  67. data/spec/fixtures/purchase_requests.yml +6 -7
  68. data/spec/models/order_list_spec.rb +3 -4
  69. data/spec/models/order_spec.rb +4 -6
  70. data/spec/models/purchase_request_spec.rb +7 -9
  71. data/spec/rails_helper.rb +53 -0
  72. data/spec/spec_helper.rb +82 -43
  73. data/spec/support/devise.rb +2 -2
  74. metadata +261 -194
  75. data/app/models/enju_purchase_request/ability.rb +0 -30
  76. data/lib/enju_purchase_request/user.rb +0 -14
  77. data/spec/dummy/app/models/ability.rb +0 -30
  78. data/spec/dummy/app/views/page/403.html.erb +0 -9
  79. data/spec/dummy/app/views/page/403.mobile.erb +0 -5
  80. data/spec/dummy/app/views/page/403.xml.erb +0 -4
  81. data/spec/dummy/app/views/page/404.html.erb +0 -9
  82. data/spec/dummy/app/views/page/404.mobile.erb +0 -5
  83. data/spec/dummy/app/views/page/404.xml.erb +0 -4
  84. data/spec/dummy/config/application.yml +0 -38
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToUserExportFileTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :user_export_file_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :user_export_file_transitions, :most_recent
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToMessageTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :message_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :message_transitions, :most_recent
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddMaxNumberOfResultsToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :max_number_of_results, :integer, default: 500
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddFamilyNameFirstToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :family_name_first, :boolean, default: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddPubYearFacetRangeIntervalToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :pub_year_facet_range_interval, :integer, default: 10
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddUserIdToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_reference :library_groups, :user, index: true, foreign_key: true
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToMessageRequestTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :message_request_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :message_request_transitions, :most_recent
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToBookmarkStatTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :bookmark_stat_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :bookmark_stat_transitions, :most_recent
8
+ end
9
+ end
@@ -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: 20150221063719) do
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", null: false
500
+ t.string "name", null: false
480
501
  t.text "display_name"
481
- t.string "short_name", null: false
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", default: false, null: false
491
- t.string "url", default: "http://localhost:3000/"
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: "index_taggings_on_tag_id"
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.string "user_import_file_size"
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
@@ -10,6 +10,7 @@ one:
10
10
  position: 1
11
11
  login_banner: "*Next-L Enju*"
12
12
  admin_networks: 0.0.0.0/0
13
+ user_id: 1
13
14
 
14
15
  # == Schema Information
15
16
  #
@@ -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 :integer not null, primary key
22
- # to_state :string(255)
23
- # metadata :text default("{}")
24
- # sort_key :integer
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 :datetime not null
27
- # updated_at :datetime not null
29
+ # created_at :datetime
30
+ # updated_at :datetime
31
+ # most_recent :boolean
28
32
  #
@@ -30,7 +30,6 @@ order_list_00003:
30
30
  # note :text
31
31
  # ordered_at :datetime
32
32
  # deleted_at :datetime
33
- # created_at :datetime not null
34
- # updated_at :datetime not null
33
+ # created_at :datetime
34
+ # updated_at :datetime
35
35
  #
36
-
@@ -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(255)
47
- # created_at :datetime not null
48
- # updated_at :datetime not null
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(255)
136
+ # isbn :string
137
137
  # date_of_publication :datetime
138
138
  # price :integer
139
- # url :string(255)
139
+ # url :string
140
140
  # note :text
141
141
  # accepted_at :datetime
142
142
  # denied_at :datetime
143
- # created_at :datetime not null
144
- # updated_at :datetime not null
143
+ # created_at :datetime
144
+ # updated_at :datetime
145
145
  # deleted_at :datetime
146
- # state :string(255)
147
- # pub_date :string(255)
146
+ # state :string
147
+ # pub_date :string
148
148
  #
149
-
@@ -1,5 +1,4 @@
1
- # -*- encoding: utf-8 -*-
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 not null
27
- # updated_at :datetime not null
25
+ # created_at :datetime
26
+ # updated_at :datetime
28
27
  #
@@ -1,5 +1,4 @@
1
- # -*- encoding: utf-8 -*-
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(255)
18
- # created_at :datetime not null
19
- # updated_at :datetime not null
16
+ # state :string
17
+ # created_at :datetime
18
+ # updated_at :datetime
20
19
  #
21
-
@@ -1,5 +1,4 @@
1
- # -*- encoding: utf-8 -*-
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(255)
17
+ # isbn :string
19
18
  # date_of_publication :datetime
20
19
  # price :integer
21
- # url :string(255)
20
+ # url :string
22
21
  # note :text
23
22
  # accepted_at :datetime
24
23
  # denied_at :datetime
25
- # created_at :datetime not null
26
- # updated_at :datetime not null
24
+ # created_at :datetime
25
+ # updated_at :datetime
27
26
  # deleted_at :datetime
28
- # state :string(255)
29
- # pub_date :string(255)
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