allscripts_unity_client 4.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/allscripts_unity_client.rb +4 -0
- data/lib/allscripts_unity_client/client.rb +11 -4
- data/lib/allscripts_unity_client/client_driver.rb +15 -5
- data/lib/allscripts_unity_client/client_options.rb +13 -4
- data/lib/allscripts_unity_client/json_client_driver.rb +37 -3
- data/lib/allscripts_unity_client/unity_request.rb +9 -2
- data/lib/allscripts_unity_client/version.rb +1 -1
- metadata +20 -59
- data/.gitignore +0 -21
- data/.rspec +0 -2
- data/.rubocop.yml +0 -340
- data/.travis.yml +0 -11
- data/Gemfile +0 -2
- data/LICENSE +0 -22
- data/README.md +0 -347
- data/Rakefile +0 -7
- data/allscripts_unity_client.gemspec +0 -40
- data/spec/allscripts_unity_client_spec.rb +0 -30
- data/spec/client_driver_spec.rb +0 -23
- data/spec/client_options_spec.rb +0 -185
- data/spec/client_spec.rb +0 -471
- data/spec/factories/allscripts_unity_client_parameters_factory.rb +0 -18
- data/spec/factories/client_driver_factory.rb +0 -20
- data/spec/factories/client_factory.rb +0 -9
- data/spec/factories/client_options.rb +0 -18
- data/spec/factories/magic_request_factory.rb +0 -37
- data/spec/factories/unity_request_factory.rb +0 -13
- data/spec/factories/unity_response_factory.rb +0 -12
- data/spec/fixtures/attributes_hash.yml +0 -15
- data/spec/fixtures/date_hash.yml +0 -8
- data/spec/fixtures/date_string_hash.yml +0 -8
- data/spec/fixtures/error.json +0 -3
- data/spec/fixtures/get_providers.json +0 -69
- data/spec/fixtures/get_providers.xml +0 -119
- data/spec/fixtures/get_providers_json.yml +0 -65
- data/spec/fixtures/get_providers_xml.yml +0 -270
- data/spec/fixtures/get_security_token.json +0 -1
- data/spec/fixtures/get_security_token.xml +0 -7
- data/spec/fixtures/get_server_info.json +0 -10
- data/spec/fixtures/get_server_info.xml +0 -40
- data/spec/fixtures/get_server_info_json.yml +0 -8
- data/spec/fixtures/get_server_info_xml.yml +0 -55
- data/spec/fixtures/no_attributes_hash.yml +0 -7
- data/spec/fixtures/retire_security_token.json +0 -1
- data/spec/fixtures/retire_security_token.xml +0 -5
- data/spec/fixtures/soap_fault.xml +0 -13
- data/spec/fixtures/string_keyed_hash.yml +0 -8
- data/spec/fixtures/symbol_keyed_hash.yml +0 -8
- data/spec/json_client_driver_spec.rb +0 -152
- data/spec/json_unity_request_spec.rb +0 -37
- data/spec/json_unity_response_spec.rb +0 -44
- data/spec/spec_helper.rb +0 -85
- data/spec/support/factory_bot.rb +0 -10
- data/spec/support/fixture_loader.rb +0 -20
- data/spec/support/shared_examples_for_client_driver.rb +0 -118
- data/spec/support/shared_examples_for_unity_request.rb +0 -114
- data/spec/support/shared_examples_for_unity_response.rb +0 -26
- data/spec/unity_request_spec.rb +0 -37
- data/spec/unity_response_spec.rb +0 -36
- data/spec/utilities_spec.rb +0 -144
@@ -1 +0,0 @@
|
|
1
|
-
"8BDB220C-189D-4627-80A8-AF9BF2192B87"
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
2
|
-
<s:Body>
|
3
|
-
<GetSecurityTokenResponse xmlns="http://www.allscripts.com/Unity">
|
4
|
-
<GetSecurityTokenResult>581EE97E-8C3E-49D8-B2DA-05A80AD48C46</GetSecurityTokenResult>
|
5
|
-
</GetSecurityTokenResponse>
|
6
|
-
</s:Body>
|
7
|
-
</s:Envelope>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
[{
|
2
|
-
"getserverinfoinfo": [{
|
3
|
-
"ServerDateTimeOffset": "2013-10-29T10:30:45.0292000-04:00",
|
4
|
-
"ServerTime": "2013-10-29T10:30:45",
|
5
|
-
"uaibornondate": "10/07/2013",
|
6
|
-
"ProductVersion": "11.2.3.32.000",
|
7
|
-
"System": "Enterprise EHR",
|
8
|
-
"ServerTimeZone": "Eastern Standard Time"
|
9
|
-
}]
|
10
|
-
}]
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
2
|
-
<s:Body>
|
3
|
-
<MagicResponse xmlns="http://www.allscripts.com/Unity">
|
4
|
-
<MagicResult>
|
5
|
-
<xs:schema id="getserverinforesponse" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
6
|
-
<xs:element name="getserverinforesponse" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
|
7
|
-
<xs:complexType>
|
8
|
-
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
9
|
-
<xs:element name="getserverinfoinfo">
|
10
|
-
<xs:complexType>
|
11
|
-
<xs:sequence>
|
12
|
-
<xs:element name="ServerTimeZone" type="xs:string" minOccurs="0"/>
|
13
|
-
<xs:element name="ServerTime" type="xs:string" minOccurs="0"/>
|
14
|
-
<xs:element name="ServerDateTimeOffset" type="xs:string" minOccurs="0"/>
|
15
|
-
<xs:element name="System" type="xs:string" minOccurs="0"/>
|
16
|
-
<xs:element name="ProductVersion" type="xs:string" minOccurs="0"/>
|
17
|
-
<xs:element name="uaibornondate" type="xs:string" minOccurs="0"/>
|
18
|
-
</xs:sequence>
|
19
|
-
</xs:complexType>
|
20
|
-
</xs:element>
|
21
|
-
</xs:choice>
|
22
|
-
</xs:complexType>
|
23
|
-
</xs:element>
|
24
|
-
</xs:schema>
|
25
|
-
<diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
26
|
-
<getserverinforesponse xmlns="">
|
27
|
-
<getserverinfoinfo diffgr:id="getserverinfoinfo1" msdata:rowOrder="0">
|
28
|
-
<ServerTimeZone>Eastern Standard Time</ServerTimeZone>
|
29
|
-
<ServerTime>2013-10-24T18:41:43</ServerTime>
|
30
|
-
<ServerDateTimeOffset>2013-10-24T18:41:43.6130000-04:00</ServerDateTimeOffset>
|
31
|
-
<System>Enterprise EHR</System>
|
32
|
-
<ProductVersion>11.2.3.32.000</ProductVersion>
|
33
|
-
<uaibornondate>10/07/2013</uaibornondate>
|
34
|
-
</getserverinfoinfo>
|
35
|
-
</getserverinforesponse>
|
36
|
-
</diffgr:diffgram>
|
37
|
-
</MagicResult>
|
38
|
-
</MagicResponse>
|
39
|
-
</s:Body>
|
40
|
-
</s:Envelope>
|
@@ -1,55 +0,0 @@
|
|
1
|
-
---
|
2
|
-
:magic_response:
|
3
|
-
:magic_result:
|
4
|
-
:schema:
|
5
|
-
:element:
|
6
|
-
:complex_type:
|
7
|
-
:choice:
|
8
|
-
:element:
|
9
|
-
:complex_type:
|
10
|
-
:sequence:
|
11
|
-
:element:
|
12
|
-
- :@name: ServerTimeZone
|
13
|
-
:@type: xs:string
|
14
|
-
:@min_occurs: '0'
|
15
|
-
- :@name: ServerTime
|
16
|
-
:@type: xs:string
|
17
|
-
:@min_occurs: '0'
|
18
|
-
- :@name: ServerDateTimeOffset
|
19
|
-
:@type: xs:string
|
20
|
-
:@min_occurs: '0'
|
21
|
-
- :@name: System
|
22
|
-
:@type: xs:string
|
23
|
-
:@min_occurs: '0'
|
24
|
-
- :@name: ProductVersion
|
25
|
-
:@type: xs:string
|
26
|
-
:@min_occurs: '0'
|
27
|
-
- :@name: uaibornondate
|
28
|
-
:@type: xs:string
|
29
|
-
:@min_occurs: '0'
|
30
|
-
:@name: getserverinfoinfo
|
31
|
-
:@min_occurs: '0'
|
32
|
-
:@max_occurs: unbounded
|
33
|
-
:@name: getserverinforesponse
|
34
|
-
:@msdata:is_data_set: 'true'
|
35
|
-
:@msdata:use_current_locale: 'true'
|
36
|
-
:@xmlns:xs: http://www.w3.org/2001/XMLSchema
|
37
|
-
:@xmlns: ''
|
38
|
-
:@xmlns:msdata: urn:schemas-microsoft-com:xml-msdata
|
39
|
-
:@id: getserverinforesponse
|
40
|
-
:diffgram:
|
41
|
-
:getserverinforesponse:
|
42
|
-
:getserverinfoinfo:
|
43
|
-
:server_time_zone: Eastern Standard Time
|
44
|
-
:server_time: !ruby/object:DateTime 2013-10-24 13:52:49.000000000 -05:00
|
45
|
-
:server_date_time_offset: !ruby/object:DateTime 2013-10-24 17:52:49.000000000
|
46
|
-
-05:00
|
47
|
-
:system: Enterprise EHR
|
48
|
-
:product_version: 11.2.3.32.000
|
49
|
-
:uaibornondate: 10/07/2013
|
50
|
-
:@diffgr:id: getserverinfoinfo1
|
51
|
-
:@msdata:row_order: '0'
|
52
|
-
:@xmlns: ''
|
53
|
-
:@xmlns:diffgr: urn:schemas-microsoft-com:xml-diffgram-v1
|
54
|
-
:@xmlns:msdata: urn:schemas-microsoft-com:xml-msdata
|
55
|
-
:@xmlns: http://www.allscripts.com/Unity
|
@@ -1 +0,0 @@
|
|
1
|
-
<RetireSecurityTokenResponse xmlns="http://www.allscripts.com/Unity"/>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
2
|
-
<s:Body>
|
3
|
-
<s:Fault>
|
4
|
-
<faultcode>s:Client</faultcode>
|
5
|
-
<faultstring xml:lang="en-US">Magic Error - Action: GetProviders - As a Security precaution, you have been logged out due to inactivity.</faultstring>
|
6
|
-
<detail>
|
7
|
-
<UnityFault xmlns="http://schemas.datacontract.org/2004/07/Allscripts.UAI.Unity.UnityService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
8
|
-
<ErrorMessage>Magic Error - Action: GetProviders - As a Security precaution, you have been logged out due to inactivity.</ErrorMessage>
|
9
|
-
</UnityFault>
|
10
|
-
</detail>
|
11
|
-
</s:Fault>
|
12
|
-
</s:Body>
|
13
|
-
</s:Envelope>
|
@@ -1,152 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe AllscriptsUnityClient::JSONClientDriver do
|
4
|
-
it_behaves_like 'a client driver'
|
5
|
-
|
6
|
-
let(:fake_logger) do
|
7
|
-
double(Logger)
|
8
|
-
end
|
9
|
-
|
10
|
-
before do
|
11
|
-
allow(fake_logger).to receive(:info)
|
12
|
-
end
|
13
|
-
|
14
|
-
subject do
|
15
|
-
client_driver = build(:json_client_driver, logger: fake_logger)
|
16
|
-
client_driver.security_token = SecureRandom.uuid
|
17
|
-
client_driver
|
18
|
-
end
|
19
|
-
|
20
|
-
let(:get_server_info) { FixtureLoader.load_file('get_server_info.json') }
|
21
|
-
let(:get_security_token) { FixtureLoader.load_file('get_security_token.json') }
|
22
|
-
let(:retire_security_token) { FixtureLoader.load_file('retire_security_token.json') }
|
23
|
-
let(:error) { FixtureLoader.load_json('error.json') }
|
24
|
-
let(:error_string) { 'error: Username and Password not valid for any licenses on this server' }
|
25
|
-
let(:url) { Faker::Internet.url }
|
26
|
-
|
27
|
-
let(:hash) do
|
28
|
-
{
|
29
|
-
'test' => true
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
let(:json_hash) do
|
34
|
-
MultiJSON.dump(hash)
|
35
|
-
end
|
36
|
-
|
37
|
-
describe '#initialize' do
|
38
|
-
context 'when given proxy' do
|
39
|
-
it 'passes configuration to connection' do
|
40
|
-
expect(build(:json_client_driver, proxy: url).connection.proxy.to_s).to eq(url)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#client_type' do
|
46
|
-
it { expect(subject.client_type).to be(:json) }
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '#magic' do
|
50
|
-
before do
|
51
|
-
stub_request(:post, "http://www.example.com/Unity/UnityService.svc/json/MagicJson").
|
52
|
-
to_return(status: 200, body: get_server_info, headers: {})
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should POST to /Unity/UnityService.svc/json/MagicJson' do
|
56
|
-
subject.magic
|
57
|
-
expect(WebMock).to have_requested(:post, 'http://www.example.com/Unity/UnityService.svc/json/MagicJson').
|
58
|
-
with(body: /\{"Action":(null|"[^"]*"),"AppUserID":(null|"[^"]*"),"Appname":(null|"[^"]*"),"PatientID":(null|"[^"]*"),"Token":(null|"[^"]*"),"Parameter1":(null|"[^"]*"),"Parameter2":(null|"[^"]*"),"Parameter3":(null|"[^"]*"),"Parameter4":(null|"[^"]*"),"Parameter5":(null|"[^"]*"),"Parameter6":(null|"[^"]*"),"Data":(null|"[^"]*")\}/,
|
59
|
-
headers: {'Content-Type' => 'application/json'}
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should serialize DateTime to iso8601 when given' do
|
64
|
-
subject.magic(parameter1: DateTime.now)
|
65
|
-
expect(WebMock).to have_requested(:post, 'http://www.example.com/Unity/UnityService.svc/json/MagicJson').
|
66
|
-
with(body: /\{"Action":(null|"[^"]*"),"AppUserID":(null|"[^"]*"),"Appname":(null|"[^"]*"),"PatientID":(null|"[^"]*"),"Token":(null|"[^"]*"),"Parameter1":"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(-|\+)\d{2}:\d{2}","Parameter2":(null|"[^"]*"),"Parameter3":(null|"[^"]*"),"Parameter4":(null|"[^"]*"),"Parameter5":(null|"[^"]*"),"Parameter6":(null|"[^"]*"),"Data":(null|"[^"]*")\}/,
|
67
|
-
headers: { 'Content-Type' => 'application/json' }
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'should log the request duration' do
|
72
|
-
expect(fake_logger).to receive(:info).with(/Unity API Magic request to [^ ]+ \[SomeRequest\] [0-9.]+ seconds/)
|
73
|
-
|
74
|
-
subject.magic(action: 'SomeRequest')
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'should log the response code' do
|
78
|
-
expect(fake_logger).to receive(:info).with(/Response Status: 200/)
|
79
|
-
|
80
|
-
subject.magic(action: 'SomeRequest')
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe '#get_security_token!' do
|
85
|
-
before(:each) {
|
86
|
-
stub_request(:post, 'http://www.example.com/Unity/UnityService.svc/json/GetToken').to_return(body: get_security_token)
|
87
|
-
}
|
88
|
-
|
89
|
-
it 'should POST to /Unity/UnityService.svc/json/GetToken with username, password, and appname' do
|
90
|
-
subject.get_security_token!
|
91
|
-
expect(WebMock).to have_requested(:post, 'http://www.example.com/Unity/UnityService.svc/json/GetToken').with(body: /\{"Username":"[^"]+","Password":"[^"]+","Appname":"[^"]+"\}/, headers: { 'Content-Type' => 'application/json' })
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'log the request to get a security token' do
|
95
|
-
expect(fake_logger).to receive(:info).with(/Unity API GetSecurityToken request to [^ ]+ [0-9.]+ seconds/)
|
96
|
-
|
97
|
-
subject.get_security_token!
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'logs the response code from getting a security token' do
|
101
|
-
expect(fake_logger).to receive(:info).with(/Response Status: 200/)
|
102
|
-
|
103
|
-
subject.get_security_token!
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'should fail when there is a problem retrieving the security token' do
|
107
|
-
stub_request(:post, 'http://www.example.com/Unity/UnityService.svc/json/GetToken')
|
108
|
-
.to_return(
|
109
|
-
{
|
110
|
-
body: "",
|
111
|
-
headers: {},
|
112
|
-
status: 503,
|
113
|
-
}
|
114
|
-
)
|
115
|
-
|
116
|
-
expect do
|
117
|
-
subject.get_security_token!
|
118
|
-
end.to raise_error(AllscriptsUnityClient::GetSecurityTokenError)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe '#retire_security_token!' do
|
123
|
-
before(:each) {
|
124
|
-
stub_request(:post, 'http://www.example.com/Unity/UnityService.svc/json/RetireSecurityToken').to_return(body: retire_security_token)
|
125
|
-
allow(subject).to receive(:log_retire_security_token)
|
126
|
-
}
|
127
|
-
|
128
|
-
it 'should POST to /Unity/UnityService.svc/json/RetireSecurityToken with token and appname' do
|
129
|
-
subject.retire_security_token!
|
130
|
-
expect(WebMock).to have_requested(:post, 'http://www.example.com/Unity/UnityService.svc/json/RetireSecurityToken').with(body: /\{"Token":"[^"]+","Appname":"[^"]+"\}/, headers: { 'Content-Type' => 'application/json' })
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'should call log_retire_security_token' do
|
134
|
-
subject.retire_security_token!
|
135
|
-
expect(subject).to have_received(:log_retire_security_token)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe '#raise_if_response_error' do
|
140
|
-
context 'when given nil for response' do
|
141
|
-
it { expect { subject.send(:raise_if_response_error, nil) }.to raise_error(AllscriptsUnityClient::APIError) }
|
142
|
-
end
|
143
|
-
|
144
|
-
context 'when given error JSON' do
|
145
|
-
it { expect { subject.send(:raise_if_response_error, error) }.to raise_error(AllscriptsUnityClient::APIError) }
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'when given error string' do
|
149
|
-
it { expect { subject.send(:raise_if_response_error, error_string) }.to raise_error(AllscriptsUnityClient::APIError) }
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe AllscriptsUnityClient::JSONUnityRequest do
|
4
|
-
it_behaves_like 'a unity request'
|
5
|
-
|
6
|
-
subject { build(:json_unity_request) }
|
7
|
-
|
8
|
-
describe '#initialize' do
|
9
|
-
context 'when nil is given for parameters' do
|
10
|
-
it { expect { build(:json_unity_request, parameters: nil) }.to raise_error(ArgumentError) }
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'when nil is given for timezone' do
|
14
|
-
it { expect { build(:json_unity_request, timezone: nil) }.to raise_error(ArgumentError) }
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when nil is given for appname' do
|
18
|
-
it { expect { build(:json_unity_request, appname: nil) }.to raise_error(ArgumentError) }
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when nil is given for security_token' do
|
22
|
-
it { expect { build(:json_unity_request, security_token: nil) }.to raise_error(ArgumentError) }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#to_hash' do
|
27
|
-
it ':userid maps to AppUserID' do
|
28
|
-
subject.parameters = build(:magic_request, userid: 'UserID')
|
29
|
-
expect(subject.to_hash['AppUserID']).to eq('UserID')
|
30
|
-
end
|
31
|
-
|
32
|
-
it ':data maps to Base64 encoded Data' do
|
33
|
-
subject.parameters = build(:magic_request, data: 'data')
|
34
|
-
expect(subject.to_hash['Data']).to eq(['data'].pack('m'))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe AllscriptsUnityClient::JSONUnityResponse do
|
4
|
-
it_behaves_like 'a unity response'
|
5
|
-
|
6
|
-
subject { build(:json_unity_response, response: get_server_info) }
|
7
|
-
|
8
|
-
let(:get_server_info) { FixtureLoader.load_yaml('get_server_info_json.yml') }
|
9
|
-
let(:get_providers) { FixtureLoader.load_yaml('get_providers_json.yml') }
|
10
|
-
|
11
|
-
describe '#initialize' do
|
12
|
-
context 'when nil is given for response' do
|
13
|
-
it { expect { build(:json_unity_response, response: nil) }.to raise_error(ArgumentError) }
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'when nil is given for timezone' do
|
17
|
-
it { expect { build(:json_unity_response, timezone: nil) }.to raise_error(ArgumentError) }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#to_hash' do
|
22
|
-
context 'when given a GetServerInfo JSON response hash' do
|
23
|
-
it 'strips Unity JSON wrappers' do
|
24
|
-
expect(subject.to_hash[:server_time_zone]).to_not be_nil
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'when given empty response' do
|
29
|
-
it 'returns []' do
|
30
|
-
magic_response = get_providers
|
31
|
-
magic_response[0]['getprovidersinfo'] = []
|
32
|
-
subject.response = magic_response
|
33
|
-
expect(subject.to_hash).to eq([])
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'when given a multiple item response' do
|
38
|
-
it 'returns an array' do
|
39
|
-
subject.response = get_providers
|
40
|
-
expect(subject.to_hash).to be_instance_of(Array)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require 'simplecov'
|
3
|
-
|
4
|
-
# Configure coverage stats.
|
5
|
-
SimpleCov.start do
|
6
|
-
ignored_files = %w(version.rb allscripts_unity_client.gemspec Gemfile Rakefile)
|
7
|
-
|
8
|
-
add_filter do |source_file|
|
9
|
-
filename = Pathname.new(source_file.filename).basename
|
10
|
-
ignored_files.include?(filename) || source_file.filename.include?('spec/')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
lib = File.expand_path('../lib/', __FILE__)
|
15
|
-
$:.unshift lib unless $:.include?(lib)
|
16
|
-
|
17
|
-
require 'allscripts_unity_client'
|
18
|
-
require 'rspec'
|
19
|
-
require 'webmock/rspec'
|
20
|
-
require 'securerandom'
|
21
|
-
require 'faker'
|
22
|
-
require 'factory_bot'
|
23
|
-
require 'json'
|
24
|
-
|
25
|
-
# Include all support files
|
26
|
-
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
|
27
|
-
|
28
|
-
RSpec.configure do |config|
|
29
|
-
# These two settings work together to allow you to limit a spec run
|
30
|
-
# to individual examples or groups you care about by tagging them with
|
31
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
32
|
-
# get run.
|
33
|
-
config.filter_run :focus
|
34
|
-
config.run_all_when_everything_filtered = true
|
35
|
-
|
36
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
37
|
-
# file, and it's useful to allow more verbose output when running an
|
38
|
-
# individual spec file.
|
39
|
-
if config.files_to_run.one?
|
40
|
-
# Use the documentation formatter for detailed output,
|
41
|
-
# unless a formatter has already been configured
|
42
|
-
# (e.g. via a command-line flag).
|
43
|
-
config.default_formatter = 'doc'
|
44
|
-
end
|
45
|
-
|
46
|
-
# Print the 10 slowest examples and example groups at the
|
47
|
-
# end of the spec run, to help surface which specs are running
|
48
|
-
# particularly slow.
|
49
|
-
# config.profile_examples = 10
|
50
|
-
|
51
|
-
# Run specs in random order to surface order dependencies. If you find an
|
52
|
-
# order dependency and want to debug it, you can fix the order by providing
|
53
|
-
# the seed, which is printed after each run.
|
54
|
-
# --seed 1234
|
55
|
-
config.order = :random
|
56
|
-
|
57
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
58
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
59
|
-
# test failures related to randomization by passing the same `--seed` value
|
60
|
-
# as the one that triggered the failure.
|
61
|
-
Kernel.srand config.seed
|
62
|
-
|
63
|
-
# rspec-expectations config goes here. You can use an alternate
|
64
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
65
|
-
# assertions if you prefer.
|
66
|
-
config.expect_with :rspec do |expectations|
|
67
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
68
|
-
# For more details, see:
|
69
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
70
|
-
expectations.syntax = :expect
|
71
|
-
end
|
72
|
-
|
73
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
74
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
75
|
-
config.mock_with :rspec do |mocks|
|
76
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
77
|
-
# For more details, see:
|
78
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
79
|
-
mocks.syntax = :expect
|
80
|
-
|
81
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
82
|
-
# a real object. This is generally recommended.
|
83
|
-
# mocks.verify_partial_doubles = true
|
84
|
-
end
|
85
|
-
end
|