allscripts_unity_client 2.2.4 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,140 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AllscriptsUnityClient::SOAPClientDriver do
4
- include Savon::SpecHelper
5
- it_behaves_like 'a client driver'
6
-
7
- subject do
8
- client_driver = build(:soap_client_driver, proxy: 'http://localhost:8888')
9
- client_driver.security_token = SecureRandom.uuid
10
- client_driver
11
- end
12
-
13
- let(:new_relic_client_driver) { build(:soap_client_driver, new_relic: true) }
14
- let(:get_server_info) { FixtureLoader.load_file('get_server_info.xml') }
15
- let(:get_security_token) { FixtureLoader.load_file('get_security_token.xml') }
16
- let(:retire_security_token) { FixtureLoader.load_file('retire_security_token.xml') }
17
- let(:soap_fault) { FixtureLoader.load_file('soap_fault.xml') }
18
- let(:url) { Faker::Internet.url }
19
-
20
- before(:all) { savon.mock! }
21
- after(:all) { savon.unmock! }
22
-
23
- describe '#client_type' do
24
- it { expect(subject.client_type).to be(:soap) }
25
- end
26
-
27
- describe '#magic' do
28
- before(:each) {
29
- allow(subject).to receive(:start_timer)
30
- allow(subject).to receive(:end_timer)
31
- allow(subject).to receive(:log_magic)
32
- }
33
-
34
- it 'should send a SOAP request to Magic endpoint' do
35
- savon.expects('Magic').with(message: :any).returns(get_server_info)
36
- subject.magic
37
- end
38
-
39
- context 'when a Savon::SOAPFault is raised' do
40
- it 'should raise an APIError' do
41
- savon.expects('Magic').with(message: :any).returns({ code: 500, headers: {}, body: soap_fault })
42
- expect { subject.magic }.to raise_error(AllscriptsUnityClient::APIError)
43
- end
44
- end
45
-
46
- it 'should call start_timer' do
47
- savon.expects('Magic').with(message: :any).returns(get_server_info)
48
- subject.magic
49
- expect(subject).to have_received(:start_timer)
50
- end
51
-
52
- it 'should call end_timer' do
53
- savon.expects('Magic').with(message: :any).returns(get_server_info)
54
- subject.magic
55
- expect(subject).to have_received(:start_timer)
56
- end
57
-
58
- it 'should call log_magic' do
59
- savon.expects('Magic').with(message: :any).returns(get_server_info)
60
- subject.magic
61
- expect(subject).to have_received(:log_magic)
62
- end
63
- end
64
-
65
- describe '#get_security_token!' do
66
- before(:each) {
67
- allow(subject).to receive(:start_timer)
68
- allow(subject).to receive(:end_timer)
69
- allow(subject).to receive(:log_get_security_token)
70
- }
71
-
72
- it 'should send a SOAP request to GetSecurityToken endpoint' do
73
- savon.expects('GetSecurityToken').with(message: :any).returns(get_security_token)
74
- subject.get_security_token!
75
- end
76
-
77
- context 'when a Savon::SOAPFault is raised' do
78
- it 'should raise an APIError' do
79
- savon.expects('GetSecurityToken').with(message: :any).returns({ code: 500, headers: {}, body: soap_fault })
80
- expect { subject.get_security_token! }.to raise_error(AllscriptsUnityClient::APIError)
81
- end
82
- end
83
-
84
- it 'should call start_timer' do
85
- savon.expects('GetSecurityToken').with(message: :any).returns(get_security_token)
86
- subject.get_security_token!
87
- expect(subject).to have_received(:start_timer)
88
- end
89
-
90
- it 'should call end_timer' do
91
- savon.expects('GetSecurityToken').with(message: :any).returns(get_security_token)
92
- subject.get_security_token!
93
- expect(subject).to have_received(:start_timer)
94
- end
95
-
96
- it 'should call log_get_security_token' do
97
- savon.expects('GetSecurityToken').with(message: :any).returns(get_security_token)
98
- subject.get_security_token!
99
- expect(subject).to have_received(:log_get_security_token)
100
- end
101
- end
102
-
103
- describe '#retire_security_token!' do
104
- before(:each) {
105
- allow(subject).to receive(:start_timer)
106
- allow(subject).to receive(:end_timer)
107
- allow(subject).to receive(:log_retire_security_token)
108
- }
109
-
110
- it 'should send a SOAP request to RetireSecurityToken endpoint' do
111
- savon.expects('RetireSecurityToken').with(message: :any).returns(retire_security_token)
112
- subject.retire_security_token!
113
- end
114
-
115
- context 'when a Savon::SOAPFault is raised' do
116
- it 'should raise an APIError' do
117
- savon.expects('RetireSecurityToken').with(message: :any).returns({ code: 500, headers: {}, body: soap_fault })
118
- expect { subject.retire_security_token! }.to raise_error(AllscriptsUnityClient::APIError)
119
- end
120
- end
121
-
122
- it 'should call start_timer' do
123
- savon.expects('RetireSecurityToken').with(message: :any).returns(retire_security_token)
124
- subject.retire_security_token!
125
- expect(subject).to have_received(:start_timer)
126
- end
127
-
128
- it 'should call end_timer' do
129
- savon.expects('RetireSecurityToken').with(message: :any).returns(retire_security_token)
130
- subject.retire_security_token!
131
- expect(subject).to have_received(:start_timer)
132
- end
133
-
134
- it 'should call log_retire_security_token' do
135
- savon.expects('RetireSecurityToken').with(message: :any).returns(retire_security_token)
136
- subject.retire_security_token!
137
- expect(subject).to have_received(:log_retire_security_token)
138
- end
139
- end
140
- end
@@ -1,16 +0,0 @@
1
- RSpec.configure do |config|
2
- config.before(:suite) do
3
- # Mock the NewRelic::Agent::MethodTracer module
4
- module NewRelic
5
- module Agent
6
- module MethodTracer
7
- def trace_execution_scoped
8
- end
9
-
10
- def add_method_tracer
11
- end
12
- end
13
- end
14
- end
15
- end
16
- end