enju_inter_library_loan 0.1.1 → 0.2.0.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/controllers/inter_library_loans_controller.rb +13 -3
  4. data/app/models/inter_library_loan_transition.rb +1 -0
  5. data/app/policies/inter_library_loan_policy.rb +21 -0
  6. data/app/views/inter_library_loans/index.html.erb +9 -5
  7. data/db/migrate/20160703190932_add_most_recent_to_inter_library_loan_transitions.rb +9 -0
  8. data/lib/enju_inter_library_loan/engine.rb +1 -1
  9. data/lib/enju_inter_library_loan/version.rb +1 -1
  10. data/spec/controllers/inter_library_loans_controller_spec.rb +5 -5
  11. data/spec/dummy/app/controllers/application_controller.rb +4 -3
  12. data/spec/dummy/app/models/user.rb +3 -3
  13. data/spec/dummy/config/application.rb +8 -25
  14. data/spec/dummy/config/environments/development.rb +25 -14
  15. data/spec/dummy/config/environments/production.rb +50 -31
  16. data/spec/dummy/config/environments/test.rb +23 -18
  17. data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
  18. data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
  19. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
  20. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
  21. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
  22. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
  23. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +18 -0
  24. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +18 -0
  25. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  26. data/spec/dummy/db/migrate/20150124152756_add_foreign_key_to_shelves_referencing_libraries.rb +6 -0
  27. data/spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +5 -0
  28. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  29. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  30. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  31. data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
  32. data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
  33. data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
  34. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  35. data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
  36. data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
  37. data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
  38. data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
  39. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  40. data/spec/dummy/db/schema.rb +118 -5
  41. data/spec/dummy/db/test.sqlite3 +0 -0
  42. data/spec/fixtures/inter_library_loan_transitions.yml +1 -0
  43. data/spec/fixtures/library_groups.yml +1 -6
  44. data/spec/fixtures/shelves.yml +46 -0
  45. data/spec/models/inter_library_loan_spec.rb +1 -1
  46. data/spec/rails_helper.rb +53 -0
  47. data/spec/spec_helper.rb +82 -43
  48. metadata +297 -220
  49. data/app/models/enju_inter_library_loan/ability.rb +0 -14
  50. data/spec/dummy/app/models/ability.rb +0 -12
@@ -0,0 +1,5 @@
1
+ class AddErrorMessageToUserImportResult < ActiveRecord::Migration
2
+ def change
3
+ add_column :user_import_results, :error_message, :text
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ class CreateWithdraws < ActiveRecord::Migration
2
+ def change
3
+ create_table :withdraws do |t|
4
+ t.integer :basket_id
5
+ t.integer :item_id
6
+ t.integer :librarian_id
7
+
8
+ t.timestamps null: false
9
+ end
10
+ add_index :withdraws, :basket_id
11
+ add_index :withdraws, :item_id
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class AddTranslationTableToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.create_translation_table!({
4
+ login_banner: :text
5
+ }, {
6
+ migrate_data: true
7
+ })
8
+ end
9
+
10
+ def down
11
+ LibraryGroup.drop_translation_table! migrate_data: true
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ class AddFooterBannerToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.add_translation_fields! footer_banner: :text
4
+ end
5
+
6
+ def down
7
+ remove_column :library_group_translations, :footer_banner
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddHtmlSnippetToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :html_snippet, :text
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToUserImportFileTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :user_import_file_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :user_import_file_transitions, :most_recent
8
+ end
9
+ end
@@ -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
@@ -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: 20160814165332) do
15
15
 
16
16
  create_table "accepts", force: :cascade do |t|
17
17
  t.integer "basket_id"
@@ -309,6 +309,17 @@ ActiveRecord::Schema.define(version: 20150221063719) do
309
309
  t.datetime "updated_at"
310
310
  end
311
311
 
312
+ create_table "colors", force: :cascade do |t|
313
+ t.integer "library_group_id"
314
+ t.string "property"
315
+ t.string "code"
316
+ t.integer "position"
317
+ t.datetime "created_at"
318
+ t.datetime "updated_at"
319
+ end
320
+
321
+ add_index "colors", ["library_group_id"], name: "index_colors_on_library_group_id"
322
+
312
323
  create_table "content_types", force: :cascade do |t|
313
324
  t.string "name", null: false
314
325
  t.text "display_name"
@@ -455,6 +466,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
455
466
  t.integer "inter_library_loan_id"
456
467
  t.datetime "created_at"
457
468
  t.datetime "updated_at"
469
+ t.boolean "most_recent"
458
470
  end
459
471
 
460
472
  add_index "inter_library_loan_transitions", ["inter_library_loan_id"], name: "index_inter_library_loan_transitions_on_inter_library_loan_id"
@@ -581,10 +593,22 @@ ActiveRecord::Schema.define(version: 20150221063719) do
581
593
  add_index "libraries", ["library_group_id"], name: "index_libraries_on_library_group_id"
582
594
  add_index "libraries", ["name"], name: "index_libraries_on_name", unique: true
583
595
 
596
+ create_table "library_group_translations", force: :cascade do |t|
597
+ t.integer "library_group_id", null: false
598
+ t.string "locale", null: false
599
+ t.datetime "created_at", null: false
600
+ t.datetime "updated_at", null: false
601
+ t.text "login_banner"
602
+ t.text "footer_banner"
603
+ end
604
+
605
+ add_index "library_group_translations", ["library_group_id"], name: "index_library_group_translations_on_library_group_id"
606
+ add_index "library_group_translations", ["locale"], name: "index_library_group_translations_on_locale"
607
+
584
608
  create_table "library_groups", force: :cascade do |t|
585
- t.string "name", null: false
609
+ t.string "name", null: false
586
610
  t.text "display_name"
587
- t.string "short_name", null: false
611
+ t.string "short_name", null: false
588
612
  t.text "my_networks"
589
613
  t.text "login_banner"
590
614
  t.text "note"
@@ -593,11 +617,17 @@ ActiveRecord::Schema.define(version: 20150221063719) do
593
617
  t.datetime "created_at"
594
618
  t.datetime "updated_at"
595
619
  t.text "admin_networks"
596
- t.string "url", default: "http://localhost:3000/"
620
+ t.string "url", default: "http://localhost:3000/"
597
621
  t.text "settings"
622
+ t.text "html_snippet"
623
+ t.integer "max_number_of_results", default: 500
624
+ t.boolean "family_name_first", default: true
625
+ t.integer "pub_year_facet_range_interval", default: 10
626
+ t.integer "user_id"
598
627
  end
599
628
 
600
629
  add_index "library_groups", ["short_name"], name: "index_library_groups_on_short_name"
630
+ add_index "library_groups", ["user_id"], name: "index_library_groups_on_user_id"
601
631
 
602
632
  create_table "licenses", force: :cascade do |t|
603
633
  t.string "name", null: false
@@ -756,6 +786,75 @@ ActiveRecord::Schema.define(version: 20150221063719) do
756
786
  t.datetime "updated_at"
757
787
  end
758
788
 
789
+ create_table "message_request_transitions", force: :cascade do |t|
790
+ t.string "to_state"
791
+ t.text "metadata", default: "{}"
792
+ t.integer "sort_key"
793
+ t.integer "message_request_id"
794
+ t.datetime "created_at"
795
+ t.datetime "updated_at"
796
+ t.boolean "most_recent"
797
+ end
798
+
799
+ add_index "message_request_transitions", ["message_request_id"], name: "index_message_request_transitions_on_message_request_id"
800
+ add_index "message_request_transitions", ["sort_key", "message_request_id"], name: "index_message_request_transitions_on_sort_key_and_request_id", unique: true
801
+
802
+ create_table "message_requests", force: :cascade do |t|
803
+ t.integer "sender_id"
804
+ t.integer "receiver_id"
805
+ t.integer "message_template_id"
806
+ t.datetime "sent_at"
807
+ t.datetime "deleted_at"
808
+ t.text "body"
809
+ t.datetime "created_at"
810
+ t.datetime "updated_at"
811
+ end
812
+
813
+ create_table "message_templates", force: :cascade do |t|
814
+ t.string "status", null: false
815
+ t.text "title", null: false
816
+ t.text "body", null: false
817
+ t.integer "position"
818
+ t.string "locale", default: "en"
819
+ t.datetime "created_at"
820
+ t.datetime "updated_at"
821
+ end
822
+
823
+ add_index "message_templates", ["status"], name: "index_message_templates_on_status", unique: true
824
+
825
+ create_table "message_transitions", force: :cascade do |t|
826
+ t.string "to_state"
827
+ t.text "metadata", default: "{}"
828
+ t.integer "sort_key"
829
+ t.integer "message_id"
830
+ t.datetime "created_at"
831
+ t.datetime "updated_at"
832
+ t.boolean "most_recent"
833
+ end
834
+
835
+ add_index "message_transitions", ["message_id"], name: "index_message_transitions_on_message_id"
836
+ add_index "message_transitions", ["sort_key", "message_id"], name: "index_message_transitions_on_sort_key_and_message_id", unique: true
837
+
838
+ create_table "messages", force: :cascade do |t|
839
+ t.datetime "read_at"
840
+ t.integer "receiver_id"
841
+ t.integer "sender_id"
842
+ t.string "subject", null: false
843
+ t.text "body"
844
+ t.integer "message_request_id"
845
+ t.integer "parent_id"
846
+ t.datetime "created_at"
847
+ t.datetime "updated_at"
848
+ t.integer "lft"
849
+ t.integer "rgt"
850
+ t.integer "depth"
851
+ end
852
+
853
+ add_index "messages", ["message_request_id"], name: "index_messages_on_message_request_id"
854
+ add_index "messages", ["parent_id"], name: "index_messages_on_parent_id"
855
+ add_index "messages", ["receiver_id"], name: "index_messages_on_receiver_id"
856
+ add_index "messages", ["sender_id"], name: "index_messages_on_sender_id"
857
+
759
858
  create_table "owns", force: :cascade do |t|
760
859
  t.integer "agent_id", null: false
761
860
  t.integer "item_id", null: false
@@ -1145,6 +1244,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
1145
1244
  t.integer "user_export_file_id"
1146
1245
  t.datetime "created_at"
1147
1246
  t.datetime "updated_at"
1247
+ t.boolean "most_recent"
1148
1248
  end
1149
1249
 
1150
1250
  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
@@ -1213,6 +1313,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
1213
1313
  t.integer "user_import_file_id"
1214
1314
  t.datetime "created_at"
1215
1315
  t.datetime "updated_at"
1316
+ t.boolean "most_recent"
1216
1317
  end
1217
1318
 
1218
1319
  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
@@ -1224,7 +1325,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
1224
1325
  t.datetime "executed_at"
1225
1326
  t.string "user_import_file_name"
1226
1327
  t.string "user_import_content_type"
1227
- t.string "user_import_file_size"
1328
+ t.integer "user_import_file_size"
1228
1329
  t.datetime "user_import_updated_at"
1229
1330
  t.string "user_import_fingerprint"
1230
1331
  t.string "edit_mode"
@@ -1242,6 +1343,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
1242
1343
  t.text "body"
1243
1344
  t.datetime "created_at"
1244
1345
  t.datetime "updated_at"
1346
+ t.text "error_message"
1245
1347
  end
1246
1348
 
1247
1349
  create_table "user_reserve_stat_transitions", force: :cascade do |t|
@@ -1310,4 +1412,15 @@ ActiveRecord::Schema.define(version: 20150221063719) do
1310
1412
 
1311
1413
  add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
1312
1414
 
1415
+ create_table "withdraws", force: :cascade do |t|
1416
+ t.integer "basket_id"
1417
+ t.integer "item_id"
1418
+ t.integer "librarian_id"
1419
+ t.datetime "created_at", null: false
1420
+ t.datetime "updated_at", null: false
1421
+ end
1422
+
1423
+ add_index "withdraws", ["basket_id"], name: "index_withdraws_on_basket_id"
1424
+ add_index "withdraws", ["item_id"], name: "index_withdraws_on_item_id"
1425
+
1313
1426
  end
Binary file
@@ -45,4 +45,5 @@ inter_library_loan_transition_00007:
45
45
  # inter_library_loan_id :integer
46
46
  # created_at :datetime
47
47
  # updated_at :datetime
48
+ # most_recent :boolean
48
49
  #
@@ -7,12 +7,7 @@ one:
7
7
  note:
8
8
  my_networks: 0.0.0.0/0
9
9
  url: "http://localhost:3000/"
10
- settings: <% if Rails::VERSION::MAJOR > 3 %>
11
- "{\"max_number_of_results\":200,\"family_name_first\":true,\"book_jacket_source\":\"google\",\"screenshot_generator\":\"mozshot\"}"
12
- <% else %>
13
- "---\n:max_number_of_results: 200\n:family_name_first: true\n:book_jacket_source: \"google\"\n:screenshot_generator: \"mozshot\""
14
- <% end %>
15
-
10
+ user_id: 1
16
11
 
17
12
  # == Schema Information
18
13
  #
@@ -0,0 +1,46 @@
1
+ ---
2
+ shelf_00001:
3
+ name: web
4
+ display_name: Library bookmark
5
+ id: 1
6
+ note:
7
+ library_id: 1
8
+ position: 1
9
+ shelf_00002:
10
+ name: first_shelf
11
+ display_name: First shelf
12
+ id: 2
13
+ note:
14
+ library_id: 2
15
+ position: 2
16
+ shelf_00003:
17
+ name: second_shelf
18
+ display_name: Second shelf
19
+ id: 3
20
+ note:
21
+ library_id: 2
22
+ position: 3
23
+ shelf_00004:
24
+ name: third_shelf
25
+ display_name: Third shelf
26
+ id: 4
27
+ note:
28
+ library_id: 3
29
+ position: 4
30
+
31
+ # == Schema Information
32
+ #
33
+ # Table name: shelves
34
+ #
35
+ # id :integer not null, primary key
36
+ # name :string not null
37
+ # display_name :text
38
+ # note :text
39
+ # library_id :integer default(1), not null
40
+ # items_count :integer default(0), not null
41
+ # position :integer
42
+ # created_at :datetime
43
+ # updated_at :datetime
44
+ # deleted_at :datetime
45
+ # closed :boolean default(FALSE), not null
46
+ #
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe InterLibraryLoan do
5
5
  #pending "add some examples to (or delete) #{__FILE__}"
@@ -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
data/spec/spec_helper.rb CHANGED
@@ -1,53 +1,92 @@
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
-
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
19
  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
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
26
33
 
27
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
28
- config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = false
41
+ end
29
42
 
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
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
34
52
 
35
- config.extend ControllerMacros, :type => :controller
53
+ # Allows RSpec to persist some state between runs in order to support
54
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
55
+ # you configure your source control system to ignore this file.
56
+ config.example_status_persistence_file_path = "spec/examples.txt"
36
57
 
37
- $original_sunspot_session = Sunspot.session
58
+ # Limits the available syntax to the non-monkey patched syntax that is
59
+ # recommended. For more details, see:
60
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
61
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
63
+ config.disable_monkey_patching!
38
64
 
39
- config.before do
40
- Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
65
+ # Many RSpec users commonly either run the entire suite or an individual
66
+ # file, and it's useful to allow more verbose output when running an
67
+ # individual spec file.
68
+ if config.files_to_run.one?
69
+ # Use the documentation formatter for detailed output,
70
+ # unless a formatter has already been configured
71
+ # (e.g. via a command-line flag).
72
+ config.default_formatter = 'doc'
41
73
  end
42
74
 
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
75
+ # Print the 10 slowest examples and example groups at the
76
+ # end of the spec run, to help surface which specs are running
77
+ # particularly slow.
78
+ config.profile_examples = 10
48
79
 
49
- config.infer_spec_type_from_file_location!
50
- end
80
+ # Run specs in random order to surface order dependencies. If you find an
81
+ # order dependency and want to debug it, you can fix the order by providing
82
+ # the seed, which is printed after each run.
83
+ # --seed 1234
84
+ config.order = :random
51
85
 
52
- FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
53
- FactoryGirl.find_definitions
86
+ # Seed global randomization in this process using the `--seed` CLI option.
87
+ # Setting this allows you to use `--seed` to deterministically reproduce
88
+ # test failures related to randomization by passing the same `--seed` value
89
+ # as the one that triggered the failure.
90
+ Kernel.srand config.seed
91
+ =end
92
+ end