enju_leaf 1.1.0.rc12 → 1.1.0.rc13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/enju.css +0 -1
- data/app/controllers/my_accounts_controller.rb +26 -18
- data/app/controllers/page_controller.rb +6 -6
- data/app/controllers/profiles_controller.rb +155 -0
- data/app/controllers/roles_controller.rb +5 -5
- data/app/controllers/user_export_files_controller.rb +100 -0
- data/app/controllers/user_groups_controller.rb +11 -11
- data/app/controllers/user_import_files_controller.rb +22 -11
- data/app/controllers/user_import_results_controller.rb +1 -1
- data/app/mailers/notifier.rb +7 -7
- data/app/models/enju_leaf/ability.rb +14 -13
- data/app/models/profile.rb +63 -16
- data/app/models/role.rb +2 -2
- data/app/models/user_export_file.rb +52 -0
- data/app/models/user_export_file_state_machine.rb +15 -0
- data/app/models/user_export_file_transition.rb +20 -0
- data/app/models/user_group.rb +3 -3
- data/app/models/user_has_role.rb +2 -2
- data/app/models/user_import_file.rb +139 -53
- data/app/views/kaminari/_first_page.html.erb +1 -1
- data/app/views/kaminari/_last_page.html.erb +1 -1
- data/app/views/kaminari/_next_page.html.erb +1 -1
- data/app/views/kaminari/_page.html.erb +1 -1
- data/app/views/kaminari/_prev_page.html.erb +1 -1
- data/app/views/kaminari/enju_leaf_mobile/_next_page.html.erb +1 -1
- data/app/views/kaminari/enju_leaf_mobile/_page.html.erb +1 -1
- data/app/views/kaminari/enju_leaf_mobile/_prev_page.html.erb +1 -1
- data/app/views/layouts/application.html.erb +4 -4
- data/app/views/my_accounts/_edit_credential.html.erb +67 -59
- data/app/views/my_accounts/edit.html.erb +6 -46
- data/app/views/my_accounts/show.html.erb +8 -8
- data/app/views/page/_add.html.erb +2 -2
- data/app/views/page/_footer.html.erb +3 -2
- data/app/views/page/_footer.mobile.erb +1 -1
- data/app/views/page/_header.html.erb +4 -4
- data/app/views/page/_include.html.erb +1 -1
- data/app/views/page/_index.html.erb +8 -8
- data/app/views/page/_index.mobile.erb +4 -4
- data/app/views/page/_menu.html.erb +9 -6
- data/app/views/page/_msie_acceralator.html.erb +1 -1
- data/app/views/page/_position.html.erb +2 -2
- data/app/views/page/_search_form.html.erb +2 -2
- data/app/views/page/_search_form.mobile.erb +2 -2
- data/app/views/page/_select_locale.html.erb +2 -2
- data/app/views/page/about.en.html.erb +2 -2
- data/app/views/page/about.ja.html.erb +2 -2
- data/app/views/page/advanced_search.html.erb +8 -8
- data/app/views/page/configuration.html.erb +5 -3
- data/app/views/page/export.html.erb +7 -17
- data/app/views/page/import.html.erb +1 -4
- data/app/views/page/index.html.erb +2 -2
- data/app/views/page/msie_acceralator.builder +1 -1
- data/app/views/page/opensearch.builder +2 -2
- data/app/views/profiles/_edit_credential.html.erb +78 -0
- data/app/views/profiles/_edit_profile.html.erb +42 -0
- data/app/views/{users → profiles}/_form.html.erb +0 -0
- data/app/views/{users → profiles}/_show.html.erb +0 -0
- data/app/views/profiles/edit.html.erb +36 -0
- data/app/views/profiles/index.html.erb +61 -0
- data/app/views/{users → profiles}/new.html.erb +34 -36
- data/app/views/{users → profiles}/show.html.erb +24 -22
- data/app/views/{users → profiles}/show.mobile.erb +0 -0
- data/app/views/roles/_form.html.erb +1 -1
- data/app/views/roles/edit.html.erb +1 -1
- data/app/views/roles/index.html.erb +2 -2
- data/app/views/roles/new.html.erb +1 -1
- data/app/views/roles/show.html.erb +1 -1
- data/app/views/user_export_files/_form.html.erb +22 -0
- data/app/views/user_export_files/edit.html.erb +6 -0
- data/app/views/user_export_files/index.html.erb +44 -0
- data/app/views/user_export_files/new.html.erb +16 -0
- data/app/views/user_export_files/show.html.erb +31 -0
- data/app/views/user_groups/_form.html.erb +5 -5
- data/app/views/user_groups/edit.html.erb +1 -1
- data/app/views/user_groups/index.html.erb +14 -8
- data/app/views/user_groups/new.html.erb +1 -1
- data/app/views/user_groups/show.html.erb +3 -3
- data/app/views/user_import_files/index.html.erb +11 -10
- data/app/views/user_import_files/new.html.erb +15 -3
- data/app/views/user_import_files/show.html.erb +13 -3
- data/app/views/user_import_results/index.html.erb +7 -7
- data/app/views/user_import_results/{index.tsv.erb → index.txt.erb} +1 -1
- data/app/views/user_import_results/show.html.erb +2 -2
- data/app/workers/user_export_file_queue.rb +7 -0
- data/config/initializers/mime_types.rb +1 -1
- data/config/locales/devise.en.yml +19 -18
- data/config/locales/devise.ja.yml +45 -42
- data/config/locales/en.yml +214 -0
- data/config/locales/ja.yml +10 -6
- data/config/locales/translation_en.yml +34 -5
- data/config/locales/translation_ja.yml +35 -6
- data/config/routes.rb +4 -7
- data/db/migrate/20130221154434_add_additional_attributes_to_user.rb +0 -9
- data/db/migrate/20140122054321_create_profiles.rb +1 -1
- data/db/migrate/20140709113413_create_user_export_files.rb +11 -0
- data/db/migrate/20140709113905_create_user_export_file_transitions.rb +14 -0
- data/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +5 -0
- data/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +5 -0
- data/db/migrate/20140811031145_add_expired_at_to_profile.rb +5 -0
- data/lib/enju_leaf/calculate_stat.rb +9 -0
- data/lib/enju_leaf/controller.rb +1 -1
- data/lib/enju_leaf/export_file.rb +26 -0
- data/lib/enju_leaf/import_file.rb +25 -0
- data/lib/enju_leaf/master_model.rb +15 -6
- data/lib/enju_leaf/url_validator.rb +4 -2
- data/lib/enju_leaf/user.rb +74 -68
- data/lib/enju_leaf/version.rb +1 -1
- data/lib/enju_leaf.rb +23 -24
- data/lib/generators/enju_leaf/quick_install/quick_install_generator.rb +2 -1
- data/lib/generators/enju_leaf/setup/setup_generator.rb +6 -0
- data/lib/generators/enju_leaf/setup/templates/db/fixtures/user_groups.yml +1 -1
- data/lib/generators/enju_leaf/setup/templates/db/seeds.rb +5 -4
- data/lib/tasks/enju_leaf_tasks.rake +18 -9
- data/lib/tasks/profile.rb +15 -0
- data/spec/controllers/my_accounts_controller_spec.rb +61 -43
- data/spec/controllers/page_controller_spec.rb +20 -20
- data/spec/controllers/profiles_controller_spec.rb +530 -0
- data/spec/controllers/roles_controller_spec.rb +19 -19
- data/spec/controllers/user_export_files_controller_spec.rb +297 -0
- data/spec/controllers/user_groups_controller_spec.rb +48 -48
- data/spec/controllers/user_import_files_controller_spec.rb +45 -41
- data/spec/controllers/user_import_results_controller_spec.rb +9 -9
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/config/application.rb +3 -1
- data/spec/dummy/config/environments/test.rb +2 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +1 -2
- data/spec/dummy/db/migrate/005_create_manifestations.rb +5 -17
- data/spec/dummy/db/migrate/006_create_items.rb +2 -3
- data/spec/dummy/db/migrate/032_create_checkins.rb +17 -0
- data/spec/dummy/db/migrate/033_create_checkouts.rb +25 -0
- data/spec/dummy/db/migrate/035_create_reserves.rb +27 -0
- data/spec/dummy/db/migrate/055_create_bookmarks.rb +22 -0
- data/spec/dummy/db/migrate/059_create_libraries.rb +5 -1
- data/spec/dummy/db/migrate/069_create_shelves.rb +5 -1
- data/spec/dummy/db/migrate/080_create_library_groups.rb +0 -2
- data/spec/dummy/db/migrate/113_create_events.rb +23 -0
- data/spec/dummy/db/migrate/114_create_event_categories.rb +16 -0
- data/spec/dummy/db/migrate/121_create_checked_items.rb +17 -0
- data/spec/dummy/db/migrate/127_create_use_restrictions.rb +16 -0
- data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +16 -0
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +5 -1
- data/spec/dummy/db/migrate/131_create_request_types.rb +5 -1
- data/spec/dummy/db/migrate/132_create_circulation_statuses.rb +16 -0
- data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
- data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
- data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
- data/spec/dummy/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +1 -1
- data/spec/dummy/db/migrate/{20081028083142_create_patron_import_files.rb → 20081028083142_create_agent_import_files.rb} +2 -4
- data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +1 -3
- data/spec/dummy/db/migrate/20081030023412_create_checkout_types.rb +17 -0
- data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +25 -0
- data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +18 -0
- data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +17 -0
- data/spec/dummy/db/migrate/20081212080038_create_manifestation_checkout_stats.rb +16 -0
- data/spec/dummy/db/migrate/20081212151614_create_bookmark_stats.rb +16 -0
- data/spec/dummy/db/migrate/20081212151820_create_bookmark_stat_has_manifestations.rb +13 -0
- data/spec/dummy/db/migrate/20081215094302_create_user_checkout_stats.rb +16 -0
- data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +17 -0
- data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +17 -0
- data/spec/dummy/db/migrate/20081216190724_create_manifestation_reserve_stats.rb +16 -0
- data/spec/dummy/db/migrate/20081220023628_create_user_reserve_stats.rb +16 -0
- data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +17 -0
- data/spec/dummy/db/migrate/20090321130448_add_completed_at_to_user_checkout_stat.rb +27 -0
- data/spec/dummy/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +1 -1
- data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +21 -0
- data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +0 -1
- data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20100525171356_acts_as_taggable_on_migration.rb +30 -0
- data/spec/dummy/db/migrate/{20100606073747_create_patron_relationships.rb → 20100606073747_create_agent_relationships.rb} +1 -1
- data/spec/dummy/db/migrate/{20100814091104_add_position_to_patron_relationship.rb → 20100814091104_add_position_to_agent_relationship.rb} +1 -1
- data/spec/dummy/db/migrate/{20100925074559_create_patron_import_results.rb → 20100925074559_create_agent_import_results.rb} +1 -1
- data/spec/dummy/db/migrate/{20110301121550_add_birth_date_and_death_date_to_patron.rb → 20110301121550_add_birth_date_and_death_date_to_agent.rb} +1 -1
- data/spec/dummy/db/migrate/20110301134521_add_expire_date_to_reserve.rb +9 -0
- data/spec/dummy/db/migrate/20110328130826_add_current_checkout_count_to_user_group_has_checkout_type.rb +9 -0
- data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +1 -1
- data/spec/dummy/db/migrate/20110621093332_remove_expire_date_from_reserve.rb +9 -0
- data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
- data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +11 -0
- data/spec/dummy/db/migrate/20111217234412_add_save_checkout_history_to_user.rb +5 -0
- data/spec/dummy/db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb +6 -0
- data/spec/dummy/db/migrate/20111231145823_add_share_bookmarks_to_user.rb +5 -0
- data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
- data/spec/dummy/db/migrate/{20120413161403_add_fingerprint_to_patron_import_file.rb → 20120413161403_add_fingerprint_to_agent_import_file.rb} +1 -1
- data/spec/dummy/db/migrate/{20120413170720_add_error_message_to_patron_import_file.rb → 20120413170720_add_error_message_to_agent_import_file.rb} +1 -1
- data/spec/dummy/db/migrate/20120418121539_add_save_search_history_to_user.rb +5 -0
- data/spec/dummy/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb +5 -0
- data/spec/dummy/db/migrate/{20120511072422_add_patron_identifier_to_patron.rb → 20120511072422_add_agent_identifier_to_agent.rb} +1 -1
- data/spec/dummy/db/migrate/{20120602141129_add_edit_mode_to_patron_import_file.rb → 20120602141129_add_edit_mode_to_agent_import_file.rb} +1 -1
- data/spec/dummy/db/migrate/20130303104849_add_state_index_to_reserve.rb +5 -0
- data/spec/dummy/db/migrate/20130303124821_add_retained_at_to_reserve.rb +5 -0
- data/spec/dummy/db/migrate/20130304015019_add_postponed_at_to_reserve.rb +5 -0
- data/spec/dummy/db/migrate/20130416054135_add_circulation_status_id_to_item.rb +8 -0
- data/spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb +7 -0
- data/spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb +5 -0
- data/spec/dummy/db/migrate/20130509185724_add_statement_of_responsibility_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20130519065638_add_lock_version_to_reserve.rb +5 -0
- data/spec/dummy/db/migrate/20130519065837_add_lock_version_to_checkin.rb +5 -0
- data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140524142813_add_taggings_count_to_tag.rb +5 -0
- data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140529014410_create_item_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140614065404_create_resource_export_files.rb +11 -0
- data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140628073524_add_user_encoding_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140628073535_add_user_encoding_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140810061942_add_user_id_to_stat.rb +12 -0
- data/spec/dummy/db/migrate/20140810091231_add_checkout_icalendar_token_to_profile.rb +6 -0
- data/spec/dummy/db/migrate/20140810091417_add_save_checkout_history_to_profile.rb +5 -0
- data/spec/dummy/db/migrate/20140811132912_add_save_search_history_to_profile.rb +5 -0
- data/spec/dummy/db/migrate/20140812093836_add_share_bookmarks_to_profile.rb +5 -0
- data/spec/dummy/db/schema.rb +632 -57
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/user_import_files/user_imports/980/190/963/original/user_delete_file.tsv +4 -0
- data/spec/dummy/private/system/user_import_files/user_imports/980/190/963/original/user_import_file_sample.tsv +7 -7
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140815-3963-1s1td26.txt +8 -0
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140815-69229-i0rcty.txt +8 -0
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140816-21120-1w731r8.txt +8 -0
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140711-28652-1dj3e98.txt +148 -0
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140711-29117-13jb6ol.txt +148 -0
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140721-65743-1tnagd4.txt +8 -0
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140815-3963-1kk8o87.txt +8 -0
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140815-69229-188nwub.txt +8 -0
- data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140816-21120-twzfb6.txt +8 -0
- data/spec/dummy/solr/default/data/index/_4h.fdt +0 -0
- data/spec/dummy/solr/default/data/index/{_3h.fdx → _4h.fdx} +0 -0
- data/spec/dummy/solr/default/data/index/{_3h.fnm → _4h.fnm} +0 -0
- data/spec/dummy/solr/default/data/index/{_3h.nvd → _4h.nvd} +0 -0
- data/spec/dummy/solr/default/data/index/{_3h.nvm → _4h.nvm} +0 -0
- data/spec/dummy/solr/default/data/index/{_3h.si → _4h.si} +0 -0
- data/spec/dummy/solr/default/data/index/_4h_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/default/data/index/_4h_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/default/data/index/_4h_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/default/data/index/_4h_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/default/data/index/segments.gen +0 -0
- data/spec/dummy/solr/default/data/index/segments_97 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000320 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000321 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000322 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000323 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000324 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000325 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000326 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000327 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000328 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000329 +0 -0
- data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
- data/spec/dummy/tmp/cache/ACB/B20/manifestation_search_total +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/154f7b83f2da0e86effbe25f32135177 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1b984bdbd3204a51a82d0e01a1569e2d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3054c50144654f9c7e57bb0639a276e9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3bd7a263237ba366f64d938fe5303757 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/62899096da1a3e67660f3b88068be8c9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/65b2e4f67eab21b30217e29075f433b2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/87d24a3f43f175d4d17babe9203c79a7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d38d8658b30de1d068603968227680d4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/stdout +246 -279
- data/spec/dummy/tmp/pids/redis-test.pid +1 -1
- data/spec/factories/profile.rb +9 -0
- data/spec/factories/user.rb +0 -13
- data/spec/fixtures/agent_import_files.yml +0 -3
- data/spec/fixtures/agents.yml +54 -54
- data/spec/fixtures/baskets.yml +4 -4
- data/spec/fixtures/carrier_type_has_checkout_types.yml +30 -0
- data/spec/fixtures/checked_items.yml +34 -0
- data/spec/fixtures/checkins.yml +54 -0
- data/spec/fixtures/checkout_stat_has_manifestations.yml +23 -0
- data/spec/fixtures/checkout_stat_has_users.yml +23 -0
- data/spec/fixtures/checkout_types.yml +33 -0
- data/spec/fixtures/checkouts.yml +162 -0
- data/spec/fixtures/circulation_statuses.yml +119 -0
- data/spec/fixtures/event_categories.yml +55 -0
- data/spec/fixtures/events.yml +142 -0
- data/spec/fixtures/exemplifies.yml +12 -0
- data/spec/fixtures/import_requests.yml +0 -2
- data/spec/fixtures/item_has_use_restrictions.yml +60 -0
- data/spec/fixtures/items.yml +101 -11
- data/spec/fixtures/lending_policies.yml +98 -0
- data/spec/fixtures/libraries.yml +26 -25
- data/spec/fixtures/library_groups.yml +6 -8
- data/spec/fixtures/manifestation_checkout_stats.yml +30 -0
- data/spec/fixtures/manifestation_reserve_stats.yml +30 -0
- data/spec/fixtures/manifestations.yml +69 -207
- data/spec/fixtures/message_requests.yml +27 -0
- data/spec/fixtures/message_templates.yml +105 -0
- data/spec/fixtures/profiles.yml +98 -0
- data/spec/fixtures/request_status_types.yml +63 -0
- data/spec/fixtures/request_types.yml +55 -0
- data/spec/fixtures/reserve_stat_has_manifestations.yml +23 -0
- data/spec/fixtures/reserve_stat_has_users.yml +23 -0
- data/spec/fixtures/reserve_transitions.yml +88 -0
- data/spec/fixtures/reserves.yml +162 -0
- data/spec/fixtures/resource_import_files.yml +0 -3
- data/spec/fixtures/roles.yml +0 -4
- data/spec/fixtures/shelves.yml +2 -3
- data/spec/fixtures/use_restrictions.yml +92 -0
- data/spec/fixtures/user_checkout_stats.yml +30 -0
- data/spec/fixtures/user_export_files.yml +26 -0
- data/spec/fixtures/user_group_has_checkout_types.yml +110 -0
- data/spec/fixtures/user_import_files.yml +2 -0
- data/spec/fixtures/user_reserve_stats.yml +30 -0
- data/spec/fixtures/users.yml +1 -101
- data/spec/models/profile_spec.rb +66 -0
- data/spec/models/user_export_file_spec.rb +31 -0
- data/spec/models/user_import_file_spec.rb +42 -20
- data/spec/models/user_spec.rb +1 -18
- data/spec/requests/{users_spec.rb → profiles_spec.rb} +3 -3
- data/spec/routing/accounts_spec.rb +1 -1
- data/spec/routing/profiles_routing_spec.rb +35 -0
- data/spec/support/resque.rb +1 -0
- data/spec/views/{users → profiles}/edit.html.erb_spec.rb +5 -7
- data/spec/views/{users → profiles}/index.html.erb_spec.rb +3 -3
- data/spec/views/{users → profiles}/new.html.erb_spec.rb +5 -5
- data/spec/views/profiles/show.html.erb_spec.rb +20 -0
- data/vendor/assets/javascripts/jquery.colorbox.js +4 -3
- data/vendor/assets/stylesheets/colorbox.css +1 -1
- metadata +416 -132
- data/app/controllers/users_controller.rb +0 -195
- data/app/models/user_sweeper.rb +0 -18
- data/app/views/users/_edit_credential.html.erb +0 -79
- data/app/views/users/edit.html.erb +0 -76
- data/app/views/users/index.html.erb +0 -56
- data/lib/enju_leaf/expire_editable_fragment.rb +0 -30
- data/lib/enju_leaf/expire_fragment_cache.rb +0 -17
- data/spec/controllers/users_controller_spec.rb +0 -539
- data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +0 -13
- data/spec/dummy/db/migrate/20120415060308_rename_resource_import_file_imported_at_to_executed_at.rb +0 -9
- data/spec/dummy/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +0 -9
- data/spec/dummy/db/migrate/20121119153944_add_manifestation_id_to_item.rb +0 -5
- data/spec/dummy/solr/default/data/index/_3h.fdt +0 -0
- data/spec/dummy/solr/default/data/index/_3h_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/default/data/index/_3h_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/default/data/index/_3h_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/default/data/index/_3h_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/default/data/index/segments_71 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000242 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000243 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000244 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000245 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000246 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000247 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000248 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000249 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000250 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000251 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3f8d795856d1fdf902b0be679120571a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5998e66e374537d52eed3fe1ca5f2bfc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5ea4a1824e1d67da6c4fb9aeef9f49f4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/87f0cb69a0df1355e33cce3949919d5a +0 -0
- data/spec/routing/users_routing_spec.rb +0 -35
- data/spec/views/users/show.html.erb_spec.rb +0 -15
@@ -0,0 +1,530 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ProfilesController do
|
5
|
+
fixtures :all
|
6
|
+
|
7
|
+
describe "GET index", :solr => true do
|
8
|
+
before do
|
9
|
+
Profile.reindex
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "When logged in as Administrator" do
|
13
|
+
login_fixture_admin
|
14
|
+
|
15
|
+
it "assigns all profiles as @profiles" do
|
16
|
+
get :index
|
17
|
+
assigns(:profiles).should_not be_nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "When logged in as Librarian" do
|
22
|
+
login_fixture_librarian
|
23
|
+
|
24
|
+
it "assigns all profiles as @profiles" do
|
25
|
+
get :index
|
26
|
+
assigns(:profiles).should_not be_nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should get index with query" do
|
30
|
+
get :index, :query => 'user1'
|
31
|
+
response.should be_success
|
32
|
+
assigns(:profiles).should_not be_empty
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should get sorted index" do
|
36
|
+
get :index, :query => 'user1', :sort_by => 'username', :order => 'desc'
|
37
|
+
response.should be_success
|
38
|
+
assigns(:profiles).should_not be_empty
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "When logged in as User" do
|
43
|
+
login_fixture_user
|
44
|
+
|
45
|
+
it "assigns all profiles as @profiles" do
|
46
|
+
get :index
|
47
|
+
assigns(:profiles).should be_nil
|
48
|
+
response.should be_forbidden
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "When not logged in" do
|
53
|
+
it "assigns all profiles as @profiles" do
|
54
|
+
get :index
|
55
|
+
assigns(:profiles).should be_nil
|
56
|
+
response.should redirect_to(new_user_session_url)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "GET show" do
|
62
|
+
describe "When logged in as Administrator" do
|
63
|
+
login_fixture_admin
|
64
|
+
|
65
|
+
it "assigns the requested user as @profile" do
|
66
|
+
get :show, id: profiles(:admin).id
|
67
|
+
assigns(:profile).should eq(profiles(:admin))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "When logged in as Librarian" do
|
72
|
+
login_fixture_librarian
|
73
|
+
|
74
|
+
it "assigns the requested user as @profile" do
|
75
|
+
get :show, id: profiles(:librarian1).id
|
76
|
+
assigns(:profile).should eq(profiles(:librarian1))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "When logged in as User" do
|
81
|
+
login_fixture_user
|
82
|
+
|
83
|
+
it "assigns the requested user as @profile" do
|
84
|
+
get :show, id: profiles(:user1).id
|
85
|
+
assigns(:profile).should eq(profiles(:user1))
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should redirect to my user account" do
|
89
|
+
get :show, id: profiles(:user1).id
|
90
|
+
assert_redirected_to my_account_url
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should show other user's account" do
|
94
|
+
get :show, id: profiles(:admin).id
|
95
|
+
assigns(:profile).should eq(profiles(:admin))
|
96
|
+
response.should be_success
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe "When not logged in" do
|
101
|
+
it "assigns the requested user as @profile" do
|
102
|
+
get :show, id: profiles(:admin).id
|
103
|
+
assigns(:profile).should eq(profiles(:admin))
|
104
|
+
response.should redirect_to(new_user_session_url)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "GET new" do
|
110
|
+
describe "When logged in as Administrator" do
|
111
|
+
login_fixture_admin
|
112
|
+
|
113
|
+
it "assigns the requested user as @profile" do
|
114
|
+
get :new
|
115
|
+
assigns(:profile).should_not be_valid
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "When logged in as Librarian" do
|
120
|
+
login_fixture_librarian
|
121
|
+
|
122
|
+
it "should not assign the requested user as @profile" do
|
123
|
+
get :new
|
124
|
+
assigns(:profile).should_not be_valid
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe "When logged in as User" do
|
129
|
+
login_fixture_user
|
130
|
+
|
131
|
+
it "should not assign the requested user as @profile" do
|
132
|
+
get :new
|
133
|
+
assigns(:profile).should_not be_valid
|
134
|
+
response.should be_forbidden
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "When not logged in" do
|
139
|
+
it "should not assign the requested user as @profile" do
|
140
|
+
get :new
|
141
|
+
assigns(:profile).should_not be_valid
|
142
|
+
response.should redirect_to(new_user_session_url)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
describe "GET edit" do
|
148
|
+
describe "When logged in as Administrator" do
|
149
|
+
login_fixture_admin
|
150
|
+
|
151
|
+
it "assigns the requested user as @profile" do
|
152
|
+
profile = FactoryGirl.create(:profile)
|
153
|
+
get :edit, id: profile.id
|
154
|
+
assigns(:profile).should eq(profile)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "When logged in as Librarian" do
|
159
|
+
login_fixture_librarian
|
160
|
+
|
161
|
+
it "should assign the requested user as @profile" do
|
162
|
+
profile = FactoryGirl.create(:profile)
|
163
|
+
get :edit, id: profile.id
|
164
|
+
assigns(:profile).should eq(profile)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe "When logged in as User" do
|
169
|
+
login_fixture_user
|
170
|
+
|
171
|
+
it "should not assign the requested user as @profile" do
|
172
|
+
profile = FactoryGirl.create(:profile)
|
173
|
+
get :edit, id: profile.id
|
174
|
+
assigns(:profile).should eq(profile)
|
175
|
+
response.should be_forbidden
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should edit myself" do
|
179
|
+
get :edit, id: profiles(:user1).id
|
180
|
+
response.should redirect_to edit_my_account_url
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
describe "When not logged in" do
|
185
|
+
it "should not assign the requested user as @profile" do
|
186
|
+
profile = FactoryGirl.create(:profile)
|
187
|
+
get :edit, id: profile.id
|
188
|
+
assigns(:profile).should eq(profile)
|
189
|
+
response.should redirect_to(new_user_session_url)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
describe "POST create" do
|
195
|
+
before(:each) do
|
196
|
+
@attrs = FactoryGirl.attributes_for(:profile)
|
197
|
+
@invalid_attrs = {:user_group_id => '', :user_number => '日本語'}
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "When logged in as Administrator" do
|
201
|
+
login_fixture_admin
|
202
|
+
|
203
|
+
describe "with valid params" do
|
204
|
+
it "assigns a newly created user as @profile" do
|
205
|
+
post :create, :profile => @attrs
|
206
|
+
assigns(:profile).should be_valid
|
207
|
+
end
|
208
|
+
|
209
|
+
it "redirects to the created user" do
|
210
|
+
post :create, :profile => @attrs
|
211
|
+
response.should redirect_to(profile_url(assigns(:profile)))
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe "with invalid params" do
|
216
|
+
it "assigns a newly created but unsaved user as @profile" do
|
217
|
+
post :create, :profile => @invalid_attrs
|
218
|
+
assigns(:profile).should_not be_valid
|
219
|
+
end
|
220
|
+
|
221
|
+
it "re-renders the 'new' template" do
|
222
|
+
post :create, :profile => @invalid_attrs
|
223
|
+
response.should render_template("new")
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
describe "When logged in as Librarian" do
|
229
|
+
login_fixture_librarian
|
230
|
+
|
231
|
+
describe "with valid params" do
|
232
|
+
it "assigns a newly created user as @profile" do
|
233
|
+
post :create, :profile => @attrs
|
234
|
+
assigns(:profile).should be_valid
|
235
|
+
end
|
236
|
+
|
237
|
+
it "redirects to the created user" do
|
238
|
+
post :create, :profile => @attrs
|
239
|
+
response.should redirect_to(profile_url(assigns(:profile)))
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
describe "with invalid params" do
|
244
|
+
it "assigns a newly created but unsaved user as @profile" do
|
245
|
+
post :create, :profile => @invalid_attrs
|
246
|
+
assigns(:profile).should_not be_valid
|
247
|
+
end
|
248
|
+
|
249
|
+
it "re-renders the 'new' template" do
|
250
|
+
post :create, :profile => @invalid_attrs
|
251
|
+
response.should render_template("new")
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
describe "When logged in as User" do
|
257
|
+
login_fixture_user
|
258
|
+
|
259
|
+
it "should not create user" do
|
260
|
+
post :create, profile: { :username => 'test10' }
|
261
|
+
assigns(:profile).should be_nil
|
262
|
+
response.should be_forbidden
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
describe "When not logged in" do
|
267
|
+
it "should not create user" do
|
268
|
+
post :create, profile: { :username => 'test10' }
|
269
|
+
response.should redirect_to new_user_session_url
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
describe "PUT update" do
|
275
|
+
before(:each) do
|
276
|
+
@profile = profiles(:user1)
|
277
|
+
@attrs = {:user_group_id => '3', :locale => 'en'}
|
278
|
+
@invalid_attrs = {:user_group_id => '', :user_number => '日本語'}
|
279
|
+
end
|
280
|
+
|
281
|
+
describe "When logged in as Administrator" do
|
282
|
+
login_fixture_admin
|
283
|
+
|
284
|
+
describe "with valid params" do
|
285
|
+
it "updates the requested user" do
|
286
|
+
put :update, id: @profile.id, profile: @attrs
|
287
|
+
end
|
288
|
+
|
289
|
+
it "assigns the requested user as @profile" do
|
290
|
+
put :update, id: @profile.id, profile: @attrs
|
291
|
+
assigns(:profile).should eq(@profile)
|
292
|
+
end
|
293
|
+
|
294
|
+
it "redirects to the user" do
|
295
|
+
put :update, id: @profile.id, profile: @attrs
|
296
|
+
assigns(:profile).should eq(@profile)
|
297
|
+
response.should redirect_to(@profile)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
describe "with invalid params" do
|
302
|
+
it "assigns the requested user as @profile" do
|
303
|
+
put :update, id: @profile.id, profile: @invalid_attrs
|
304
|
+
assigns(:profile).should eq(@profile)
|
305
|
+
end
|
306
|
+
|
307
|
+
it "re-renders the 'edit' template" do
|
308
|
+
put :update, id: @profile, profile: @invalid_attrs
|
309
|
+
response.should render_template("edit")
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should update other user's role" do
|
314
|
+
put :update, id: profiles(:user1).id, profile: {:user_attributes => {:user_has_role_attributes => {:role_id => 4}, :email => profiles(:user1).user.email, :locale => 'en', :id => profiles(:user1).user.id}}
|
315
|
+
response.should redirect_to profile_url(assigns(:profile))
|
316
|
+
assigns(:profile).reload
|
317
|
+
assigns(:profile).user.role.should eq Role.where(name: 'Administrator').first
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
describe "When logged in as Librarian" do
|
322
|
+
login_fixture_librarian
|
323
|
+
|
324
|
+
describe "with valid params" do
|
325
|
+
it "updates the requested user" do
|
326
|
+
put :update, id: @profile.id, profile: @attrs
|
327
|
+
end
|
328
|
+
|
329
|
+
it "assigns the requested user as @profile" do
|
330
|
+
put :update, id: @profile.id, profile: @attrs
|
331
|
+
assigns(:profile).should eq(@profile)
|
332
|
+
end
|
333
|
+
|
334
|
+
it "redirects to the user" do
|
335
|
+
put :update, id: @profile.id, profile: @attrs
|
336
|
+
assigns(:profile).should eq(@profile)
|
337
|
+
response.should redirect_to(@profile)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
describe "with invalid params" do
|
342
|
+
it "assigns the user as @profile" do
|
343
|
+
put :update, id: @profile, profile: @invalid_attrs
|
344
|
+
assigns(:profile).should_not be_valid
|
345
|
+
end
|
346
|
+
|
347
|
+
it "re-renders the 'edit' template" do
|
348
|
+
put :update, id: @profile, profile: @invalid_attrs
|
349
|
+
response.should render_template("edit")
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
it "should update other user" do
|
354
|
+
put :update, id: profiles(:user1).id, profile: {:user_number => '00003', :locale => 'en', :user_group_id => 3, :library_id => 3, :note => 'test'}
|
355
|
+
response.should redirect_to profile_url(assigns(:profile))
|
356
|
+
end
|
357
|
+
|
358
|
+
it "should update other user's user_group" do
|
359
|
+
put :update, id: profiles(:user1).id, profile: {:user_group_id => 3, :library_id => 3, :locale => 'en'}
|
360
|
+
response.should redirect_to profile_url(assigns(:profile))
|
361
|
+
assigns(:profile).user_group_id.should eq 3
|
362
|
+
end
|
363
|
+
|
364
|
+
it "should update other user's note" do
|
365
|
+
put :update, id: profiles(:user1).id, profile: {:user_group_id => 3, :library_id => 3, :note => 'test', :locale => 'en'}
|
366
|
+
response.should redirect_to profile_url(assigns(:profile))
|
367
|
+
assert_equal assigns(:profile).note, 'test'
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
describe "When logged in as User" do
|
372
|
+
login_fixture_user
|
373
|
+
|
374
|
+
describe "with valid params" do
|
375
|
+
it "updates the requested user" do
|
376
|
+
put :update, id: @profile.id, profile: @attrs
|
377
|
+
end
|
378
|
+
|
379
|
+
it "assigns the requested user as @profile" do
|
380
|
+
put :update, id: @profile.id, profile: @attrs
|
381
|
+
assigns(:profile).should be_valid
|
382
|
+
response.should redirect_to profile_url(assigns(:profile))
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
describe "with invalid params" do
|
387
|
+
it "assigns the requested user as @profile" do
|
388
|
+
put :update, id: @profile.id, profile: @invalid_attrs
|
389
|
+
#assigns(:profile).should_not be_valid
|
390
|
+
#response.should be_success
|
391
|
+
assigns(:profile).should be_valid
|
392
|
+
response.should redirect_to profile_url(assigns(:profile))
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
it "should update myself" do
|
397
|
+
put :update, id: profiles(:user1).id, profile: { }
|
398
|
+
response.should redirect_to profile_url(assigns(:profile))
|
399
|
+
end
|
400
|
+
|
401
|
+
it "should not update my role" do
|
402
|
+
put :update, id: profiles(:user1).id, profile: {:user_has_role_attributes => {:role_id => 4}}
|
403
|
+
response.should redirect_to profile_url(assigns(:profile))
|
404
|
+
assigns(:profile).user.role.should_not eq Role.where(name: 'Administrator').first
|
405
|
+
end
|
406
|
+
|
407
|
+
it "should not update my user_group" do
|
408
|
+
put :update, id: profiles(:user1).id, profile: {:user_group_id => 3, :library_id => 3}
|
409
|
+
response.should redirect_to profile_url(assigns(:profile))
|
410
|
+
assigns(:profile).user_group.id.should eq 1
|
411
|
+
end
|
412
|
+
|
413
|
+
it "should not update my note" do
|
414
|
+
put :update, id: profiles(:user1).id, profile: {:user_group_id => 3, :library_id => 3, :note => 'test'}
|
415
|
+
response.should redirect_to profile_url(assigns(:profile))
|
416
|
+
assigns(:profile).note.should be_nil
|
417
|
+
end
|
418
|
+
|
419
|
+
it "should update my keyword_list" do
|
420
|
+
put :update, id: profiles(:user1).id, profile: {:keyword_list => 'test'}
|
421
|
+
response.should redirect_to profile_url(assigns(:profile))
|
422
|
+
assigns(:profile).keyword_list.should eq 'test'
|
423
|
+
assigns(:profile).user.role.name.should eq 'User'
|
424
|
+
end
|
425
|
+
|
426
|
+
it "should not update other user" do
|
427
|
+
put :update, id: profiles(:user2).id, profile: { }
|
428
|
+
assigns(:profile).should be_valid
|
429
|
+
response.should be_forbidden
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
describe "When not logged in" do
|
434
|
+
describe "with valid params" do
|
435
|
+
it "updates the requested user" do
|
436
|
+
put :update, id: @profile.id, profile: @attrs
|
437
|
+
end
|
438
|
+
|
439
|
+
it "should be forbidden" do
|
440
|
+
put :update, id: @profile.id, profile: @attrs
|
441
|
+
response.should redirect_to(new_user_session_url)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
describe "with invalid params" do
|
446
|
+
it "assigns the requested user as @profile" do
|
447
|
+
put :update, id: @profile.id, profile: @invalid_attrs
|
448
|
+
response.should redirect_to(new_user_session_url)
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
describe "DELETE destroy" do
|
455
|
+
describe "When logged in as Administrator" do
|
456
|
+
login_fixture_admin
|
457
|
+
|
458
|
+
it "destroys the requested user" do
|
459
|
+
delete :destroy, id: profiles(:user2).id
|
460
|
+
end
|
461
|
+
|
462
|
+
it "redirects to the profiles list" do
|
463
|
+
delete :destroy, id: profiles(:user2).id
|
464
|
+
response.should redirect_to(profiles_url)
|
465
|
+
end
|
466
|
+
|
467
|
+
it "should destroy librarian" do
|
468
|
+
delete :destroy, id: profiles(:librarian2).id
|
469
|
+
response.should redirect_to(profiles_url)
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
describe "When logged in as Librarian" do
|
474
|
+
login_fixture_librarian
|
475
|
+
|
476
|
+
it "destroys the requested user" do
|
477
|
+
delete :destroy, id: profiles(:user2).id
|
478
|
+
end
|
479
|
+
|
480
|
+
it "redirects to the profiles list" do
|
481
|
+
delete :destroy, id: profiles(:user2).id
|
482
|
+
response.should redirect_to(profiles_url)
|
483
|
+
end
|
484
|
+
|
485
|
+
it "should not destroy librarian" do
|
486
|
+
delete :destroy, id: profiles(:librarian2).id
|
487
|
+
response.should be_forbidden
|
488
|
+
end
|
489
|
+
|
490
|
+
it "should not destroy admin" do
|
491
|
+
delete :destroy, id: profiles(:admin).id
|
492
|
+
response.should be_forbidden
|
493
|
+
end
|
494
|
+
|
495
|
+
it "should not destroy myself" do
|
496
|
+
delete :destroy, id: profiles(:librarian1).id
|
497
|
+
response.should be_forbidden
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
describe "When logged in as User" do
|
502
|
+
login_fixture_user
|
503
|
+
|
504
|
+
it "destroys the requested user" do
|
505
|
+
delete :destroy, id: profiles(:user2).id
|
506
|
+
end
|
507
|
+
|
508
|
+
it "should be forbidden" do
|
509
|
+
delete :destroy, id: profiles(:user2).id
|
510
|
+
response.should be_forbidden
|
511
|
+
end
|
512
|
+
|
513
|
+
it "should not destroy myself" do
|
514
|
+
delete :destroy, id: profiles(:user1).id
|
515
|
+
response.should be_forbidden
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
describe "When not logged in" do
|
520
|
+
it "destroys the requested user" do
|
521
|
+
delete :destroy, id: profiles(:user2).id
|
522
|
+
end
|
523
|
+
|
524
|
+
it "should be forbidden" do
|
525
|
+
delete :destroy, id: profiles(:user2).id
|
526
|
+
response.should redirect_to(new_user_session_url)
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
530
|
+
end
|
@@ -5,48 +5,48 @@ describe RolesController do
|
|
5
5
|
|
6
6
|
describe "GET index" do
|
7
7
|
describe "When logged in as Administrator" do
|
8
|
-
|
8
|
+
login_fixture_admin
|
9
9
|
|
10
10
|
it "assigns all roles as @roles" do
|
11
11
|
get :index
|
12
|
-
assigns(:roles).
|
12
|
+
expect(assigns(:roles)).to eq(Role.all)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "When logged in as Librarian" do
|
17
|
-
|
17
|
+
login_fixture_librarian
|
18
18
|
|
19
19
|
it "assigns all roles as @roles" do
|
20
20
|
get :index
|
21
|
-
assigns(:roles).
|
21
|
+
expect(assigns(:roles)).to eq(Role.all)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "When logged in as User" do
|
26
|
-
|
26
|
+
login_fixture_user
|
27
27
|
|
28
28
|
it "assigns all roles as @roles" do
|
29
29
|
get :index
|
30
|
-
assigns(:roles).
|
30
|
+
expect(assigns(:roles)).to be_empty
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "When not logged in" do
|
35
35
|
it "assigns all roles as @roles" do
|
36
36
|
get :index
|
37
|
-
assigns(:roles).
|
37
|
+
expect(assigns(:roles)).to be_empty
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "GET show" do
|
43
43
|
describe "When logged in as Administrator" do
|
44
|
-
|
44
|
+
login_fixture_admin
|
45
45
|
|
46
46
|
it "assigns the requested role as @role" do
|
47
47
|
role = Role.find(1)
|
48
48
|
get :show, :id => role.id
|
49
|
-
assigns(:role).
|
49
|
+
expect(assigns(:role)).to eq(role)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,19 +54,19 @@ describe RolesController do
|
|
54
54
|
it "assigns the requested role as @role" do
|
55
55
|
role = Role.find(1)
|
56
56
|
get :show, :id => role.id
|
57
|
-
assigns(:role).
|
57
|
+
expect(assigns(:role)).to eq(role)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe "GET edit" do
|
63
63
|
describe "When logged in as Administrator" do
|
64
|
-
|
64
|
+
login_fixture_admin
|
65
65
|
|
66
66
|
it "assigns the requested role as @role" do
|
67
67
|
role = Role.find(1)
|
68
68
|
get :edit, :id => role.id
|
69
|
-
assigns(:role).
|
69
|
+
expect(assigns(:role)).to eq(role)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -74,7 +74,7 @@ describe RolesController do
|
|
74
74
|
it "should not assign the requested role as @role" do
|
75
75
|
role = Role.find(1)
|
76
76
|
get :edit, :id => role.id
|
77
|
-
response.
|
77
|
+
expect(response).to redirect_to(new_user_session_url)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -87,7 +87,7 @@ describe RolesController do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
describe "When logged in as Administrator" do
|
90
|
-
|
90
|
+
login_fixture_admin
|
91
91
|
|
92
92
|
describe "with valid params" do
|
93
93
|
it "updates the requested role" do
|
@@ -96,19 +96,19 @@ describe RolesController do
|
|
96
96
|
|
97
97
|
it "assigns the requested role as @role" do
|
98
98
|
put :update, :id => @role.id, :role => @attrs
|
99
|
-
assigns(:role).
|
99
|
+
expect(assigns(:role)).to eq(@role)
|
100
100
|
end
|
101
101
|
|
102
102
|
it "moves its position when specified" do
|
103
103
|
put :update, :id => @role.id, :role => @attrs, :move => 'lower'
|
104
|
-
response.
|
104
|
+
expect(response).to redirect_to(roles_url)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
108
|
describe "with invalid params" do
|
109
109
|
it "assigns the requested role as @role" do
|
110
110
|
put :update, :id => @role.id, :role => @invalid_attrs
|
111
|
-
response.
|
111
|
+
expect(response).to render_template("edit")
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -121,14 +121,14 @@ describe RolesController do
|
|
121
121
|
|
122
122
|
it "should be forbidden" do
|
123
123
|
put :update, :id => @role.id, :role => @attrs
|
124
|
-
response.
|
124
|
+
expect(response).to redirect_to(new_user_session_url)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
128
|
describe "with invalid params" do
|
129
129
|
it "assigns the requested role as @role" do
|
130
130
|
put :update, :id => @role.id, :role => @invalid_attrs
|
131
|
-
response.
|
131
|
+
expect(response).to redirect_to(new_user_session_url)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|