qa 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -10
- data/app/controllers/qa/terms_controller.rb +1 -1
- data/lib/qa/authorities.rb +0 -1
- data/lib/qa/authorities/base.rb +1 -1
- data/lib/qa/authorities/loc.rb +6 -0
- data/lib/qa/authorities/local.rb +0 -1
- data/lib/qa/authorities/mesh.rb +7 -1
- data/lib/qa/authorities/oclcts.rb +7 -1
- data/lib/qa/authorities/tgnlang.rb +6 -0
- data/lib/qa/authorities/web_service_base.rb +1 -1
- data/lib/qa/version.rb +1 -1
- data/spec/controllers/terms_controller_spec.rb +0 -6
- data/spec/fixtures/loc-names-response.txt +1733 -0
- data/spec/fixtures/loc-subjects-response.txt +1733 -0
- data/spec/internal/Gemfile +1 -1
- data/spec/internal/Gemfile.lock +55 -56
- data/spec/internal/config/initializers/secret_token.rb +1 -1
- data/spec/internal/config/routes.rb +0 -4
- data/spec/lib/authorities_loc_spec.rb +53 -19
- data/spec/lib/authorities_mesh_spec.rb +1 -1
- data/spec/lib/authorities_oclcts_spec.rb +2 -2
- data/spec/lib/tasks/mesh.rake_spec.rb +1 -1
- metadata +22 -96
- data/lib/qa/authorities/lcsh.rb +0 -41
- data/spec/fixtures/lcsh-response.txt +0 -1
- data/spec/internal/config/oclcts-authorities.yml +0 -24
- data/spec/internal/db/development.sqlite3 +0 -0
- data/spec/internal/db/migrate/20131106203101_create_qa_subject_mesh_terms.qa.rb +0 -12
- data/spec/internal/db/migrate/20131106203102_create_qa_mesh_tree.qa.rb +0 -11
- data/spec/internal/db/migrate/20131106203103_add_term_lower_to_qa_subject_mesh_terms.qa.rb +0 -8
- data/spec/internal/db/schema.rb +0 -34
- data/spec/internal/db/test.sqlite3 +0 -0
- data/spec/internal/log/development.log +0 -7046
- data/spec/lib/authorities_lcsh_spec.rb +0 -50
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Qa::Authorities::Lcsh do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
stub_request(:get, "http://id.loc.gov/authorities/suggest/?q=ABBA").
|
7
|
-
to_return(:body => webmock_fixture("lcsh-response.txt"), :status => 200)
|
8
|
-
@terms = Qa::Authorities::Lcsh.new
|
9
|
-
@terms.search("ABBA")
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
describe "presenting the results from LOC" do
|
14
|
-
|
15
|
-
it "has a list of responses" do
|
16
|
-
@terms.response.should be_kind_of Array
|
17
|
-
@terms.response.each do |item|
|
18
|
-
item.should be_kind_of Hash
|
19
|
-
item.keys.should == ["id", "label"]
|
20
|
-
end
|
21
|
-
@terms.response.map { |item| item["label"] }.should include "ABBA (Musical group)"
|
22
|
-
@terms.response.map { |item| item["id"] }.should include "n78090836"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#build_response" do
|
27
|
-
it "should set .response to be an array of hashes in the id/label structure" do
|
28
|
-
sample = { "id"=>"n92117993", "label"=>"Abba (Nigeria)" }
|
29
|
-
# use #send since build_response is private
|
30
|
-
r = @terms.send(:build_response,
|
31
|
-
["ABBA",
|
32
|
-
["ABBA (Musical group)",
|
33
|
-
"ABBA (Musical group). Gold",
|
34
|
-
"ABBA (Organization)",
|
35
|
-
"Abba (Nigeria)"],
|
36
|
-
["1 result",
|
37
|
-
"1 result",
|
38
|
-
"1 result",
|
39
|
-
"1 result" ],
|
40
|
-
["http://id.loc.gov/authorities/names/n78090836",
|
41
|
-
"http://id.loc.gov/authorities/names/n2003148504",
|
42
|
-
"http://id.loc.gov/authorities/names/no2012083395",
|
43
|
-
"http://id.loc.gov/authorities/names/n92117993"]]
|
44
|
-
)
|
45
|
-
r.should be_kind_of Array
|
46
|
-
r.should include sample
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|