qa 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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(authority.raw_response).to be_nil
57
- json = Qa::Authorities::WebServiceBase.new.get_json(authority.build_query_url("s"))
58
- authority.search("s")
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
- let :test do
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 do
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
- before do
21
- AUTHORITIES_CONFIG[:local_path] = "/full/path"
22
- end
21
+ let(:path) { "/full/path" }
22
+
23
23
  it "returns a full path" do
24
- expect(test.sub_authorities_path).to eq(AUTHORITIES_CONFIG[:local_path])
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
- before do
29
- AUTHORITIES_CONFIG[:local_path] = "relative/path"
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, AUTHORITIES_CONFIG[:local_path]))
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.2
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-06 00:00:00.000000000 Z
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