qa 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/qa/terms_controller.rb +14 -3
- data/lib/qa.rb +9 -0
- data/lib/qa/authorities.rb +1 -0
- data/lib/qa/authorities/authority_with_sub_authority.rb +18 -0
- data/lib/qa/authorities/base.rb +0 -15
- data/lib/qa/authorities/getty.rb +2 -7
- data/lib/qa/authorities/loc.rb +3 -9
- data/lib/qa/authorities/loc_subauthority.rb +1 -1
- data/lib/qa/authorities/local.rb +1 -7
- data/lib/qa/authorities/local_subauthority.rb +3 -0
- data/lib/qa/authorities/oclcts.rb +3 -8
- data/lib/qa/authorities/web_service_base.rb +1 -1
- data/lib/qa/version.rb +1 -1
- data/spec/controllers/terms_controller_spec.rb +2 -0
- data/spec/internal/db/development.sqlite3 +0 -0
- data/spec/internal/log/development.log +7451 -0
- data/spec/lib/authorities_loc_spec.rb +3 -4
- data/spec/lib/authorities_local_subauthorities_spec.rb +25 -17
- metadata +3 -2
@@ -53,10 +53,9 @@ describe Qa::Authorities::Loc do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should retain the raw respsonse from the LC service in JSON" do
|
56
|
-
expect
|
57
|
-
|
58
|
-
|
59
|
-
expect(authority.raw_response).to eq(json)
|
56
|
+
expect { authority.search("s") }.to change { authority.raw_response }.
|
57
|
+
from(nil).
|
58
|
+
to(JSON.parse(webmock_fixture("loc-response.txt").read))
|
60
59
|
end
|
61
60
|
|
62
61
|
describe "the returned results" do
|
@@ -2,42 +2,50 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Qa::Authorities::LocalSubauthority do
|
4
4
|
|
5
|
-
|
5
|
+
before do
|
6
6
|
class TestClass
|
7
7
|
include Qa::Authorities::LocalSubauthority
|
8
8
|
end
|
9
|
-
TestClass.new
|
10
9
|
end
|
11
10
|
|
11
|
+
after { Object.send(:remove_const, :TestClass) }
|
12
|
+
|
13
|
+
let(:test) { TestClass.new }
|
14
|
+
|
15
|
+
before { @original_path = AUTHORITIES_CONFIG[:local_path] }
|
16
|
+
after { AUTHORITIES_CONFIG[:local_path] = @original_path }
|
17
|
+
|
12
18
|
describe "#sub_authorities_path" do
|
13
|
-
before
|
14
|
-
@original_path = AUTHORITIES_CONFIG[:local_path]
|
15
|
-
end
|
16
|
-
after do
|
17
|
-
AUTHORITIES_CONFIG[:local_path] = @original_path
|
18
|
-
end
|
19
|
+
before { AUTHORITIES_CONFIG[:local_path] = path }
|
19
20
|
context "configured with a full path" do
|
20
|
-
|
21
|
-
|
22
|
-
end
|
21
|
+
let(:path) { "/full/path" }
|
22
|
+
|
23
23
|
it "returns a full path" do
|
24
|
-
expect(test.sub_authorities_path).to eq(
|
24
|
+
expect(test.sub_authorities_path).to eq(path)
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
27
28
|
context "configured with a relative path" do
|
28
|
-
|
29
|
-
|
30
|
-
end
|
29
|
+
let(:path) { "relative/path" }
|
30
|
+
|
31
31
|
it "returns a path relative to the Rails applicaition" do
|
32
|
-
expect(test.sub_authorities_path).to eq(File.join(Rails.root,
|
32
|
+
expect(test.sub_authorities_path).to eq(File.join(Rails.root, path))
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
describe "#names" do
|
37
|
+
describe "#names" do
|
38
38
|
it "returns a list of yaml files" do
|
39
39
|
expect(test.names).to include("authority_A", "authority_B", "authority_C", "authority_D", "states")
|
40
40
|
end
|
41
|
+
|
42
|
+
context "when the path doesn't exist" do
|
43
|
+
before { AUTHORITIES_CONFIG[:local_path] = '/foo/bar' }
|
44
|
+
|
45
|
+
it "raises an error" do
|
46
|
+
expect { test.names }.to raise_error Qa::ConfigDirectoryNotFound
|
47
|
+
end
|
48
|
+
end
|
41
49
|
end
|
42
50
|
|
43
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Anderson
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2015-04-
|
18
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|
@@ -213,6 +213,7 @@ files:
|
|
213
213
|
- lib/generators/qa/local/templates/config/authorities/states.yml
|
214
214
|
- lib/qa.rb
|
215
215
|
- lib/qa/authorities.rb
|
216
|
+
- lib/qa/authorities/authority_with_sub_authority.rb
|
216
217
|
- lib/qa/authorities/base.rb
|
217
218
|
- lib/qa/authorities/getty.rb
|
218
219
|
- lib/qa/authorities/loc.rb
|