enju_trunk_subject 1.0.4
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 +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +36 -0
- data/app/controllers/classification_types_controller.rb +13 -0
- data/app/controllers/classifications_controller.rb +114 -0
- data/app/controllers/subject_has_classifications_controller.rb +97 -0
- data/app/controllers/subject_heading_type_has_subjects_controller.rb +80 -0
- data/app/controllers/subject_heading_types_controller.rb +13 -0
- data/app/controllers/subject_types_controller.rb +13 -0
- data/app/controllers/subjects_controller.rb +216 -0
- data/app/controllers/work_has_subjects_controller.rb +107 -0
- data/app/models/classification.rb +89 -0
- data/app/models/classification_type.rb +20 -0
- data/app/models/enju_subject/ability.rb +55 -0
- data/app/models/subject.rb +100 -0
- data/app/models/subject_has_classification.rb +37 -0
- data/app/models/subject_heading_type.rb +21 -0
- data/app/models/subject_heading_type_has_subject.rb +22 -0
- data/app/models/subject_type.rb +20 -0
- data/app/models/work_has_subject.rb +35 -0
- data/app/views/classification_types/_form.html.erb +19 -0
- data/app/views/classification_types/edit.html.erb +13 -0
- data/app/views/classification_types/index.html.erb +45 -0
- data/app/views/classification_types/new.html.erb +12 -0
- data/app/views/classification_types/show.html.erb +30 -0
- data/app/views/classifications/_form.html.erb +27 -0
- data/app/views/classifications/edit.html.erb +13 -0
- data/app/views/classifications/index.html.erb +54 -0
- data/app/views/classifications/new.html.erb +12 -0
- data/app/views/classifications/show.html.erb +34 -0
- data/app/views/manifestations/_classification_detail.html.erb +14 -0
- data/app/views/manifestations/_subject_detail.html.erb +14 -0
- data/app/views/manifestations/_subject_facet.html.erb +18 -0
- data/app/views/manifestations/_subject_form.html.erb +21 -0
- data/app/views/subject_has_classifications/edit.html.erb +30 -0
- data/app/views/subject_has_classifications/index.html.erb +38 -0
- data/app/views/subject_has_classifications/new.html.erb +32 -0
- data/app/views/subject_has_classifications/show.html.erb +22 -0
- data/app/views/subject_heading_type_has_subjects/edit.html.erb +28 -0
- data/app/views/subject_heading_type_has_subjects/index.html.erb +30 -0
- data/app/views/subject_heading_type_has_subjects/new.html.erb +27 -0
- data/app/views/subject_heading_type_has_subjects/show.html.erb +23 -0
- data/app/views/subject_heading_types/_form.html.erb +19 -0
- data/app/views/subject_heading_types/edit.html.erb +13 -0
- data/app/views/subject_heading_types/index.html.erb +43 -0
- data/app/views/subject_heading_types/new.html.erb +12 -0
- data/app/views/subject_heading_types/show.html.erb +27 -0
- data/app/views/subject_types/_form.html.erb +19 -0
- data/app/views/subject_types/edit.html.erb +13 -0
- data/app/views/subject_types/index.html.erb +43 -0
- data/app/views/subject_types/new.html.erb +12 -0
- data/app/views/subject_types/show.html.erb +29 -0
- data/app/views/subjects/_form.html.erb +42 -0
- data/app/views/subjects/_index.html.erb +48 -0
- data/app/views/subjects/_index_classification.html.erb +57 -0
- data/app/views/subjects/_index_work.html.erb +60 -0
- data/app/views/subjects/_show_work_list.html.erb +15 -0
- data/app/views/subjects/edit.html.erb +13 -0
- data/app/views/subjects/index.atom.builder +10 -0
- data/app/views/subjects/index.html.erb +7 -0
- data/app/views/subjects/index.rss.builder +29 -0
- data/app/views/subjects/new.html.erb +12 -0
- data/app/views/subjects/show.html.erb +69 -0
- data/app/views/subjects/show.js.erb +1 -0
- data/app/views/work_has_subjects/_form.html.erb +24 -0
- data/app/views/work_has_subjects/edit.html.erb +29 -0
- data/app/views/work_has_subjects/index.html.erb +31 -0
- data/app/views/work_has_subjects/new.html.erb +42 -0
- data/app/views/work_has_subjects/show.html.erb +25 -0
- data/config/locales/translation_en.yml +35 -0
- data/config/locales/translation_ja.yml +39 -0
- data/config/routes.rb +7 -0
- data/db/fixtures/classification_types.yml +7 -0
- data/db/fixtures/subject_types.yml +28 -0
- data/db/migrate/029_create_subjects.rb +28 -0
- data/db/migrate/142_create_classifications.rb +19 -0
- data/db/migrate/144_create_classification_types.rb +16 -0
- data/db/migrate/145_create_subject_heading_types.rb +16 -0
- data/db/migrate/146_create_subject_types.rb +16 -0
- data/db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb +11 -0
- data/db/migrate/20140427142354_add_classifiation_identifier_to_classification.rb +6 -0
- data/lib/enju_subject.rb +33 -0
- data/lib/enju_subject/engine.rb +8 -0
- data/lib/enju_subject/manifestation.rb +31 -0
- data/lib/enju_subject/master_model.rb +41 -0
- data/lib/enju_subject/version.rb +3 -0
- data/lib/generators/enju_subject/setup/USAGE +8 -0
- data/lib/generators/enju_subject/setup/setup_generator.rb +10 -0
- data/lib/generators/enju_subject/setup/templates/db/fixtures/classification_types.yml +13 -0
- data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_heading_types.yml +39 -0
- data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_types.yml +28 -0
- data/lib/tasks/enju_subject_tasks.rake +19 -0
- data/spec/controllers/classification_types_controller_spec.rb +445 -0
- data/spec/controllers/classifications_controller_spec.rb +441 -0
- data/spec/controllers/subject_heading_types_controller_spec.rb +445 -0
- data/spec/controllers/subject_types_controller_spec.rb +447 -0
- data/spec/controllers/subjects_controller_spec.rb +437 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +47 -0
- data/spec/dummy/app/helpers/application_helper.rb +21 -0
- data/spec/dummy/app/models/ability.rb +59 -0
- data/spec/dummy/app/models/setting.rb +4 -0
- data/spec/dummy/app/models/user.rb +43 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +46 -0
- data/spec/dummy/config/application.yml +38 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +207 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/devise.en.yml +57 -0
- data/spec/dummy/config/locales/en.yml +18 -0
- data/spec/dummy/config/locales/ja.yml +18 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/db/fixtures/roles.yml +25 -0
- data/spec/dummy/db/migrate/001_create_agents.rb +53 -0
- data/spec/dummy/db/migrate/005_create_manifestations.rb +56 -0
- data/spec/dummy/db/migrate/006_create_items.rb +24 -0
- data/spec/dummy/db/migrate/012_create_owns.rb +12 -0
- data/spec/dummy/db/migrate/015_create_creates.rb +12 -0
- data/spec/dummy/db/migrate/047_create_produces.rb +12 -0
- data/spec/dummy/db/migrate/059_create_libraries.rb +28 -0
- data/spec/dummy/db/migrate/069_create_shelves.rb +15 -0
- data/spec/dummy/db/migrate/073_create_carrier_types.rb +11 -0
- data/spec/dummy/db/migrate/077_create_user_groups.rb +12 -0
- data/spec/dummy/db/migrate/080_create_library_groups.rb +18 -0
- data/spec/dummy/db/migrate/112_create_frequencies.rb +12 -0
- data/spec/dummy/db/migrate/117_create_form_of_works.rb +12 -0
- data/spec/dummy/db/migrate/120_create_baskets.rb +12 -0
- data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
- data/spec/dummy/db/migrate/125_create_donates.rb +12 -0
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +12 -0
- data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +13 -0
- data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +13 -0
- data/spec/dummy/db/migrate/20080905191442_create_agent_types.rb +12 -0
- data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +17 -0
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +14 -0
- data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
- data/spec/dummy/db/migrate/20081025083323_create_countries.rb +28 -0
- data/spec/dummy/db/migrate/20081025083905_create_languages.rb +23 -0
- data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +15 -0
- data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
- data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +22 -0
- data/spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb +15 -0
- data/spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb +15 -0
- data/spec/dummy/db/migrate/20090719201843_create_extents.rb +12 -0
- data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +12 -0
- data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +12 -0
- data/spec/dummy/db/migrate/20090812151902_create_agent_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +27 -0
- data/spec/dummy/db/migrate/20091025080447_create_licenses.rb +12 -0
- data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
- data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +13 -0
- data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +15 -0
- data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb +13 -0
- data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
- data/spec/dummy/db/migrate/20100925043847_create_resource_import_results.rb +15 -0
- data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
- data/spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb +9 -0
- data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
- data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110603184217_add_edit_mode_to_resource_import_file.rb +9 -0
- data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20110620173525_add_bookstore_id_to_item.rb +11 -0
- data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +9 -0
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +12 -0
- data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +13 -0
- data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +13 -0
- data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +13 -0
- data/spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb +13 -0
- data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20111009183423_add_ndc_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20111124110059_create_create_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +7 -0
- data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +8 -0
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +49 -0
- data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
- data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
- data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +6 -0
- data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +12 -0
- data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +6 -0
- data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +6 -0
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -0
- data/spec/dummy/db/migrate/20120410104851_add_year_of_publication_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413100352_add_fingerprint_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170705_add_error_message_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120415060308_rename_resource_import_file_imported_at_to_executed_at.rb +9 -0
- data/spec/dummy/db/migrate/20120415164821_add_attachment_meta_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
- data/spec/dummy/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
- data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +26 -0
- data/spec/dummy/db/migrate/20130421093852_add_periodical_to_manifestation.rb +5 -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/20130506175303_create_identifier_types.rb +12 -0
- data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +15 -0
- data/spec/dummy/db/migrate/20130509185724_add_statement_of_responsibility_to_manifestation.rb +5 -0
- data/spec/dummy/db/schema.rb +901 -0
- data/spec/dummy/db/seeds.rb +32 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/fixtures/subjects.yml +72 -0
- data/spec/dummy/test/fixtures/user_groups.yml +13 -0
- data/spec/dummy/test/fixtures/user_has_roles.yml +9 -0
- data/spec/dummy/test/fixtures/users.yml +11 -0
- data/spec/dummy/test/unit/user_group_test.rb +7 -0
- data/spec/dummy/test/unit/user_has_role_test.rb +7 -0
- data/spec/dummy/test/unit/user_test.rb +7 -0
- data/spec/factories/classification.rb +6 -0
- data/spec/factories/classification_type.rb +5 -0
- data/spec/factories/manifestation.rb +6 -0
- data/spec/factories/subject.rb +7 -0
- data/spec/factories/subject_heading_type.rb +5 -0
- data/spec/factories/subject_heading_type_has_subject.rb +6 -0
- data/spec/factories/subject_type.rb +5 -0
- data/spec/factories/user.rb +34 -0
- data/spec/fixtures/agent_types.yml +35 -0
- data/spec/fixtures/agents.yml +143 -0
- data/spec/fixtures/carrier_types.yml +51 -0
- data/spec/fixtures/classification_types.yml +188 -0
- data/spec/fixtures/classifications.yml +118 -0
- data/spec/fixtures/languages.yml +1901 -0
- data/spec/fixtures/library_groups.yml +33 -0
- data/spec/fixtures/manifestations.yml +22 -0
- data/spec/fixtures/roles.yml +21 -0
- data/spec/fixtures/shtsv.tsv +3 -0
- data/spec/fixtures/subject_heading_types.yml +39 -0
- data/spec/fixtures/subject_types.yml +42 -0
- data/spec/fixtures/subjects.yml +80 -0
- data/spec/fixtures/user_groups.yml +25 -0
- data/spec/fixtures/user_has_roles.yml +41 -0
- data/spec/fixtures/users.yml +69 -0
- data/spec/models/classification_spec.rb +46 -0
- data/spec/models/classification_type_spec.rb +21 -0
- data/spec/models/subject_heading_type_spec.rb +21 -0
- data/spec/models/subject_spec.rb +33 -0
- data/spec/models/subject_type_spec.rb +21 -0
- data/spec/requests/subjects_spec.rb +9 -0
- data/spec/routing/subject_heading_types_routing_spec.rb +35 -0
- data/spec/routing/subject_types_routing_spec.rb +35 -0
- data/spec/routing/subjects_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/support/controller_macros.rb +48 -0
- data/spec/support/devise.rb +3 -0
- metadata +675 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
subject_type_00001:
|
3
|
+
id: 1
|
4
|
+
name: concept
|
5
|
+
display_name: Concept
|
6
|
+
note:
|
7
|
+
position: 1
|
8
|
+
|
9
|
+
subject_type_00002:
|
10
|
+
id: 2
|
11
|
+
name: event
|
12
|
+
display_name: Event
|
13
|
+
note:
|
14
|
+
position: 2
|
15
|
+
|
16
|
+
subject_type_00003:
|
17
|
+
id: 3
|
18
|
+
name: object
|
19
|
+
display_name: Object
|
20
|
+
note:
|
21
|
+
position: 3
|
22
|
+
|
23
|
+
subject_type_00004:
|
24
|
+
id: 4
|
25
|
+
name: place
|
26
|
+
display_name: Place
|
27
|
+
note:
|
28
|
+
position: 4
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'active_record/fixtures'
|
2
|
+
desc "create initial records for enju_subject"
|
3
|
+
namespace :enju_subject do
|
4
|
+
task :setup => :environment do
|
5
|
+
Dir.glob(Rails.root.to_s + '/db/fixtures/enju_subject/*.yml').each do |file|
|
6
|
+
ActiveRecord::Fixtures.create_fixtures('db/fixtures/enju_subject', File.basename(file, '.*'))
|
7
|
+
end
|
8
|
+
|
9
|
+
puts 'initial fixture files loaded.'
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'import ndc from tsvfile'
|
13
|
+
task :import_ndc_from_tsvfile => :environment do
|
14
|
+
filename = ENV['filename'] || "#{Rails.root.to_s}/db/fixtures/ndlsh-tsv.tsv"
|
15
|
+
Classification.import_from_tsv(filename)
|
16
|
+
|
17
|
+
puts 'ndlsh file loaded.'
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,445 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'sunspot/rails/spec_helper'
|
3
|
+
|
4
|
+
describe ClassificationTypesController do
|
5
|
+
fixtures :all
|
6
|
+
disconnect_sunspot
|
7
|
+
|
8
|
+
def valid_attributes
|
9
|
+
FactoryGirl.attributes_for(:classification_type)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "GET index" do
|
13
|
+
before(:each) do
|
14
|
+
FactoryGirl.create(:classification_type)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "When logged in as Administrator" do
|
18
|
+
login_admin
|
19
|
+
|
20
|
+
it "assigns all classification_types as @classification_types" do
|
21
|
+
get :index
|
22
|
+
assigns(:classification_types).should eq(ClassificationType.all)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "When logged in as Librarian" do
|
27
|
+
login_librarian
|
28
|
+
|
29
|
+
it "assigns all classification_types as @classification_types" do
|
30
|
+
get :index
|
31
|
+
assigns(:classification_types).should eq(ClassificationType.all)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "When logged in as User" do
|
36
|
+
login_user
|
37
|
+
|
38
|
+
it "assigns all classification_types as @classification_types" do
|
39
|
+
get :index
|
40
|
+
assigns(:classification_types).should eq(ClassificationType.all)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "When not logged in" do
|
45
|
+
it "assigns all classification_types as @classification_types" do
|
46
|
+
get :index
|
47
|
+
assigns(:classification_types).should eq(ClassificationType.all)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "GET show" do
|
53
|
+
describe "When logged in as Administrator" do
|
54
|
+
login_admin
|
55
|
+
|
56
|
+
it "assigns the requested classification_type as @classification_type" do
|
57
|
+
classification_type = FactoryGirl.create(:classification_type)
|
58
|
+
get :show, :id => classification_type.id
|
59
|
+
assigns(:classification_type).should eq(classification_type)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "When logged in as Librarian" do
|
64
|
+
login_librarian
|
65
|
+
|
66
|
+
it "assigns the requested classification_type as @classification_type" do
|
67
|
+
classification_type = FactoryGirl.create(:classification_type)
|
68
|
+
get :show, :id => classification_type.id
|
69
|
+
assigns(:classification_type).should eq(classification_type)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "When logged in as User" do
|
74
|
+
login_user
|
75
|
+
|
76
|
+
it "assigns the requested classification_type as @classification_type" do
|
77
|
+
classification_type = FactoryGirl.create(:classification_type)
|
78
|
+
get :show, :id => classification_type.id
|
79
|
+
assigns(:classification_type).should eq(classification_type)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "When not logged in" do
|
84
|
+
it "assigns the requested classification_type as @classification_type" do
|
85
|
+
classification_type = FactoryGirl.create(:classification_type)
|
86
|
+
get :show, :id => classification_type.id
|
87
|
+
assigns(:classification_type).should eq(classification_type)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "GET new" do
|
93
|
+
describe "When logged in as Administrator" do
|
94
|
+
login_admin
|
95
|
+
|
96
|
+
it "assigns the requested classification_type as @classification_type" do
|
97
|
+
get :new
|
98
|
+
assigns(:classification_type).should_not be_valid
|
99
|
+
response.should be_success
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "When logged in as Librarian" do
|
104
|
+
login_librarian
|
105
|
+
|
106
|
+
it "should not assign the requested classification_type as @classification_type" do
|
107
|
+
get :new
|
108
|
+
assigns(:classification_type).should_not be_valid
|
109
|
+
response.should be_forbidden
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "When logged in as User" do
|
114
|
+
login_user
|
115
|
+
|
116
|
+
it "should not assign the requested classification_type as @classification_type" do
|
117
|
+
get :new
|
118
|
+
assigns(:classification_type).should_not be_valid
|
119
|
+
response.should be_forbidden
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "When not logged in" do
|
124
|
+
it "should not assign the requested classification_type as @classification_type" do
|
125
|
+
get :new
|
126
|
+
assigns(:classification_type).should_not be_valid
|
127
|
+
response.should redirect_to(new_user_session_url)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe "GET edit" do
|
133
|
+
describe "When logged in as Administrator" do
|
134
|
+
login_admin
|
135
|
+
|
136
|
+
it "assigns the requested classification_type as @classification_type" do
|
137
|
+
classification_type = FactoryGirl.create(:classification_type)
|
138
|
+
get :edit, :id => classification_type.id
|
139
|
+
assigns(:classification_type).should eq(classification_type)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe "When logged in as Librarian" do
|
144
|
+
login_librarian
|
145
|
+
|
146
|
+
it "assigns the requested classification_type as @classification_type" do
|
147
|
+
classification_type = FactoryGirl.create(:classification_type)
|
148
|
+
get :edit, :id => classification_type.id
|
149
|
+
response.should be_forbidden
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "When logged in as User" do
|
154
|
+
login_user
|
155
|
+
|
156
|
+
it "assigns the requested classification_type as @classification_type" do
|
157
|
+
classification_type = FactoryGirl.create(:classification_type)
|
158
|
+
get :edit, :id => classification_type.id
|
159
|
+
response.should be_forbidden
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe "When not logged in" do
|
164
|
+
it "should not assign the requested classification_type as @classification_type" do
|
165
|
+
classification_type = FactoryGirl.create(:classification_type)
|
166
|
+
get :edit, :id => classification_type.id
|
167
|
+
response.should redirect_to(new_user_session_url)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe "POST create" do
|
173
|
+
before(:each) do
|
174
|
+
@attrs = valid_attributes
|
175
|
+
@invalid_attrs = {:name => ''}
|
176
|
+
end
|
177
|
+
|
178
|
+
describe "When logged in as Administrator" do
|
179
|
+
login_admin
|
180
|
+
|
181
|
+
describe "with valid params" do
|
182
|
+
it "assigns a newly created classification_type as @classification_type" do
|
183
|
+
post :create, :classification_type => @attrs
|
184
|
+
assigns(:classification_type).should be_valid
|
185
|
+
end
|
186
|
+
|
187
|
+
it "redirects to the created agent" do
|
188
|
+
post :create, :classification_type => @attrs
|
189
|
+
response.should redirect_to(assigns(:classification_type))
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
describe "with invalid params" do
|
194
|
+
it "assigns a newly created but unsaved classification_type as @classification_type" do
|
195
|
+
post :create, :classification_type => @invalid_attrs
|
196
|
+
assigns(:classification_type).should_not be_valid
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should be successful" do
|
200
|
+
post :create, :classification_type => @invalid_attrs
|
201
|
+
response.should be_success
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe "When logged in as Librarian" do
|
207
|
+
login_librarian
|
208
|
+
|
209
|
+
describe "with valid params" do
|
210
|
+
it "assigns a newly created classification_type as @classification_type" do
|
211
|
+
post :create, :classification_type => @attrs
|
212
|
+
assigns(:classification_type).should be_valid
|
213
|
+
end
|
214
|
+
|
215
|
+
it "should be forbidden" do
|
216
|
+
post :create, :classification_type => @attrs
|
217
|
+
response.should be_forbidden
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe "with invalid params" do
|
222
|
+
it "assigns a newly created but unsaved classification_type as @classification_type" do
|
223
|
+
post :create, :classification_type => @invalid_attrs
|
224
|
+
assigns(:classification_type).should_not be_valid
|
225
|
+
end
|
226
|
+
|
227
|
+
it "should be forbidden" do
|
228
|
+
post :create, :classification_type => @invalid_attrs
|
229
|
+
response.should be_forbidden
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
describe "When logged in as User" do
|
235
|
+
login_user
|
236
|
+
|
237
|
+
describe "with valid params" do
|
238
|
+
it "assigns a newly created classification_type as @classification_type" do
|
239
|
+
post :create, :classification_type => @attrs
|
240
|
+
assigns(:classification_type).should be_valid
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should be forbidden" do
|
244
|
+
post :create, :classification_type => @attrs
|
245
|
+
response.should be_forbidden
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
describe "with invalid params" do
|
250
|
+
it "assigns a newly created but unsaved classification_type as @classification_type" do
|
251
|
+
post :create, :classification_type => @invalid_attrs
|
252
|
+
assigns(:classification_type).should_not be_valid
|
253
|
+
end
|
254
|
+
|
255
|
+
it "should be forbidden" do
|
256
|
+
post :create, :classification_type => @invalid_attrs
|
257
|
+
response.should be_forbidden
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe "When not logged in" do
|
263
|
+
describe "with valid params" do
|
264
|
+
it "assigns a newly created classification_type as @classification_type" do
|
265
|
+
post :create, :classification_type => @attrs
|
266
|
+
assigns(:classification_type).should be_valid
|
267
|
+
end
|
268
|
+
|
269
|
+
it "should be forbidden" do
|
270
|
+
post :create, :classification_type => @attrs
|
271
|
+
response.should redirect_to(new_user_session_url)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
describe "with invalid params" do
|
276
|
+
it "assigns a newly created but unsaved classification_type as @classification_type" do
|
277
|
+
post :create, :classification_type => @invalid_attrs
|
278
|
+
assigns(:classification_type).should_not be_valid
|
279
|
+
end
|
280
|
+
|
281
|
+
it "should be forbidden" do
|
282
|
+
post :create, :classification_type => @invalid_attrs
|
283
|
+
response.should redirect_to(new_user_session_url)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
describe "PUT update" do
|
290
|
+
before(:each) do
|
291
|
+
@classification_type = FactoryGirl.create(:classification_type)
|
292
|
+
@attrs = valid_attributes
|
293
|
+
@invalid_attrs = {:name => ''}
|
294
|
+
end
|
295
|
+
|
296
|
+
describe "When logged in as Administrator" do
|
297
|
+
login_admin
|
298
|
+
|
299
|
+
describe "with valid params" do
|
300
|
+
it "updates the requested classification_type" do
|
301
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs
|
302
|
+
end
|
303
|
+
|
304
|
+
it "assigns the requested classification_type as @classification_type" do
|
305
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs
|
306
|
+
assigns(:classification_type).should eq(@classification_type)
|
307
|
+
end
|
308
|
+
|
309
|
+
it "moves its position when specified" do
|
310
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs, :move => 'lower'
|
311
|
+
response.should redirect_to(classification_types_url)
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
describe "with invalid params" do
|
316
|
+
it "assigns the requested classification_type as @classification_type" do
|
317
|
+
put :update, :id => @classification_type.id, :classification_type => @invalid_attrs
|
318
|
+
response.should render_template("edit")
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
describe "When logged in as Librarian" do
|
324
|
+
login_librarian
|
325
|
+
|
326
|
+
describe "with valid params" do
|
327
|
+
it "updates the requested classification_type" do
|
328
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs
|
329
|
+
end
|
330
|
+
|
331
|
+
it "assigns the requested classification_type as @classification_type" do
|
332
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs
|
333
|
+
assigns(:classification_type).should eq(@classification_type)
|
334
|
+
response.should be_forbidden
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
describe "with invalid params" do
|
339
|
+
it "assigns the requested classification_type as @classification_type" do
|
340
|
+
put :update, :id => @classification_type.id, :classification_type => @invalid_attrs
|
341
|
+
response.should be_forbidden
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
describe "When logged in as User" do
|
347
|
+
login_user
|
348
|
+
|
349
|
+
describe "with valid params" do
|
350
|
+
it "updates the requested classification_type" do
|
351
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs
|
352
|
+
end
|
353
|
+
|
354
|
+
it "assigns the requested classification_type as @classification_type" do
|
355
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs
|
356
|
+
assigns(:classification_type).should eq(@classification_type)
|
357
|
+
response.should be_forbidden
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
describe "with invalid params" do
|
362
|
+
it "assigns the requested classification_type as @classification_type" do
|
363
|
+
put :update, :id => @classification_type.id, :classification_type => @invalid_attrs
|
364
|
+
response.should be_forbidden
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
describe "When not logged in" do
|
370
|
+
describe "with valid params" do
|
371
|
+
it "updates the requested classification_type" do
|
372
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs
|
373
|
+
end
|
374
|
+
|
375
|
+
it "should be forbidden" do
|
376
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs
|
377
|
+
response.should redirect_to(new_user_session_url)
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
describe "with invalid params" do
|
382
|
+
it "assigns the requested classification_type as @classification_type" do
|
383
|
+
put :update, :id => @classification_type.id, :classification_type => @invalid_attrs
|
384
|
+
response.should redirect_to(new_user_session_url)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
describe "DELETE destroy" do
|
391
|
+
before(:each) do
|
392
|
+
@classification_type = FactoryGirl.create(:classification_type)
|
393
|
+
end
|
394
|
+
|
395
|
+
describe "When logged in as Administrator" do
|
396
|
+
login_admin
|
397
|
+
|
398
|
+
it "destroys the requested classification_type" do
|
399
|
+
delete :destroy, :id => @classification_type.id
|
400
|
+
end
|
401
|
+
|
402
|
+
it "redirects to the classification_types list" do
|
403
|
+
delete :destroy, :id => @classification_type.id
|
404
|
+
response.should redirect_to(classification_types_url)
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
describe "When logged in as Librarian" do
|
409
|
+
login_librarian
|
410
|
+
|
411
|
+
it "destroys the requested classification_type" do
|
412
|
+
delete :destroy, :id => @classification_type.id
|
413
|
+
end
|
414
|
+
|
415
|
+
it "should be forbidden" do
|
416
|
+
delete :destroy, :id => @classification_type.id
|
417
|
+
response.should be_forbidden
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
describe "When logged in as User" do
|
422
|
+
login_user
|
423
|
+
|
424
|
+
it "destroys the requested classification_type" do
|
425
|
+
delete :destroy, :id => @classification_type.id
|
426
|
+
end
|
427
|
+
|
428
|
+
it "should be forbidden" do
|
429
|
+
delete :destroy, :id => @classification_type.id
|
430
|
+
response.should be_forbidden
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
describe "When not logged in" do
|
435
|
+
it "destroys the requested classification_type" do
|
436
|
+
delete :destroy, :id => @classification_type.id
|
437
|
+
end
|
438
|
+
|
439
|
+
it "should be forbidden" do
|
440
|
+
delete :destroy, :id => @classification_type.id
|
441
|
+
response.should redirect_to(new_user_session_url)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|