-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Web Of Knowledge Client - WosClient specs
- Loading branch information
1 parent
f12e8d4
commit adc47da
Showing
3 changed files
with
86 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0"?> | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> | ||
<soap:Body> | ||
<ns2:authenticateResponse xmlns:ns2="http://auth.cxf.wokmws.thomsonreuters.com"> | ||
<return>2F669ZtP6fRizIymX8V</return> | ||
</ns2:authenticateResponse> | ||
</soap:Body> | ||
</soap:Envelope> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
require 'spec_helper' | ||
|
||
# http://savonrb.com/version2/testing.html | ||
# require the helper module | ||
require 'savon/mock/spec_helper' | ||
|
||
describe WosClient do | ||
include Savon::SpecHelper | ||
|
||
# set Savon in and out of mock mode | ||
before(:all) { savon.mock! } | ||
after(:all) { savon.unmock! } | ||
|
||
let(:wos_client) { described_class.new } | ||
let(:auth_xml) { File.read('spec/fixtures/wos_client/authenticate.xml') } | ||
|
||
describe '#new' do | ||
it 'works' do | ||
expect(wos_client).to be_an described_class | ||
end | ||
end | ||
|
||
describe '#auth' do | ||
it 'works' do | ||
result = wos_client.auth | ||
expect(result).to be_an Savon::Client | ||
end | ||
end | ||
|
||
describe '#authenticate' do | ||
it 'authenticates with the service' do | ||
savon.expects(:authenticate).returns(auth_xml) | ||
response = wos_client.authenticate | ||
expect(response).to be_successful | ||
end | ||
end | ||
|
||
describe '#search' do | ||
xit 'works' do | ||
savon.expects(:authenticate).returns(auth_xml) | ||
result = wos_client.search | ||
expect(result).not_to be_nil | ||
end | ||
end | ||
|
||
describe '#session_id' do | ||
it 'works' do | ||
savon.expects(:authenticate).returns(auth_xml) | ||
result = wos_client.session_id | ||
expect(result).to be_an String | ||
expect(result).to eq '2F669ZtP6fRizIymX8V' | ||
end | ||
end | ||
|
||
describe '#session_close' do | ||
it 'works' do | ||
savon.expects(:close_session).returns('') | ||
result = wos_client.session_close | ||
expect(result).to be_nil | ||
end | ||
end | ||
end |