enju_question 0.2.0 → 0.3.0.beta.1
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.
- checksums.yaml +4 -4
- data/README.rdoc +4 -4
- data/app/assets/config/enju_question_manifest.js +0 -0
- data/app/controllers/answers_controller.rb +1 -1
- data/app/controllers/questions_controller.rb +1 -1
- data/app/models/answer.rb +0 -1
- data/app/models/question.rb +0 -1
- data/db/migrate/098_create_questions.rb +1 -1
- data/db/migrate/099_create_answers.rb +1 -1
- data/db/migrate/20100217054028_create_answer_has_items.rb +1 -1
- data/db/migrate/20120418124018_add_answer_feed_token_to_user.rb +1 -1
- data/lib/enju_question/version.rb +1 -1
- data/spec/controllers/answers_controller_spec.rb +83 -83
- data/spec/controllers/questions_controller_spec.rb +86 -86
- data/spec/dummy/app/models/user.rb +2 -2
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/bin/setup +21 -12
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +8 -17
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +9 -9
- data/spec/dummy/config/environment.rb +4 -4
- data/spec/dummy/config/environments/development.rb +24 -11
- data/spec/dummy/config/environments/production.rb +28 -16
- data/spec/dummy/config/environments/test.rb +6 -8
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +9 -3
- data/spec/dummy/config/initializers/mime_types.rb +0 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +5 -5
- data/spec/dummy/config/locales/en.yml +30 -2
- data/spec/dummy/config/puma.rb +56 -0
- data/spec/dummy/config/secrets.yml +32 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/sunspot.yml +23 -0
- data/spec/dummy/db/migrate/001_create_agents.rb +8 -8
- data/spec/dummy/db/migrate/002_devise_create_users.rb +6 -7
- data/spec/dummy/db/migrate/005_create_manifestations.rb +14 -14
- data/spec/dummy/db/migrate/006_create_items.rb +6 -6
- data/spec/dummy/db/migrate/012_create_owns.rb +3 -3
- data/spec/dummy/db/migrate/015_create_creates.rb +3 -3
- data/spec/dummy/db/migrate/041_create_roles.rb +3 -3
- data/spec/dummy/db/migrate/047_create_produces.rb +3 -3
- data/spec/dummy/db/migrate/055_create_bookmarks.rb +3 -3
- data/spec/dummy/db/migrate/059_create_libraries.rb +8 -8
- data/spec/dummy/db/migrate/069_create_shelves.rb +4 -4
- data/spec/dummy/db/migrate/073_create_carrier_types.rb +2 -2
- data/spec/dummy/db/migrate/077_create_user_groups.rb +2 -2
- data/spec/dummy/db/migrate/080_create_library_groups.rb +3 -3
- data/spec/dummy/db/migrate/112_create_frequencies.rb +2 -2
- data/spec/dummy/db/migrate/117_create_form_of_works.rb +2 -2
- data/spec/dummy/db/migrate/120_create_baskets.rb +2 -2
- data/spec/dummy/db/migrate/124_create_bookstores.rb +2 -2
- data/spec/dummy/db/migrate/125_create_donates.rb +3 -3
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +2 -2
- data/spec/dummy/db/migrate/131_create_request_types.rb +2 -2
- data/spec/dummy/db/migrate/133_create_agent_merges.rb +2 -2
- data/spec/dummy/db/migrate/134_create_agent_merge_lists.rb +1 -1
- data/spec/dummy/db/migrate/149_create_message_templates.rb +6 -6
- data/spec/dummy/db/migrate/154_create_messages.rb +3 -3
- data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +1 -1
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +3 -3
- data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +4 -4
- data/spec/dummy/db/migrate/20080905191442_create_agent_types.rb +2 -2
- data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +4 -4
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +5 -5
- data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +6 -6
- data/spec/dummy/db/migrate/20081025083323_create_countries.rb +9 -10
- data/spec/dummy/db/migrate/20081025083905_create_languages.rb +6 -7
- data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +2 -2
- data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +1 -1
- data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +1 -1
- data/spec/dummy/db/migrate/20081212151614_create_bookmark_stats.rb +1 -4
- data/spec/dummy/db/migrate/20081212151820_create_bookmark_stat_has_manifestations.rb +3 -3
- data/spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb +1 -1
- data/spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20090719201843_create_extents.rb +2 -2
- data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +2 -2
- data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +2 -2
- data/spec/dummy/db/migrate/20090812151902_create_agent_relationship_types.rb +2 -2
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +1 -1
- data/spec/dummy/db/migrate/20091025080447_create_licenses.rb +2 -2
- data/spec/dummy/db/migrate/20091202124834_create_versions.rb +6 -6
- data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +1 -1
- data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +1 -1
- data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +2 -2
- data/spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb +1 -1
- data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +1 -1
- data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +1 -1
- data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +1 -1
- data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +1 -1
- data/spec/dummy/db/migrate/20100606073747_create_agent_relationships.rb +1 -1
- data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +2 -2
- data/spec/dummy/db/migrate/20100814091104_add_position_to_agent_relationship.rb +1 -1
- data/spec/dummy/db/migrate/20100925043847_create_resource_import_results.rb +1 -1
- data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +1 -1
- data/spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb +1 -1
- data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +2 -2
- data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +1 -1
- data/spec/dummy/db/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb +2 -2
- data/spec/dummy/db/migrate/20110603184217_add_edit_mode_to_resource_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20110620173525_add_bookstore_id_to_item.rb +1 -1
- data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +1 -1
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +3 -3
- data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +1 -1
- data/spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +1 -1
- data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +1 -1
- data/spec/dummy/db/migrate/20111124110059_create_create_types.rb +1 -1
- data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +1 -1
- data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +1 -1
- data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +1 -1
- data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +1 -1
- data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +1 -2
- data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +1 -2
- data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +1 -1
- data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +1 -2
- data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +2 -3
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +1 -1
- data/spec/dummy/db/migrate/20120410104851_add_year_of_publication_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb +1 -1
- data/spec/dummy/db/migrate/20120413100352_add_fingerprint_to_picture_file.rb +1 -1
- data/spec/dummy/db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20120413170705_add_error_message_to_resource_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20120415164821_add_attachment_meta_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +2 -2
- data/spec/dummy/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +1 -1
- data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20121116031206_add_fulltext_content_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20121116033446_add_doi_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +4 -4
- data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +1 -1
- data/spec/dummy/db/migrate/20130421093852_add_periodical_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb +1 -1
- data/spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb +1 -1
- data/spec/dummy/db/migrate/20130429020822_add_root_manifestation_id_to_series_statement.rb +1 -1
- data/spec/dummy/db/migrate/20130506175303_create_identifier_types.rb +1 -1
- data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +4 -4
- data/spec/dummy/db/migrate/20130509185724_add_statement_of_responsibility_to_manifestation.rb +1 -1
- data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
- data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +1 -1
- data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +2 -2
- data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +7 -3
- data/spec/dummy/db/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +1 -1
- data/spec/dummy/db/migrate/20140614065404_create_resource_export_files.rb +1 -1
- data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140628072217_add_user_encoding_to_user_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140628073524_add_user_encoding_to_agent_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140628073535_add_user_encoding_to_resource_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +1 -1
- data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140720140916_add_binding_item_identifier_to_item.rb +1 -1
- data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140721151416_add_default_shelf_id_to_resource_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140802082007_add_manifestation_id_to_item.rb +1 -1
- data/spec/dummy/db/migrate/20140811031145_add_expired_at_to_profile.rb +1 -1
- data/spec/dummy/db/migrate/20140812093836_add_share_bookmarks_to_profile.rb +1 -1
- data/spec/dummy/db/migrate/20140821151023_create_colors.rb +1 -1
- data/spec/dummy/db/migrate/20150221063719_add_settings_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +1 -1
- data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +1 -1
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +4 -5
- data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20160815045420_add_most_recent_to_bookmark_stat_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20180107172413_add_constraints_to_most_recent_for_bookmark_stat_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180709023035_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +36 -0
- data/spec/dummy/db/migrate/20180709023036_add_missing_unique_indices.acts_as_taggable_on_engine.rb +26 -0
- data/spec/dummy/db/migrate/20180709023037_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +20 -0
- data/spec/dummy/db/migrate/20180709023038_add_missing_taggable_index.acts_as_taggable_on_engine.rb +15 -0
- data/spec/dummy/db/migrate/20180709023039_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +15 -0
- data/spec/dummy/db/migrate/20180709023040_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +23 -0
- data/spec/dummy/db/schema.rb +673 -724
- data/spec/factories/answer.rb +3 -3
- data/spec/factories/profile.rb +1 -1
- data/spec/factories/question.rb +2 -2
- data/spec/factories/user.rb +1 -1
- data/spec/rails_helper.rb +4 -16
- data/spec/support/controller_macros.rb +3 -3
- metadata +232 -255
- data/spec/dummy/db/migrate/20100525171356_acts_as_taggable_on_migration.rb +0 -30
- data/spec/dummy/db/migrate/20111231145823_add_share_bookmarks_to_user.rb +0 -5
- data/spec/dummy/db/migrate/20140524142813_add_taggings_count_to_tag.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dccb9130426b74dbbd512fc1e5f5c4962a8f7b8
|
4
|
+
data.tar.gz: 8e8eaef3a5e39725a34a863e60fea8d17c58a547
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76dc78c701b4d6693875f30795228d8dd02bbde47177c18e2e2741b32f9c9fb553acf7adf479e60b11851dd07f6569731b10cb40c17882bcb34e7cedc95998b6
|
7
|
+
data.tar.gz: a5c58779c776a56bcf55cf48afc59cb05e88c84bc47d8fb90173e6aadde477f87456d4767d5139fee27e6ab3fa417d132aadc1dd6ff5fe9dc024e6aaa7c78cb1
|
data/README.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
= EnjuQuestion
|
2
|
-
{<img src="https://travis-ci.org/next-l/enju_question.svg?branch=1.
|
3
|
-
{<img src="https://coveralls.io/repos/next-l/enju_question/badge.svg?branch=1.
|
4
|
-
{<img src="https://hakiri.io/github/next-l/enju_question/1.
|
2
|
+
{<img src="https://travis-ci.org/next-l/enju_question.svg?branch=1.3" alt="Build Status" />}[https://travis-ci.org/next-l/enju_question]
|
3
|
+
{<img src="https://coveralls.io/repos/next-l/enju_question/badge.svg?branch=1.3&service=github" alt="Coverage Status" />}[https://coveralls.io/github/next-l/enju_question?branch=1.3]
|
4
|
+
{<img src="https://hakiri.io/github/next-l/enju_question/1.3.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_question/1.3]
|
5
5
|
|
6
6
|
This project rocks and uses MIT-LICENSE.
|
7
7
|
|
8
8
|
== 製作者・貢献者 (Authors and contributors)
|
9
9
|
* {TANABE, Kosuke}[https://github.com/nabeta] ({@nabeta}[https://twitter.com/nabeta])
|
10
|
-
* {Project Next-L}[
|
10
|
+
* {Project Next-L}[https://www.next-l.jp] ({@ProjectNextL}[https://twitter.com/ProjectNextL])
|
File without changes
|
@@ -112,7 +112,7 @@ class AnswersController < ApplicationController
|
|
112
112
|
# PUT /answers/1.json
|
113
113
|
def update
|
114
114
|
respond_to do |format|
|
115
|
-
if @answer.
|
115
|
+
if @answer.update(answer_update_params)
|
116
116
|
flash[:notice] = t('controller.successfully_updated', model: t('activerecord.models.answer'))
|
117
117
|
format.html { redirect_to @answer }
|
118
118
|
format.json { head :no_content }
|
@@ -145,7 +145,7 @@ class QuestionsController < ApplicationController
|
|
145
145
|
# PUT /questions/1.json
|
146
146
|
def update
|
147
147
|
respond_to do |format|
|
148
|
-
if @question.
|
148
|
+
if @question.update(question_params)
|
149
149
|
flash[:notice] = t('controller.successfully_updated', model: t('activerecord.models.question'))
|
150
150
|
format.html { redirect_to @question }
|
151
151
|
format.json { head :no_content }
|
data/app/models/answer.rb
CHANGED
data/app/models/question.rb
CHANGED
@@ -37,24 +37,24 @@ describe AnswersController do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should get to my index if user_id is specified" do
|
40
|
-
get :index, user_id: users(:user1).username
|
40
|
+
get :index, params: { user_id: users(:user1).username }
|
41
41
|
response.should be_success
|
42
42
|
assigns(:answers).should eq users(:user1).answers.order('answers.id DESC').page(1)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should not get other user's index without user_id" do
|
46
|
-
get :index, user_id: users(:user2).username
|
46
|
+
get :index, params: { user_id: users(:user2).username }
|
47
47
|
response.should be_forbidden
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should get my index feed" do
|
51
|
-
get :index, user_id: users(:user1).username, format: 'rss'
|
51
|
+
get :index, params: { user_id: users(:user1).username, format: 'rss' }
|
52
52
|
response.should be_success
|
53
53
|
assigns(:answers).should_not be_empty
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should not get other user's index if question is not shared" do
|
57
|
-
get :index, user_id: users(:librarian1).username, question_id: 2
|
57
|
+
get :index, params: { user_id: users(:librarian1).username, question_id: 2 }
|
58
58
|
response.should be_forbidden
|
59
59
|
end
|
60
60
|
end
|
@@ -67,24 +67,24 @@ describe AnswersController do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should not get index with other user's question_id" do
|
70
|
-
get :index, question_id: 1
|
70
|
+
get :index, params: { question_id: 1 }
|
71
71
|
assigns(:answers).should eq assigns(:question).answers.order('answers.id DESC').page(1)
|
72
72
|
response.should be_success
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should get other user's index if question is shared" do
|
76
|
-
get :index, question_id: 5
|
76
|
+
get :index, params: { question_id: 5 }
|
77
77
|
response.should be_success
|
78
78
|
assigns(:answers).should eq assigns(:question).answers.order('answers.id DESC').page(1)
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should not get other user's index feed if question is not shared" do
|
82
|
-
get :index, question_id: 2, format: 'rss'
|
82
|
+
get :index, params: { question_id: 2, format: 'rss' }
|
83
83
|
response.should be_client_error
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should get other user's index feed if question is shared" do
|
87
|
-
get :index, question_id: 5, format: 'rss'
|
87
|
+
get :index, params: { question_id: 5, format: 'rss' }
|
88
88
|
response.should be_success
|
89
89
|
assigns(:answers).should eq assigns(:question).answers.order('answers.id DESC').page(1)
|
90
90
|
end
|
@@ -96,8 +96,8 @@ describe AnswersController do
|
|
96
96
|
login_fixture_admin
|
97
97
|
|
98
98
|
it "assigns the requested answer as @answer" do
|
99
|
-
answer =
|
100
|
-
get :show, id: answer.id
|
99
|
+
answer = FactoryBot.create(:answer)
|
100
|
+
get :show, params: { id: answer.id }
|
101
101
|
assigns(:answer).should eq(answer)
|
102
102
|
end
|
103
103
|
end
|
@@ -106,8 +106,8 @@ describe AnswersController do
|
|
106
106
|
login_fixture_user
|
107
107
|
|
108
108
|
it "assigns the requested answer as @answer" do
|
109
|
-
answer =
|
110
|
-
get :show, id: answer.id
|
109
|
+
answer = FactoryBot.create(:answer)
|
110
|
+
get :show, params: { id: answer.id }
|
111
111
|
assigns(:answer).should eq(answer)
|
112
112
|
end
|
113
113
|
end
|
@@ -116,67 +116,67 @@ describe AnswersController do
|
|
116
116
|
login_fixture_user
|
117
117
|
|
118
118
|
it "assigns the requested answer as @answer" do
|
119
|
-
answer =
|
120
|
-
get :show, id: answer.id
|
119
|
+
answer = FactoryBot.create(:answer)
|
120
|
+
get :show, params: { id: answer.id }
|
121
121
|
assigns(:answer).should eq(answer)
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should show answer without user_id" do
|
125
|
-
get :show, id: 1, question_id: 1
|
125
|
+
get :show, params: { id: 1, question_id: 1 }
|
126
126
|
assigns(:answer).should eq(answers(:answer_00001))
|
127
127
|
assert_response :success
|
128
128
|
end
|
129
129
|
|
130
130
|
it "should show public answer without question_id" do
|
131
|
-
get :show, id: 3, user_id: users(:user1).username
|
131
|
+
get :show, params: { id: 3, user_id: users(:user1).username }
|
132
132
|
assigns(:answer).should eq(Answer.find(3))
|
133
133
|
assert_response :success
|
134
134
|
end
|
135
135
|
|
136
136
|
it "should show my answer" do
|
137
|
-
get :show, id: 3, user_id: users(:user1).username
|
137
|
+
get :show, params: { id: 3, user_id: users(:user1).username }
|
138
138
|
assigns(:answer).should eq(Answer.find(3))
|
139
139
|
assert_response :success
|
140
140
|
end
|
141
141
|
|
142
142
|
it "should not show private answer" do
|
143
|
-
get :show, id: 4, user_id: users(:user1).username
|
143
|
+
get :show, params: { id: 4, user_id: users(:user1).username }
|
144
144
|
response.should be_forbidden
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should not show missing answer" do
|
148
|
-
lambda{
|
149
|
-
get :show, id: 'missing', user_id: users(:user1).username, question_id: 1
|
148
|
+
lambda {
|
149
|
+
get :show, params: { id: 'missing', user_id: users(:user1).username, question_id: 1 }
|
150
150
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
151
|
-
#response.should be_missing
|
151
|
+
# response.should be_missing
|
152
152
|
end
|
153
153
|
|
154
154
|
it "should not show answer with other user's user_id" do
|
155
|
-
get :show, id: 5, user_id: users(:user2).username, question_id: 2
|
155
|
+
get :show, params: { id: 5, user_id: users(:user2).username, question_id: 2 }
|
156
156
|
response.should be_forbidden
|
157
157
|
end
|
158
158
|
|
159
159
|
it "should not show answer without other user's user_id" do
|
160
|
-
get :show, id: 5, question_id: 2
|
160
|
+
get :show, params: { id: 5, question_id: 2 }
|
161
161
|
response.should be_forbidden
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
165
|
describe "When not logged in" do
|
166
166
|
it "assigns the requested answer as @answer" do
|
167
|
-
answer =
|
168
|
-
get :show, id: answer.id
|
167
|
+
answer = FactoryBot.create(:answer)
|
168
|
+
get :show, params: { id: answer.id }
|
169
169
|
assigns(:answer).should eq(answer)
|
170
170
|
end
|
171
171
|
|
172
172
|
it "should show public_answer" do
|
173
|
-
get :show, id: 1, question_id: 1
|
173
|
+
get :show, params: { id: 1, question_id: 1 }
|
174
174
|
assigns(:answer).should eq(Answer.find(1))
|
175
175
|
response.should be_success
|
176
176
|
end
|
177
177
|
|
178
178
|
it "should not show private answer" do
|
179
|
-
get :show, id: 4, question_id: 1
|
179
|
+
get :show, params: { id: 4, question_id: 1 }
|
180
180
|
assigns(:answer).should eq(Answer.find(4))
|
181
181
|
response.should redirect_to new_user_session_url
|
182
182
|
end
|
@@ -214,7 +214,7 @@ describe AnswersController do
|
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should get new template with question_id" do
|
217
|
-
get :new, question_id: 1
|
217
|
+
get :new, params: { question_id: 1 }
|
218
218
|
assigns(:answer).should_not be_valid
|
219
219
|
response.should be_success
|
220
220
|
end
|
@@ -234,8 +234,8 @@ describe AnswersController do
|
|
234
234
|
login_fixture_admin
|
235
235
|
|
236
236
|
it "assigns the requested answer as @answer" do
|
237
|
-
answer =
|
238
|
-
get :edit, id: answer.id
|
237
|
+
answer = FactoryBot.create(:answer)
|
238
|
+
get :edit, params: { id: answer.id }
|
239
239
|
assigns(:answer).should eq(answer)
|
240
240
|
end
|
241
241
|
end
|
@@ -244,8 +244,8 @@ describe AnswersController do
|
|
244
244
|
login_fixture_user
|
245
245
|
|
246
246
|
it "assigns the requested answer as @answer" do
|
247
|
-
answer =
|
248
|
-
get :edit, id: answer.id
|
247
|
+
answer = FactoryBot.create(:answer)
|
248
|
+
get :edit, params: { id: answer.id }
|
249
249
|
assigns(:answer).should eq(answer)
|
250
250
|
end
|
251
251
|
end
|
@@ -254,48 +254,48 @@ describe AnswersController do
|
|
254
254
|
login_fixture_user
|
255
255
|
|
256
256
|
it "assigns the requested answer as @answer" do
|
257
|
-
answer =
|
258
|
-
get :edit, id: answer.id
|
257
|
+
answer = FactoryBot.create(:answer)
|
258
|
+
get :edit, params: { id: answer.id }
|
259
259
|
response.should be_forbidden
|
260
260
|
end
|
261
261
|
|
262
262
|
it "should edit my answer without user_id" do
|
263
|
-
get :edit, id: 3, question_id: 1
|
263
|
+
get :edit, params: { id: 3, question_id: 1 }
|
264
264
|
response.should be_success
|
265
265
|
end
|
266
|
-
|
266
|
+
|
267
267
|
it "should not edit other answer without user_id" do
|
268
|
-
get :edit, id: 4, question_id: 1
|
268
|
+
get :edit, params: { id: 4, question_id: 1 }
|
269
269
|
response.should be_forbidden
|
270
270
|
end
|
271
|
-
|
271
|
+
|
272
272
|
it "should edit answer without question_id" do
|
273
|
-
get :edit, id: 3
|
273
|
+
get :edit, params: { id: 3, user_id: users(:user1).username }
|
274
274
|
response.should be_success
|
275
275
|
end
|
276
|
-
|
276
|
+
|
277
277
|
it "should not edit missing answer" do
|
278
|
-
lambda{
|
279
|
-
get :edit, id: 100, user_id: users(:user1).username, question_id: 1
|
278
|
+
lambda {
|
279
|
+
get :edit, params: { id: 100, user_id: users(:user1).username, question_id: 1 }
|
280
280
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
281
|
-
#response.should be_missing
|
281
|
+
# response.should be_missing
|
282
282
|
end
|
283
283
|
|
284
284
|
it "should edit my answer" do
|
285
|
-
get :edit, id: 3, user_id: users(:user1).username, question_id: 1
|
285
|
+
get :edit, params: { id: 3, user_id: users(:user1).username, question_id: 1 }
|
286
286
|
response.should be_success
|
287
287
|
end
|
288
|
-
|
288
|
+
|
289
289
|
it "should not edit other user's answer" do
|
290
|
-
get :edit, id: 5, user_id: users(:user2).username, question_id: 2
|
290
|
+
get :edit, params: { id: 5, user_id: users(:user2).username, question_id: 2 }
|
291
291
|
response.should be_forbidden
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
295
295
|
describe "When not logged in" do
|
296
296
|
it "should not assign the requested answer as @answer" do
|
297
|
-
answer =
|
298
|
-
get :edit, id: answer.id
|
297
|
+
answer = FactoryBot.create(:answer)
|
298
|
+
get :edit, params: { id: answer.id }
|
299
299
|
response.should redirect_to(new_user_session_url)
|
300
300
|
end
|
301
301
|
end
|
@@ -303,26 +303,26 @@ describe AnswersController do
|
|
303
303
|
|
304
304
|
describe "POST create" do
|
305
305
|
before(:each) do
|
306
|
-
@attrs =
|
307
|
-
@invalid_attrs = {body: ''}
|
306
|
+
@attrs = FactoryBot.attributes_for(:answer)
|
307
|
+
@invalid_attrs = { body: '' }
|
308
308
|
end
|
309
309
|
|
310
310
|
describe "When logged in as User" do
|
311
311
|
login_fixture_user
|
312
312
|
|
313
313
|
it "should create answer without user_id" do
|
314
|
-
post :create, answer: {question_id: 1, body: 'hoge'}
|
314
|
+
post :create, params: { answer: { question_id: 1, body: 'hoge' } }
|
315
315
|
response.should redirect_to answer_url(assigns(:answer))
|
316
316
|
end
|
317
317
|
|
318
318
|
it "should not create answer without question_id" do
|
319
|
-
post :create, answer: {body: 'hoge'}
|
319
|
+
post :create, params: { answer: { body: 'hoge' } }
|
320
320
|
assigns(:answer).should_not be_valid
|
321
321
|
response.should redirect_to questions_url
|
322
322
|
end
|
323
323
|
|
324
324
|
it "should create answer with question_id" do
|
325
|
-
post :create, answer: {question_id: 1, body: 'hoge'}
|
325
|
+
post :create, params: { answer: { question_id: 1, body: 'hoge' } }
|
326
326
|
assigns(:answer).should be_valid
|
327
327
|
response.should redirect_to answer_url(assigns(:answer))
|
328
328
|
end
|
@@ -331,24 +331,24 @@ describe AnswersController do
|
|
331
331
|
describe "When not logged in" do
|
332
332
|
describe "with valid params" do
|
333
333
|
it "assigns a newly created answer as @answer" do
|
334
|
-
post :create, answer: @attrs
|
334
|
+
post :create, params: { answer: @attrs }
|
335
335
|
assigns(:answer).should be_nil
|
336
336
|
end
|
337
337
|
|
338
338
|
it "redirects to the created answer" do
|
339
|
-
post :create, answer: @attrs
|
339
|
+
post :create, params: { answer: @attrs }
|
340
340
|
response.should redirect_to new_user_session_url
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
344
344
|
describe "with invalid params" do
|
345
345
|
it "assigns a newly created but unsaved answer as @answer" do
|
346
|
-
post :create, answer: @invalid_attrs
|
346
|
+
post :create, params: { answer: @invalid_attrs }
|
347
347
|
assigns(:answer).should be_nil
|
348
348
|
end
|
349
349
|
|
350
350
|
it "re-renders the 'new' template" do
|
351
|
-
post :create, answer: @invalid_attrs
|
351
|
+
post :create, params: { answer: @invalid_attrs }
|
352
352
|
response.should redirect_to new_user_session_url
|
353
353
|
end
|
354
354
|
end
|
@@ -358,8 +358,8 @@ describe AnswersController do
|
|
358
358
|
describe "PUT update" do
|
359
359
|
before(:each) do
|
360
360
|
@answer = answers(:answer_00001)
|
361
|
-
@attrs = {body: 'test'}
|
362
|
-
@invalid_attrs = {body: ''}
|
361
|
+
@attrs = { body: 'test' }
|
362
|
+
@invalid_attrs = { body: '' }
|
363
363
|
end
|
364
364
|
|
365
365
|
describe "When logged in as Administrator" do
|
@@ -367,90 +367,90 @@ describe AnswersController do
|
|
367
367
|
|
368
368
|
describe "with valid params" do
|
369
369
|
it "updates the requested answer" do
|
370
|
-
put :update, id: answers(:answer_00003).id, answer: @attrs
|
370
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @attrs }
|
371
371
|
end
|
372
372
|
|
373
373
|
it "assigns the requested answer as @answer" do
|
374
|
-
put :update, id: answers(:answer_00003).id, answer: @attrs
|
374
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @attrs }
|
375
375
|
assigns(:answer).should eq(Answer.find(3))
|
376
376
|
end
|
377
377
|
end
|
378
378
|
|
379
379
|
describe "with invalid params" do
|
380
380
|
it "assigns the requested answer as @answer" do
|
381
|
-
put :update, id: answers(:answer_00003).id, answer: @invalid_attrs
|
381
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @invalid_attrs }
|
382
382
|
response.should render_template("edit")
|
383
383
|
end
|
384
384
|
end
|
385
385
|
end
|
386
|
-
|
386
|
+
|
387
387
|
describe "When logged in as Librarian" do
|
388
388
|
login_fixture_librarian
|
389
389
|
|
390
390
|
describe "with valid params" do
|
391
391
|
it "updates the requested answer" do
|
392
|
-
put :update, id: answers(:answer_00003).id, answer: @attrs
|
392
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @attrs }
|
393
393
|
end
|
394
394
|
|
395
395
|
it "assigns the requested answer as @answer" do
|
396
|
-
put :update, id: answers(:answer_00003).id, answer: @attrs
|
396
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @attrs }
|
397
397
|
assigns(:answer).should eq(Answer.find(3))
|
398
398
|
end
|
399
399
|
end
|
400
400
|
|
401
401
|
describe "with invalid params" do
|
402
402
|
it "assigns the requested answer as @answer" do
|
403
|
-
put :update, id: answers(:answer_00003).id, answer: @invalid_attrs
|
403
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @invalid_attrs }
|
404
404
|
response.should render_template("edit")
|
405
405
|
end
|
406
406
|
end
|
407
407
|
|
408
408
|
it "should update other user's answer" do
|
409
|
-
put :update, id: 3, answer: {body: 'test'}, user_id: users(:user1).username
|
409
|
+
put :update, params: { id: 3, answer: { body: 'test' }, user_id: users(:user1).username }
|
410
410
|
response.should redirect_to answer_url(assigns(:answer))
|
411
411
|
end
|
412
412
|
end
|
413
|
-
|
413
|
+
|
414
414
|
describe "When logged in as User" do
|
415
415
|
login_fixture_user
|
416
416
|
|
417
417
|
describe "with valid params" do
|
418
418
|
it "updates the requested answer" do
|
419
|
-
put :update, id: answers(:answer_00003).id, answer: @attrs
|
419
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @attrs }
|
420
420
|
end
|
421
421
|
|
422
422
|
it "assigns the requested answer as @answer" do
|
423
|
-
put :update, id: answers(:answer_00003).id, answer: @attrs
|
423
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @attrs }
|
424
424
|
assigns(:answer).should eq(Answer.find(3))
|
425
425
|
end
|
426
426
|
end
|
427
427
|
|
428
428
|
describe "with invalid params" do
|
429
429
|
it "assigns the requested answer as @answer" do
|
430
|
-
put :update, id: answers(:answer_00003).id, answer: @invalid_attrs
|
430
|
+
put :update, params: { id: answers(:answer_00003).id, answer: @invalid_attrs }
|
431
431
|
response.should render_template("edit")
|
432
432
|
end
|
433
433
|
end
|
434
434
|
|
435
435
|
it "should update my answer" do
|
436
|
-
put :update, id: answers(:answer_00003), answer: {body: 'test'}, user_id: users(:user1).username
|
436
|
+
put :update, params: { id: answers(:answer_00003), answer: { body: 'test' }, user_id: users(:user1).username }
|
437
437
|
response.should redirect_to answer_url(assigns(:answer))
|
438
438
|
end
|
439
439
|
|
440
440
|
it "should not update missing answer" do
|
441
|
-
lambda{
|
442
|
-
put :update, id: 'missing', answer: {body: 'test'}, user_id: users(:user1).username
|
441
|
+
lambda {
|
442
|
+
put :update, params: { id: 'missing', answer: { body: 'test' }, user_id: users(:user1).username }
|
443
443
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
444
|
-
#response.should be_missing
|
444
|
+
# response.should be_missing
|
445
445
|
end
|
446
|
-
|
446
|
+
|
447
447
|
it "should not update other user's answer" do
|
448
|
-
put :update, id: 5, answer: {body: 'test'}, user_id: users(:user2).username
|
448
|
+
put :update, params: { id: 5, answer: { body: 'test' }, user_id: users(:user2).username }
|
449
449
|
response.should be_forbidden
|
450
450
|
end
|
451
451
|
|
452
452
|
it "should update my answer with question_id" do
|
453
|
-
put :update, id: 3, answer: {body: 'test'}, user_id: users(:user1).username, question_id: 1
|
453
|
+
put :update, params: { id: 3, answer: { body: 'test' }, user_id: users(:user1).username, question_id: 1 }
|
454
454
|
response.should redirect_to answer_url(assigns(:answer))
|
455
455
|
end
|
456
456
|
end
|
@@ -458,11 +458,11 @@ describe AnswersController do
|
|
458
458
|
describe "When not logged in" do
|
459
459
|
describe "with valid params" do
|
460
460
|
it "updates the requested answer" do
|
461
|
-
put :update, id: @answer.id, answer: @attrs
|
461
|
+
put :update, params: { id: @answer.id, answer: @attrs }
|
462
462
|
end
|
463
463
|
|
464
464
|
it "assigns the requested answer as @answer" do
|
465
|
-
put :update, id: @answer.id, answer: @attrs
|
465
|
+
put :update, params: { id: @answer.id, answer: @attrs }
|
466
466
|
assigns(:answer).should eq(@answer)
|
467
467
|
response.should redirect_to new_user_session_url
|
468
468
|
end
|
@@ -475,19 +475,19 @@ describe AnswersController do
|
|
475
475
|
login_fixture_user
|
476
476
|
|
477
477
|
it "should destroy my answer" do
|
478
|
-
delete :destroy, id: 3
|
478
|
+
delete :destroy, params: { id: 3 }
|
479
479
|
response.should redirect_to question_answers_url(assigns(:answer).question)
|
480
480
|
end
|
481
481
|
|
482
482
|
it "should not destroy other user's answer" do
|
483
|
-
delete :destroy, id: 5
|
483
|
+
delete :destroy, params: { id: 5 }
|
484
484
|
response.should be_forbidden
|
485
485
|
end
|
486
486
|
end
|
487
487
|
|
488
488
|
describe "When not logged in" do
|
489
489
|
it "should be forbidden" do
|
490
|
-
delete :destroy, id: 1
|
490
|
+
delete :destroy, params: { id: 1 }
|
491
491
|
response.should redirect_to new_user_session_url
|
492
492
|
end
|
493
493
|
end
|