qa 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -23
- data/Rakefile +9 -6
- data/lib/generators/qa/install/USAGE +5 -0
- data/lib/generators/qa/install/install_generator.rb +13 -0
- data/lib/generators/qa/install/templates/config/oclcts-authorities.yml +24 -0
- data/lib/qa/authorities/loc.rb +35 -18
- data/lib/qa/version.rb +1 -1
- data/spec/controllers/terms_controller_spec.rb +10 -10
- data/spec/fixtures/loc-response.txt +85 -2
- data/spec/internal/Gemfile +4 -6
- data/spec/internal/Gemfile.lock +42 -65
- data/spec/internal/config/application.rb +1 -1
- data/spec/internal/config/boot.rb +1 -1
- data/spec/internal/config/initializers/secret_token.rb +1 -1
- data/spec/internal/config/oclcts-authorities.yml +24 -0
- data/spec/internal/config/routes.rb +2 -0
- data/spec/internal/db/development.sqlite3 +0 -0
- data/spec/internal/db/migrate/20140611161143_create_qa_subject_mesh_terms.qa.rb +12 -0
- data/spec/internal/db/migrate/20140611161144_create_qa_mesh_tree.qa.rb +11 -0
- data/spec/internal/db/migrate/20140611161145_add_term_lower_to_qa_subject_mesh_terms.qa.rb +8 -0
- data/spec/internal/db/schema.rb +34 -0
- data/spec/internal/db/test.sqlite3 +0 -0
- data/spec/internal/lib/generators/test_app_generator.rb +13 -11
- data/spec/internal/log/development.log +212 -0
- data/spec/internal/public/robots.txt +1 -1
- data/spec/lib/authorities_loc_spec.rb +21 -0
- data/spec/spec_helper.rb +5 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +22 -0
- metadata +57 -24
- data/spec/support/lib/generators/test_app_generator.rb +0 -20
@@ -4,7 +4,7 @@ require 'rails/all'
|
|
4
4
|
|
5
5
|
# Require the gems listed in Gemfile, including any gems
|
6
6
|
# you've limited to :test, :development, or :production.
|
7
|
-
Bundler.require(
|
7
|
+
Bundler.require(*Rails.groups)
|
8
8
|
|
9
9
|
module Internal
|
10
10
|
class Application < Rails::Application
|
@@ -9,4 +9,4 @@
|
|
9
9
|
|
10
10
|
# Make sure your secret_key_base is kept private
|
11
11
|
# if you're sharing your code publicly.
|
12
|
-
Internal::Application.config.secret_key_base = '
|
12
|
+
Internal::Application.config.secret_key_base = 'ac3130ff074153869235aade642f0cab7fb3aa43cae4e302b75cb577542e2b5f74f6e5ff105065d1a1f3692ec8307ac0242f11e60c91b8749fe2262ed7460fae'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
url-pattern:
|
2
|
+
prefix-query: http://tspilot.oclc.org/{authority-id}/?query=oclcts.rootHeading+exact+%22{query}*%22&version=1.1&operation=searchRetrieve&recordSchema=http%3A%2F%2Fzthes.z3950.org%2Fxml%2F1.0%2F&maximumRecords=10&startRecord=1&resultSetTTL=300&recordPacking=xml&recordXPath=&sortKeys=
|
3
|
+
id-lookup: http://tspilot.oclc.org/{authority-id}/?query=dc.identifier+exact+%22{id}%22&version=1.1&operation=searchRetrieve&recordSchema=http%3A%2F%2Fzthes.z3950.org%2Fxml%2F1.0%2F&maximumRecords=10&startRecord=1&resultSetTTL=300&recordPacking=xml&recordXPath=&sortKeys=
|
4
|
+
authorities:
|
5
|
+
lcgft:
|
6
|
+
name: Library of Congress Genre/Form Terms for Library and Archival Materials (LCGFT)
|
7
|
+
bisacsh:
|
8
|
+
name: Book Industry Study Group Subject Headings (BISAC®). Used with permission.
|
9
|
+
fast:
|
10
|
+
name: Faceted Application of Subject Terminology (FAST subject headings)
|
11
|
+
gsafd:
|
12
|
+
name: Form and genre headings for fiction and drama
|
13
|
+
lcshac:
|
14
|
+
name: Library of Congress AC Subject Headings
|
15
|
+
lcsh:
|
16
|
+
name: Library of Congress Subject Headings
|
17
|
+
mesh:
|
18
|
+
name: Medical Subject Headings (MeSH®)
|
19
|
+
lctgm:
|
20
|
+
name: "Thesaurus for graphic materials: TGM I, Subject terms"
|
21
|
+
gmgpc:
|
22
|
+
name: "Thesaurus for graphic materials: TGM II, Genre terms"
|
23
|
+
meta:
|
24
|
+
name: Controlled Vocabulary Metadata
|
Binary file
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This migration comes from qa (originally 20130917200611)
|
2
|
+
class CreateQaSubjectMeshTerms < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
create_table :qa_subject_mesh_terms do |t|
|
5
|
+
t.string :term_id
|
6
|
+
t.string :term
|
7
|
+
t.text :synonyms
|
8
|
+
end
|
9
|
+
add_index :qa_subject_mesh_terms, :term_id
|
10
|
+
add_index :qa_subject_mesh_terms, :term
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This migration comes from qa (originally 20130917201026)
|
2
|
+
class CreateQaMeshTree < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
create_table :qa_mesh_trees do |t|
|
5
|
+
t.string :term_id
|
6
|
+
t.string :tree_number
|
7
|
+
end
|
8
|
+
add_index :qa_mesh_trees, :term_id
|
9
|
+
add_index :qa_mesh_trees, :tree_number
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# This migration comes from qa (originally 20130918141523)
|
2
|
+
class AddTermLowerToQaSubjectMeshTerms < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
add_column :qa_subject_mesh_terms, :term_lower, :string
|
5
|
+
add_index :qa_subject_mesh_terms, :term_lower
|
6
|
+
remove_index :qa_subject_mesh_terms, :term
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20140611161145) do
|
15
|
+
|
16
|
+
create_table "qa_mesh_trees", force: true do |t|
|
17
|
+
t.string "term_id"
|
18
|
+
t.string "tree_number"
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index "qa_mesh_trees", ["term_id"], name: "index_qa_mesh_trees_on_term_id"
|
22
|
+
add_index "qa_mesh_trees", ["tree_number"], name: "index_qa_mesh_trees_on_tree_number"
|
23
|
+
|
24
|
+
create_table "qa_subject_mesh_terms", force: true do |t|
|
25
|
+
t.string "term_id"
|
26
|
+
t.string "term"
|
27
|
+
t.text "synonyms"
|
28
|
+
t.string "term_lower"
|
29
|
+
end
|
30
|
+
|
31
|
+
add_index "qa_subject_mesh_terms", ["term_id"], name: "index_qa_subject_mesh_terms_on_term_id"
|
32
|
+
add_index "qa_subject_mesh_terms", ["term_lower"], name: "index_qa_subject_mesh_terms_on_term_lower"
|
33
|
+
|
34
|
+
end
|
Binary file
|
@@ -1,20 +1,22 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
|
3
3
|
class TestAppGenerator < Rails::Generators::Base
|
4
|
-
source_root
|
4
|
+
source_root "./spec/test_app_templates"
|
5
5
|
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
mount Qa::Engine => '/qa'
|
11
|
-
|
12
|
-
}
|
6
|
+
def update_app
|
7
|
+
Bundler.with_clean_env do
|
8
|
+
run "bundle install"
|
13
9
|
end
|
14
10
|
end
|
15
11
|
|
16
|
-
def
|
17
|
-
|
12
|
+
def run_qa_installer
|
13
|
+
generate "qa:install"
|
14
|
+
end
|
15
|
+
|
16
|
+
def run_migrations
|
17
|
+
rake "qa:install:migrations"
|
18
|
+
rake "db:migrate"
|
19
|
+
rake "db:test:prepare"
|
18
20
|
end
|
19
21
|
|
20
|
-
end
|
22
|
+
end
|
@@ -0,0 +1,212 @@
|
|
1
|
+
[1m[36m (8.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
+
Migrating to CreateQaSubjectMeshTerms (20140611161143)
|
5
|
+
[1m[35m (0.1ms)[0m begin transaction
|
6
|
+
[1m[36m (0.3ms)[0m [1mCREATE TABLE "qa_subject_mesh_terms" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "term_id" varchar(255), "term" varchar(255), "synonyms" text) [0m
|
7
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_qa_subject_mesh_terms_on_term_id" ON "qa_subject_mesh_terms" ("term_id")
|
8
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_qa_subject_mesh_terms_on_term" ON "qa_subject_mesh_terms" ("term")[0m
|
9
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140611161143"]]
|
10
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
11
|
+
Migrating to CreateQaMeshTree (20140611161144)
|
12
|
+
[1m[35m (0.0ms)[0m begin transaction
|
13
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "qa_mesh_trees" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "term_id" varchar(255), "tree_number" varchar(255)) [0m
|
14
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_qa_mesh_trees_on_term_id" ON "qa_mesh_trees" ("term_id")
|
15
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_qa_mesh_trees_on_tree_number" ON "qa_mesh_trees" ("tree_number")[0m
|
16
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140611161144"]]
|
17
|
+
[1m[36m (0.6ms)[0m [1mcommit transaction[0m
|
18
|
+
Migrating to AddTermLowerToQaSubjectMeshTerms (20140611161145)
|
19
|
+
[1m[35m (0.0ms)[0m begin transaction
|
20
|
+
[1m[36m (0.3ms)[0m [1mALTER TABLE "qa_subject_mesh_terms" ADD "term_lower" varchar(255)[0m
|
21
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_qa_subject_mesh_terms_on_term_lower" ON "qa_subject_mesh_terms" ("term_lower")
|
22
|
+
[1m[36m (0.7ms)[0m [1mDROP INDEX "index_qa_subject_mesh_terms_on_term"[0m
|
23
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140611161145"]]
|
24
|
+
[1m[36m (0.6ms)[0m [1mcommit transaction[0m
|
25
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
26
|
+
[1m[36m (9.1ms)[0m [1mCREATE TABLE "qa_mesh_trees" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "term_id" varchar(255), "tree_number" varchar(255)) [0m
|
27
|
+
[1m[35m (0.8ms)[0m CREATE INDEX "index_qa_mesh_trees_on_term_id" ON "qa_mesh_trees" ("term_id")
|
28
|
+
[1m[36m (0.7ms)[0m [1mCREATE INDEX "index_qa_mesh_trees_on_tree_number" ON "qa_mesh_trees" ("tree_number")[0m
|
29
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "qa_subject_mesh_terms" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "term_id" varchar(255), "term" varchar(255), "synonyms" text, "term_lower" varchar(255))
|
30
|
+
[1m[36m (0.7ms)[0m [1mCREATE INDEX "index_qa_subject_mesh_terms_on_term_id" ON "qa_subject_mesh_terms" ("term_id")[0m
|
31
|
+
[1m[35m (0.8ms)[0m CREATE INDEX "index_qa_subject_mesh_terms_on_term_lower" ON "qa_subject_mesh_terms" ("term_lower")
|
32
|
+
[1m[36m (0.8ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
33
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
34
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
35
|
+
[1m[35m (0.7ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20140611161145')
|
36
|
+
[1m[36m (0.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20140611161143')[0m
|
37
|
+
[1m[35m (0.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20140611161144')
|
38
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
39
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
40
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "qa_mesh_trees" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "term_id" varchar(255), "tree_number" varchar(255)) [0m
|
41
|
+
[1m[35m (0.6ms)[0m CREATE INDEX "index_qa_mesh_trees_on_term_id" ON "qa_mesh_trees" ("term_id")
|
42
|
+
[1m[36m (0.6ms)[0m [1mCREATE INDEX "index_qa_mesh_trees_on_tree_number" ON "qa_mesh_trees" ("tree_number")[0m
|
43
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "qa_subject_mesh_terms" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "term_id" varchar(255), "term" varchar(255), "synonyms" text, "term_lower" varchar(255))
|
44
|
+
[1m[36m (0.7ms)[0m [1mCREATE INDEX "index_qa_subject_mesh_terms_on_term_id" ON "qa_subject_mesh_terms" ("term_id")[0m
|
45
|
+
[1m[35m (1.3ms)[0m CREATE INDEX "index_qa_subject_mesh_terms_on_term_lower" ON "qa_subject_mesh_terms" ("term_lower")
|
46
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
47
|
+
[1m[35m (0.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
48
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
49
|
+
[1m[35m (0.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20140611161145')
|
50
|
+
[1m[36m (0.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20140611161143')[0m
|
51
|
+
[1m[35m (1.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20140611161144')
|
52
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
53
|
+
[1m[35m (0.1ms)[0m begin transaction
|
54
|
+
Processing by Qa::TermsController#index as HTML
|
55
|
+
Parameters: {"q"=>"foo", "vocab"=>"loc", "sub_authority"=>"foo"}
|
56
|
+
Filter chain halted as :check_sub_authority rendered or redirected
|
57
|
+
Completed 400 Bad Request in 0ms (ActiveRecord: 0.0ms)
|
58
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
59
|
+
[1m[35m (0.0ms)[0m begin transaction
|
60
|
+
Processing by Qa::TermsController#index as HTML
|
61
|
+
Parameters: {"vocab"=>nil}
|
62
|
+
Filter chain halted as :check_vocab_param rendered or redirected
|
63
|
+
Completed 400 Bad Request in 0ms (ActiveRecord: 0.0ms)
|
64
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
65
|
+
[1m[35m (0.0ms)[0m begin transaction
|
66
|
+
Processing by Qa::TermsController#index as HTML
|
67
|
+
Parameters: {"q"=>"foo", "vocab"=>"bar"}
|
68
|
+
Filter chain halted as :check_authority rendered or redirected
|
69
|
+
Completed 400 Bad Request in 1ms (ActiveRecord: 0.0ms)
|
70
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
71
|
+
[1m[35m (0.1ms)[0m begin transaction
|
72
|
+
Processing by Qa::TermsController#index as HTML
|
73
|
+
Parameters: {"q"=>nil}
|
74
|
+
Filter chain halted as :check_vocab_param rendered or redirected
|
75
|
+
Completed 400 Bad Request in 0ms (ActiveRecord: 0.0ms)
|
76
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
77
|
+
[1m[35m (0.0ms)[0m begin transaction
|
78
|
+
Processing by Qa::TermsController#index as HTML
|
79
|
+
Parameters: {"q"=>"foo", "vocab"=>"loc", "sub_authority"=>"relators"}
|
80
|
+
Completed 200 OK in 5ms (Views: 0.3ms | ActiveRecord: 0.0ms)
|
81
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
82
|
+
[1m[35m (0.1ms)[0m begin transaction
|
83
|
+
Processing by Qa::TermsController#index as HTML
|
84
|
+
Parameters: {"q"=>"Tibetan", "vocab"=>"tgnlang"}
|
85
|
+
Completed 200 OK in 9ms (Views: 0.2ms | ActiveRecord: 0.0ms)
|
86
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
87
|
+
[1m[35m (0.1ms)[0m begin transaction
|
88
|
+
Processing by Qa::TermsController#index as HTML
|
89
|
+
Parameters: {"q"=>"foo", "vocab"=>"loc"}
|
90
|
+
Completed 200 OK in 5ms (Views: 0.2ms | ActiveRecord: 0.0ms)
|
91
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
92
|
+
[1m[35m (0.0ms)[0m begin transaction
|
93
|
+
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
94
|
+
[1m[35mClass Create Many Without Validations Or Callbacks (0.5ms)[0m INSERT INTO "qa_subject_mesh_terms" ("term_id","term","term_lower","synonyms") VALUES ('D008288','Malaria','malaria','Marsh Fever|Plasmodium Infections|Remittent Fever|Infections, Plasmodium|Paludism|Fever, Marsh|Fever, Remittent|Infection, Plasmodium|Plasmodium Infection'),('D000001','Calcimycin','calcimycin','A-23187|A23187|Antibiotic A23187|A 23187|A23187, Antibiotic'),('D005260','Female','female','Females'),('D005261','Female Urogenital Diseases and Pregnancy Complications','female urogenital diseases and pregnancy complications',''),('D010272','Parasitic Diseases','parasitic diseases','Disease, Parasitic|Diseases, Parasitic|Parasitic Disease'),('D011528','Protozoan Infections','protozoan infections','Histomoniasis|Infections, Protozoan|Histomoniases|Infection, Protozoan|Protozoan Infection'),('D062310','Tropical Diseases','tropical diseases','Disease, Tropical|Diseases, Tropical|Tropical Disease'),('D013568','Pathological Conditions, Signs and Symptoms','pathological conditions, signs and symptoms','Symptoms and General Pathology'),('D001583','Benzoxazoles','benzoxazoles',''),('D006574','Heterocyclic Compounds, 2-Ring','heterocyclic compounds, 2-ring','2-Ring Heterocyclic Compounds|Compounds, 2-Ring Heterocyclic|Heterocyclic Compounds, 2 Ring'),('D006571','Heterocyclic Compounds','heterocyclic compounds','Compounds, Heterocyclic')
|
95
|
+
[1m[36mClass Create Many Without Validations Or Callbacks (0.3ms)[0m [1mINSERT INTO "qa_mesh_trees" ("term_id","tree_number") VALUES ('D008288','C03.752.530'),('D008288','C23.996.660'),('D000001','D03.438.221.173'),('D005261','C13'),('D010272','C03'),('D011528','C03.752'),('D062310','C03.883'),('D062310','C23.996'),('D013568','C23'),('D001583','D03.438.221'),('D006574','D03.438'),('D006571','D03')[0m
|
96
|
+
[1m[35mQa::SubjectMeshTerm Load (0.1ms)[0m SELECT "qa_subject_mesh_terms".* FROM "qa_subject_mesh_terms" WHERE "qa_subject_mesh_terms"."term_lower" = 'malaria'
|
97
|
+
[1m[36mQa::SubjectMeshTerm Load (0.1ms)[0m [1mSELECT "qa_subject_mesh_terms".* FROM "qa_subject_mesh_terms" WHERE "qa_subject_mesh_terms"."term" = 'Malaria'[0m
|
98
|
+
[1m[35mQa::SubjectMeshTerm Load (0.1ms)[0m SELECT "qa_subject_mesh_terms".* FROM "qa_subject_mesh_terms" WHERE "qa_subject_mesh_terms"."term_id" = 'D008288'
|
99
|
+
[1m[36mQa::SubjectMeshTerm Load (0.1ms)[0m [1mSELECT "qa_subject_mesh_terms".* FROM "qa_subject_mesh_terms"[0m
|
100
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
101
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
102
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "qa_subject_mesh_terms" ("term", "term_id", "term_lower") VALUES (?, ?, ?) [["term", "Mr Plow"], ["term_id", "1"], ["term_lower", "mr plow"]]
|
103
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
104
|
+
[1m[35m (0.1ms)[0m begin transaction
|
105
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "qa_subject_mesh_terms" ("term", "term_id", "term_lower") VALUES (?, ?, ?)[0m [["term", "Mr Snow"], ["term_id", "2"], ["term_lower", "mr snow"]]
|
106
|
+
[1m[35m (0.5ms)[0m commit transaction
|
107
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
108
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "qa_subject_mesh_terms" ("term", "term_id", "term_lower") VALUES (?, ?, ?) [["term", "Mrs Fields"], ["term_id", "3"], ["term_lower", "mrs fields"]]
|
109
|
+
[1m[36m (0.5ms)[0m [1mcommit transaction[0m
|
110
|
+
[1m[35m (0.0ms)[0m begin transaction
|
111
|
+
[1m[36mQa::SubjectMeshTerm Load (0.2ms)[0m [1mSELECT "qa_subject_mesh_terms".* FROM "qa_subject_mesh_terms" WHERE (term_lower LIKE 'mr%') LIMIT 10[0m
|
112
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
113
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
114
|
+
[1m[35mQa::SubjectMeshTerm Load (0.2ms)[0m SELECT "qa_subject_mesh_terms".* FROM "qa_subject_mesh_terms" WHERE "qa_subject_mesh_terms"."term_id" = '2' ORDER BY "qa_subject_mesh_terms"."id" ASC LIMIT 1
|
115
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
116
|
+
[1m[35mSQL (0.7ms)[0m DELETE FROM "qa_subject_mesh_terms"
|
117
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
118
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
119
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
120
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
121
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
122
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
123
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
124
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
125
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
126
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
127
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
128
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
129
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
130
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
131
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
132
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
133
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
134
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
135
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
136
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
137
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
138
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
139
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
140
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
141
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
142
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
143
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
144
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
145
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
146
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
147
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
148
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
149
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
150
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "qa_subject_mesh_terms" ("term", "term_id") VALUES (?, ?) [["term", "Glyphon"], ["term_id", "ABCDEFG"]]
|
151
|
+
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
152
|
+
[1m[35m (0.0ms)[0m begin transaction
|
153
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
154
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "qa_mesh_trees" ("term_id", "tree_number") VALUES (?, ?) [["term_id", "ABCDEFG"], ["tree_number", "D1.2.3.4"]]
|
155
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
156
|
+
[1m[35mQa::SubjectMeshTerm Load (0.1ms)[0m SELECT "qa_subject_mesh_terms".* FROM "qa_subject_mesh_terms" INNER JOIN qa_mesh_trees ON qa_subject_mesh_terms.term_id = qa_mesh_trees.term_id WHERE (qa_mesh_trees.tree_number = 'D1.2.3.4')
|
157
|
+
[1m[36m (0.3ms)[0m [1mrollback transaction[0m
|
158
|
+
[1m[35m (0.1ms)[0m begin transaction
|
159
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
160
|
+
[1m[35m (0.0ms)[0m begin transaction
|
161
|
+
[1m[36mQa::MeshTree Load (0.1ms)[0m [1mSELECT "qa_mesh_trees".* FROM "qa_mesh_trees" WHERE "qa_mesh_trees"."term_id" = 'ABCDEFG'[0m
|
162
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
163
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
164
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
165
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "qa_subject_mesh_terms" ("synonyms", "term_id") VALUES (?, ?)[0m [["synonyms", "b|c"], ["term_id", "a"]]
|
166
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
167
|
+
[1m[36m (0.4ms)[0m [1mrollback transaction[0m
|
168
|
+
[1m[35m (0.1ms)[0m begin transaction
|
169
|
+
[1m[36mSQL (2.7ms)[0m [1mDELETE FROM "qa_subject_mesh_terms" WHERE "qa_subject_mesh_terms"."id" = ?[0m [["id", 4]]
|
170
|
+
[1m[35m (0.6ms)[0m commit transaction
|
171
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
172
|
+
[1m[35mClass Create Many Without Validations Or Callbacks (0.3ms)[0m INSERT INTO "qa_subject_mesh_terms" ("term_id","term","term_lower","synonyms") VALUES ('5','test','test','')
|
173
|
+
[1m[36mQa::SubjectMeshTerm Load (0.1ms)[0m [1mSELECT "qa_subject_mesh_terms".* FROM "qa_subject_mesh_terms" WHERE "qa_subject_mesh_terms"."term_id" = 5 LIMIT 1[0m
|
174
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
175
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
176
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
177
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
178
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
179
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
180
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
181
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
182
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
183
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
184
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
185
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
186
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
187
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
188
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
189
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
190
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
191
|
+
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
192
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
193
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
194
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
195
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
196
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
197
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
198
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
199
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
200
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
201
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
202
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
203
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
204
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
205
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
206
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
207
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
208
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
209
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
210
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
211
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
212
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# See http://www.robotstxt.org/
|
1
|
+
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
2
2
|
#
|
3
3
|
# To ban all spiders from the entire site uncomment the next two lines:
|
4
4
|
# User-agent: *
|
@@ -67,4 +67,25 @@ describe Qa::Authorities::Loc do
|
|
67
67
|
|
68
68
|
end
|
69
69
|
|
70
|
+
describe "#parse_authority_response" do
|
71
|
+
before :all do
|
72
|
+
stub_request(:get, "http://id.loc.gov/search/?format=json&q=h&q=cs:http://id.loc.gov/authorities/subjects").
|
73
|
+
with(:headers => {'Accept'=>'application/json'}).
|
74
|
+
to_return(:body => webmock_fixture("loc-response.txt"), :status => 200)
|
75
|
+
@authority.search("h", "subjects")
|
76
|
+
end
|
77
|
+
|
78
|
+
let(:parsed_response) { @authority.parse_authority_response(@authority.raw_response) }
|
79
|
+
|
80
|
+
it "should return an array of entries returned in the JSON" do
|
81
|
+
expect(parsed_response.length).to eq(2)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should have a URI for the id and a string label" do
|
85
|
+
expect(parsed_response[0]["id"]).to eq("info:lc/authorities/names/n2008008718")
|
86
|
+
expect(parsed_response[0]["label"]).to eq("Haw, Lily, 1890?-1915")
|
87
|
+
expect(parsed_response[1]["id"]).to eq("info:lc/vocabulary/geographicAreas/n-us-hi")
|
88
|
+
expect(parsed_response[1]["label"]).to eq("Hawaii")
|
89
|
+
end
|
90
|
+
end
|
70
91
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path("../internal/config/environment.rb", __FILE__)
|
2
2
|
require 'rspec/rails'
|
3
|
-
require 'rspec/autorun'
|
4
3
|
require 'webmock/rspec'
|
4
|
+
require 'engine_cart'
|
5
5
|
|
6
6
|
ENV["RAILS_ENV"] ||= 'test'
|
7
7
|
|
@@ -11,6 +11,8 @@ if ENV['COVERAGE']
|
|
11
11
|
SimpleCov.command_name "spec"
|
12
12
|
end
|
13
13
|
|
14
|
+
EngineCart.load_application!
|
15
|
+
|
14
16
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
15
17
|
# in spec/support/ and its subdirectories.
|
16
18
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
@@ -49,6 +51,8 @@ RSpec.configure do |config|
|
|
49
51
|
|
50
52
|
# Disable Webmock if we choose so we can test against the authorities, instead of their mocks
|
51
53
|
WebMock.disable! if ENV["WEBMOCK"] == "disabled"
|
54
|
+
|
55
|
+
config.infer_spec_type_from_file_location!
|
52
56
|
end
|
53
57
|
|
54
58
|
def webmock_fixture fixture
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class TestAppGenerator < Rails::Generators::Base
|
4
|
+
source_root "./spec/test_app_templates"
|
5
|
+
|
6
|
+
def update_app
|
7
|
+
Bundler.with_clean_env do
|
8
|
+
run "bundle install"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_qa_installer
|
13
|
+
generate "qa:install"
|
14
|
+
end
|
15
|
+
|
16
|
+
def run_migrations
|
17
|
+
rake "qa:install:migrations"
|
18
|
+
rake "db:migrate"
|
19
|
+
rake "db:test:prepare"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|