enju_question 0.2.0.beta.2 → 0.2.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/answer.rb +3 -4
  3. data/app/models/answer_has_item.rb +2 -3
  4. data/app/models/question.rb +3 -4
  5. data/lib/enju_question/version.rb +1 -1
  6. data/spec/controllers/answers_controller_spec.rb +1 -1
  7. data/spec/controllers/questions_controller_spec.rb +1 -1
  8. data/spec/dummy/config/application.rb +3 -0
  9. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
  10. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -1
  11. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -1
  12. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  13. data/spec/dummy/db/migrate/20150221063719_add_settings_to_library_group.rb +5 -0
  14. data/spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +5 -0
  15. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  16. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  17. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  18. data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
  19. data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
  20. data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
  21. data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
  22. data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
  23. data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
  24. data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
  25. data/spec/dummy/db/schema.rb +50 -6
  26. data/spec/fixtures/answer_has_items.yml +2 -3
  27. data/spec/fixtures/answers.yml +3 -4
  28. data/spec/fixtures/library_groups.yml +1 -0
  29. data/spec/fixtures/questions.yml +3 -4
  30. data/spec/models/answer_has_item_spec.rb +2 -3
  31. data/spec/models/answer_spec.rb +3 -4
  32. data/spec/models/question_spec.rb +3 -4
  33. data/spec/models/user_spec.rb +61 -0
  34. data/spec/rails_helper.rb +61 -0
  35. data/spec/spec_helper.rb +81 -50
  36. metadata +64 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5fcd03130035e9cb38a20744f417d5d8aabf712d
4
- data.tar.gz: e15ac75fd78a590df1387f64d9329410544ec717
3
+ metadata.gz: 97d134d41ecd6b1a554f57f9586cd6fef24067c8
4
+ data.tar.gz: 37bc415e80c53397c754a0ce94d82e14b91b0c92
5
5
  SHA512:
6
- metadata.gz: 7e5f2692d0ad2a427cc4b6dafd40fdc106b3d43cdd78948e9445deac6f51b13b9a0c30aa8c35ce8412332dbcb471d81c53941c4509d9a77013227baf688a17fe
7
- data.tar.gz: dad5c9365177f6d23bfa8de73c968508ad634299b930e3e665274f01d796342bb67fb6c26199646c64873862a9ba637ecedda466619d76158412bfdd5eb7b99e
6
+ metadata.gz: 94c9b1084e90b309005d319e24d285d4a33b5d11cc5620ff85bc3b8e1d44be7d105c68387e31737081b2c379c8ed391017af46797fabf20d35ba9613b1d90fee
7
+ data.tar.gz: f19469ecff07c7d6550b7e4058f4863c6ebb5229c0a85bf00ddb4a6b81786fbfe13018214f5b36f8f8feae9e6e5167ca7d48e8b24b4e29a92b81158408972e60
data/app/models/answer.rb CHANGED
@@ -46,12 +46,11 @@ end
46
46
  # user_id :integer not null
47
47
  # question_id :integer not null
48
48
  # body :text
49
- # created_at :datetime not null
50
- # updated_at :datetime not null
49
+ # created_at :datetime
50
+ # updated_at :datetime
51
51
  # deleted_at :datetime
52
52
  # shared :boolean default(TRUE), not null
53
- # state :string(255)
53
+ # state :string
54
54
  # item_identifier_list :text
55
55
  # url_list :text
56
56
  #
57
-
@@ -14,7 +14,6 @@ end
14
14
  # answer_id :integer
15
15
  # item_id :integer
16
16
  # position :integer
17
- # created_at :datetime not null
18
- # updated_at :datetime not null
17
+ # created_at :datetime
18
+ # updated_at :datetime
19
19
  #
20
-
@@ -75,10 +75,9 @@ end
75
75
  # shared :boolean default(TRUE), not null
76
76
  # answers_count :integer default(0), not null
77
77
  # deleted_at :datetime
78
- # state :string(255)
78
+ # state :string
79
79
  # solved :boolean default(FALSE), not null
80
80
  # note :text
81
- # created_at :datetime not null
82
- # updated_at :datetime not null
81
+ # created_at :datetime
82
+ # updated_at :datetime
83
83
  #
84
-
@@ -1,3 +1,3 @@
1
1
  module EnjuQuestion
2
- VERSION = "0.2.0.beta.2"
2
+ VERSION = "0.2.0.beta.3"
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe AnswersController do
4
4
  fixtures :all
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe QuestionsController do
4
4
  fixtures :all
@@ -5,6 +5,9 @@ require 'rails/all'
5
5
  Bundler.require(*Rails.groups)
6
6
  require 'enju_question'
7
7
  require 'enju_leaf'
8
+ require 'enju_ndl'
9
+ require 'globalize'
10
+ require 'globalize-accessors'
8
11
 
9
12
  module Dummy
10
13
  class Application < Rails::Application
@@ -6,7 +6,7 @@ class CreateUserImportFiles < ActiveRecord::Migration
6
6
  t.datetime :executed_at
7
7
  t.string :user_import_file_name
8
8
  t.string :user_import_content_type
9
- t.string :user_import_file_size
9
+ t.integer :user_import_file_size
10
10
  t.datetime :user_import_updated_at
11
11
  t.string :user_import_fingerprint
12
12
  t.string :edit_mode
@@ -2,7 +2,11 @@ class CreateUserImportFileTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :user_import_file_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :user_import_file_id
8
12
  t.timestamps
@@ -2,7 +2,11 @@ class CreateUserExportFileTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :user_export_file_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :user_export_file_id
8
12
  t.timestamps
@@ -0,0 +1,14 @@
1
+ class CreateColors < ActiveRecord::Migration
2
+ def change
3
+ create_table :colors do |t|
4
+ t.integer :library_group_id
5
+ t.string :property
6
+ t.string :code
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :colors, :library_group_id
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class AddSettingsToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :settings, :text
4
+ end
5
+ end
@@ -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,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
@@ -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: 20140812093836) do
14
+ ActiveRecord::Schema.define(version: 20160813203039) do
15
15
 
16
16
  create_table "accepts", force: :cascade do |t|
17
17
  t.integer "basket_id"
@@ -289,6 +289,17 @@ ActiveRecord::Schema.define(version: 20140812093836) do
289
289
  t.datetime "updated_at"
290
290
  end
291
291
 
292
+ create_table "colors", force: :cascade do |t|
293
+ t.integer "library_group_id"
294
+ t.string "property"
295
+ t.string "code"
296
+ t.integer "position"
297
+ t.datetime "created_at"
298
+ t.datetime "updated_at"
299
+ end
300
+
301
+ add_index "colors", ["library_group_id"], name: "index_colors_on_library_group_id"
302
+
292
303
  create_table "content_types", force: :cascade do |t|
293
304
  t.string "name", null: false
294
305
  t.text "display_name"
@@ -504,10 +515,22 @@ ActiveRecord::Schema.define(version: 20140812093836) do
504
515
  add_index "libraries", ["library_group_id"], name: "index_libraries_on_library_group_id"
505
516
  add_index "libraries", ["name"], name: "index_libraries_on_name", unique: true
506
517
 
518
+ create_table "library_group_translations", force: :cascade do |t|
519
+ t.integer "library_group_id", null: false
520
+ t.string "locale", null: false
521
+ t.datetime "created_at", null: false
522
+ t.datetime "updated_at", null: false
523
+ t.text "login_banner"
524
+ t.text "footer_banner"
525
+ end
526
+
527
+ add_index "library_group_translations", ["library_group_id"], name: "index_library_group_translations_on_library_group_id"
528
+ add_index "library_group_translations", ["locale"], name: "index_library_group_translations_on_locale"
529
+
507
530
  create_table "library_groups", force: :cascade do |t|
508
- t.string "name", null: false
531
+ t.string "name", null: false
509
532
  t.text "display_name"
510
- t.string "short_name", null: false
533
+ t.string "short_name", null: false
511
534
  t.text "my_networks"
512
535
  t.text "login_banner"
513
536
  t.text "note"
@@ -516,11 +539,18 @@ ActiveRecord::Schema.define(version: 20140812093836) do
516
539
  t.datetime "created_at"
517
540
  t.datetime "updated_at"
518
541
  t.text "admin_networks"
519
- t.boolean "allow_bookmark_external_url", default: false, null: false
520
- t.string "url", default: "http://localhost:3000/"
542
+ t.boolean "allow_bookmark_external_url", default: false, null: false
543
+ t.string "url", default: "http://localhost:3000/"
544
+ t.text "settings"
545
+ t.text "html_snippet"
546
+ t.integer "max_number_of_results", default: 500
547
+ t.boolean "family_name_first", default: true
548
+ t.integer "pub_year_facet_range_interval", default: 10
549
+ t.integer "user_id"
521
550
  end
522
551
 
523
552
  add_index "library_groups", ["short_name"], name: "index_library_groups_on_short_name"
553
+ add_index "library_groups", ["user_id"], name: "index_library_groups_on_user_id"
524
554
 
525
555
  create_table "licenses", force: :cascade do |t|
526
556
  t.string "name", null: false
@@ -956,6 +986,7 @@ ActiveRecord::Schema.define(version: 20140812093836) do
956
986
  t.integer "user_export_file_id"
957
987
  t.datetime "created_at"
958
988
  t.datetime "updated_at"
989
+ t.boolean "most_recent"
959
990
  end
960
991
 
961
992
  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
@@ -1001,6 +1032,7 @@ ActiveRecord::Schema.define(version: 20140812093836) do
1001
1032
  t.integer "user_import_file_id"
1002
1033
  t.datetime "created_at"
1003
1034
  t.datetime "updated_at"
1035
+ t.boolean "most_recent"
1004
1036
  end
1005
1037
 
1006
1038
  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
@@ -1012,7 +1044,7 @@ ActiveRecord::Schema.define(version: 20140812093836) do
1012
1044
  t.datetime "executed_at"
1013
1045
  t.string "user_import_file_name"
1014
1046
  t.string "user_import_content_type"
1015
- t.string "user_import_file_size"
1047
+ t.integer "user_import_file_size"
1016
1048
  t.datetime "user_import_updated_at"
1017
1049
  t.string "user_import_fingerprint"
1018
1050
  t.string "edit_mode"
@@ -1030,6 +1062,7 @@ ActiveRecord::Schema.define(version: 20140812093836) do
1030
1062
  t.text "body"
1031
1063
  t.datetime "created_at"
1032
1064
  t.datetime "updated_at"
1065
+ t.text "error_message"
1033
1066
  end
1034
1067
 
1035
1068
  create_table "users", force: :cascade do |t|
@@ -1073,4 +1106,15 @@ ActiveRecord::Schema.define(version: 20140812093836) do
1073
1106
 
1074
1107
  add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
1075
1108
 
1109
+ create_table "withdraws", force: :cascade do |t|
1110
+ t.integer "basket_id"
1111
+ t.integer "item_id"
1112
+ t.integer "librarian_id"
1113
+ t.datetime "created_at", null: false
1114
+ t.datetime "updated_at", null: false
1115
+ end
1116
+
1117
+ add_index "withdraws", ["basket_id"], name: "index_withdraws_on_basket_id"
1118
+ add_index "withdraws", ["item_id"], name: "index_withdraws_on_item_id"
1119
+
1076
1120
  end
@@ -20,7 +20,6 @@ answer_has_item00002:
20
20
  # answer_id :integer
21
21
  # item_id :integer
22
22
  # position :integer
23
- # created_at :datetime not null
24
- # updated_at :datetime not null
23
+ # created_at :datetime
24
+ # updated_at :datetime
25
25
  #
26
-
@@ -50,12 +50,11 @@ answer_00006:
50
50
  # user_id :integer not null
51
51
  # question_id :integer not null
52
52
  # body :text
53
- # created_at :datetime not null
54
- # updated_at :datetime not null
53
+ # created_at :datetime
54
+ # updated_at :datetime
55
55
  # deleted_at :datetime
56
56
  # shared :boolean default(TRUE), not null
57
- # state :string(255)
57
+ # state :string
58
58
  # item_identifier_list :text
59
59
  # url_list :text
60
60
  #
61
-
@@ -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
  #
@@ -52,10 +52,9 @@ question_00006:
52
52
  # shared :boolean default(TRUE), not null
53
53
  # answers_count :integer default(0), not null
54
54
  # deleted_at :datetime
55
- # state :string(255)
55
+ # state :string
56
56
  # solved :boolean default(FALSE), not null
57
57
  # note :text
58
- # created_at :datetime not null
59
- # updated_at :datetime not null
58
+ # created_at :datetime
59
+ # updated_at :datetime
60
60
  #
61
-
@@ -14,7 +14,6 @@ end
14
14
  # answer_id :integer
15
15
  # item_id :integer
16
16
  # position :integer
17
- # created_at :datetime not null
18
- # updated_at :datetime not null
17
+ # created_at :datetime
18
+ # updated_at :datetime
19
19
  #
20
-
@@ -14,12 +14,11 @@ end
14
14
  # user_id :integer not null
15
15
  # question_id :integer not null
16
16
  # body :text
17
- # created_at :datetime not null
18
- # updated_at :datetime not null
17
+ # created_at :datetime
18
+ # updated_at :datetime
19
19
  # deleted_at :datetime
20
20
  # shared :boolean default(TRUE), not null
21
- # state :string(255)
21
+ # state :string
22
22
  # item_identifier_list :text
23
23
  # url_list :text
24
24
  #
25
-
@@ -27,10 +27,9 @@ end
27
27
  # shared :boolean default(TRUE), not null
28
28
  # answers_count :integer default(0), not null
29
29
  # deleted_at :datetime
30
- # state :string(255)
30
+ # state :string
31
31
  # solved :boolean default(FALSE), not null
32
32
  # note :text
33
- # created_at :datetime not null
34
- # updated_at :datetime not null
33
+ # created_at :datetime
34
+ # updated_at :datetime
35
35
  #
36
-
@@ -0,0 +1,61 @@
1
+ require 'rails_helper'
2
+
3
+ describe User do
4
+ fixtures :all
5
+
6
+ it "should reset answer_feed_token" do
7
+ users(:user1).reset_answer_feed_token
8
+ users(:user1).answer_feed_token.should be_truthy
9
+ end
10
+
11
+ it "should delete answer_feed_token" do
12
+ users(:user1).delete_answer_feed_token
13
+ users(:user1).answer_feed_token.should be_nil
14
+ end
15
+ end
16
+
17
+ # == Schema Information
18
+ #
19
+ # Table name: users
20
+ #
21
+ # id :integer not null, primary key
22
+ # email :string(255) default(""), not null
23
+ # encrypted_password :string(255) default(""), not null
24
+ # reset_password_token :string(255)
25
+ # reset_password_sent_at :datetime
26
+ # remember_created_at :datetime
27
+ # sign_in_count :integer default(0)
28
+ # current_sign_in_at :datetime
29
+ # last_sign_in_at :datetime
30
+ # current_sign_in_ip :string(255)
31
+ # last_sign_in_ip :string(255)
32
+ # password_salt :string(255)
33
+ # confirmation_token :string(255)
34
+ # confirmed_at :datetime
35
+ # confirmation_sent_at :datetime
36
+ # unconfirmed_email :string(255)
37
+ # failed_attempts :integer default(0)
38
+ # unlock_token :string(255)
39
+ # locked_at :datetime
40
+ # authentication_token :string(255)
41
+ # created_at :datetime not null
42
+ # updated_at :datetime not null
43
+ # deleted_at :datetime
44
+ # username :string(255) not null
45
+ # library_id :integer default(1), not null
46
+ # user_group_id :integer default(1), not null
47
+ # expired_at :datetime
48
+ # required_role_id :integer default(1), not null
49
+ # note :text
50
+ # keyword_list :text
51
+ # user_number :string(255)
52
+ # state :string(255)
53
+ # locale :string(255)
54
+ # enju_access_key :string(255)
55
+ # save_checkout_history :boolean default(FALSE), not null
56
+ # checkout_icalendar_token :string(255)
57
+ # share_bookmarks :boolean
58
+ # save_search_history :boolean default(FALSE), not null
59
+ # answer_feed_token :string(255)
60
+ #
61
+
@@ -0,0 +1,61 @@
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 'vcr'
12
+ require 'sunspot-rails-tester'
13
+
14
+ # Requires supporting ruby files with custom matchers and macros, etc,
15
+ # in spec/support/ and its subdirectories.
16
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
17
+
18
+ RSpec.configure do |config|
19
+ # == Mock Framework
20
+ #
21
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
22
+ #
23
+ # config.mock_with :mocha
24
+ # config.mock_with :flexmock
25
+ # config.mock_with :rr
26
+ config.mock_with :rspec
27
+
28
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
29
+ config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
30
+
31
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
32
+ # examples within a transaction, remove the following line or assign false
33
+ # instead of true.
34
+ config.use_transactional_fixtures = true
35
+
36
+ config.extend ControllerMacros, :type => :controller
37
+
38
+ $original_sunspot_session = Sunspot.session
39
+
40
+ config.before do
41
+ Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
42
+ end
43
+
44
+ config.before :each, :solr => true do
45
+ Sunspot::Rails::Tester.start_original_sunspot_session
46
+ Sunspot.session = $original_sunspot_session
47
+ Sunspot.remove_all!
48
+ end
49
+
50
+ config.infer_spec_type_from_file_location!
51
+ end
52
+
53
+ FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
54
+ FactoryGirl.find_definitions
55
+
56
+ VCR.configure do |c|
57
+ c.cassette_library_dir = 'spec/cassette_library'
58
+ c.hook_into :webmock
59
+ c.configure_rspec_metadata!
60
+ c.allow_http_connections_when_no_cassette = true
61
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,61 +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 'vcr'
12
- require 'sunspot-rails-tester'
13
-
14
- # Requires supporting ruby files with custom matchers and macros, etc,
15
- # in spec/support/ and its subdirectories.
16
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
17
-
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
18
19
  RSpec.configure do |config|
19
- # == Mock Framework
20
- #
21
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
22
- #
23
- # config.mock_with :mocha
24
- # config.mock_with :flexmock
25
- # config.mock_with :rr
26
- config.mock_with :rspec
27
-
28
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
29
- config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
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
30
33
 
31
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
32
- # examples within a transaction, remove the following line or assign false
33
- # instead of true.
34
- config.use_transactional_fixtures = true
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
35
42
 
36
- config.extend ControllerMacros, :type => :controller
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
37
52
 
38
- $original_sunspot_session = Sunspot.session
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"
39
57
 
40
- config.before do
41
- Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
42
- end
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!
43
64
 
44
- config.before :each, :solr => true do
45
- Sunspot::Rails::Tester.start_original_sunspot_session
46
- Sunspot.session = $original_sunspot_session
47
- Sunspot.remove_all!
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'
48
73
  end
49
74
 
50
- config.infer_spec_type_from_file_location!
51
- 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
52
79
 
53
- FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
54
- FactoryGirl.find_definitions
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
55
85
 
56
- VCR.configure do |c|
57
- c.cassette_library_dir = 'spec/cassette_library'
58
- c.hook_into :webmock
59
- c.configure_rspec_metadata!
60
- c.allow_http_connections_when_no_cassette = true
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
61
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_question
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.beta.2
4
+ version: 0.2.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-12 00:00:00.000000000 Z
11
+ date: 2016-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: enju_bookmark
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0.beta.2
19
+ version: 0.2.0.beta.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.0.beta.2
26
+ version: 0.2.0.beta.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: acts-as-taggable-on
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.0.beta.1
61
+ version: 0.2.0.beta.2
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.0.beta.1
68
+ version: 0.2.0.beta.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: globalize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: globalize-accessors
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: sqlite3
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -459,6 +487,19 @@ files:
459
487
  - spec/dummy/db/migrate/20140802082007_add_manifestation_id_to_item.rb
460
488
  - spec/dummy/db/migrate/20140811031145_add_expired_at_to_profile.rb
461
489
  - spec/dummy/db/migrate/20140812093836_add_share_bookmarks_to_profile.rb
490
+ - spec/dummy/db/migrate/20140821151023_create_colors.rb
491
+ - spec/dummy/db/migrate/20150221063719_add_settings_to_library_group.rb
492
+ - spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb
493
+ - spec/dummy/db/migrate/20150924115059_create_withdraws.rb
494
+ - spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb
495
+ - spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb
496
+ - spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb
497
+ - spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb
498
+ - spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb
499
+ - spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb
500
+ - spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb
501
+ - spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb
502
+ - spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb
462
503
  - spec/dummy/db/schema.rb
463
504
  - spec/dummy/public/404.html
464
505
  - spec/dummy/public/422.html
@@ -481,6 +522,8 @@ files:
481
522
  - spec/models/answer_has_item_spec.rb
482
523
  - spec/models/answer_spec.rb
483
524
  - spec/models/question_spec.rb
525
+ - spec/models/user_spec.rb
526
+ - spec/rails_helper.rb
484
527
  - spec/spec_helper.rb
485
528
  - spec/support/controller_macros.rb
486
529
  - spec/support/devise.rb
@@ -674,6 +717,19 @@ test_files:
674
717
  - spec/dummy/db/migrate/20140802082007_add_manifestation_id_to_item.rb
675
718
  - spec/dummy/db/migrate/20140811031145_add_expired_at_to_profile.rb
676
719
  - spec/dummy/db/migrate/20140812093836_add_share_bookmarks_to_profile.rb
720
+ - spec/dummy/db/migrate/20140821151023_create_colors.rb
721
+ - spec/dummy/db/migrate/20150221063719_add_settings_to_library_group.rb
722
+ - spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb
723
+ - spec/dummy/db/migrate/20150924115059_create_withdraws.rb
724
+ - spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb
725
+ - spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb
726
+ - spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb
727
+ - spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb
728
+ - spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb
729
+ - spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb
730
+ - spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb
731
+ - spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb
732
+ - spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb
677
733
  - spec/dummy/db/schema.rb
678
734
  - spec/dummy/public/404.html
679
735
  - spec/dummy/public/422.html
@@ -697,6 +753,8 @@ test_files:
697
753
  - spec/models/answer_has_item_spec.rb
698
754
  - spec/models/answer_spec.rb
699
755
  - spec/models/question_spec.rb
756
+ - spec/models/user_spec.rb
757
+ - spec/rails_helper.rb
700
758
  - spec/spec_helper.rb
701
759
  - spec/support/controller_macros.rb
702
760
  - spec/support/devise.rb