Cross Reference:
xref
: /
ontohub
/
test
/
unit
/
oops_test.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
oops_test.rb revision d6f4200103ff4fdbb3d9bfb1296a27a366808b0d
1494
N/A
require
'test_helper'
1611
N/A
1494
N/A
class
OopsTest
<
ActiveSupport
::
TestCase
1494
N/A
1494
N/A
context
'doing a oops request'
do
1494
N/A
context
'with invalid url'
do
1494
N/A
should
'raise error'
do
1494
N/A
begin
1494
N/A
do_request
:
invalid
,
"
http://example.com/
"
1494
N/A
assert
false
,
"no error was thrown"
1494
N/A
rescue
Oops
::
Error
=> e
1494
N/A
assert_match
(/
expected
XML
/,
e.message
)
1494
N/A
end
1494
N/A
end
1494
N/A
end
1494
N/A
1494
N/A
context
'with valid url'
do
1494
N/A
setup
do
1494
N/A
@
result
=
do_request
:
valid
,
"
http://sweet.jpl.nasa.gov/1.1/sunrealm.owl
"
1494
N/A
end
1494
N/A
1494
N/A
should
'return a list'
do
1494
N/A
assert_equal
5
, @
result.count
1494
N/A
end
1494
N/A
end
1494
N/A
end
1494
N/A
1494
N/A
context
'parsing a oops response'
do
1494
N/A
setup
do
1494
N/A
@
result
=
Oops
::
Response.parse
File.read
(
"#{
Rails.root
}/
test
/
fixtures
/
oops
/
sunrealm.xml
"
)
1494
N/A
end
1494
N/A
1494
N/A
should
'return correct amount of elements'
do
1494
N/A
assert_equal
5
, @
result.count
1494
N/A
end
1494
N/A
1494
N/A
context
'first element responded'
do
1494
N/A
setup
do
1537
N/A
@
element
= @
result.first
1494
N/A
end
1494
N/A
1494
N/A
should
'have correct type'
do
1494
N/A
assert_equal
'Pitfall'
, @
element.type
1494
N/A
end
1494
N/A
1494
N/A
should
'have correct name'
do
1494
N/A
assert_equal
'Creating unconnected ontology elements'
, @
element.name
1494
N/A
end
1494
N/A
1494
N/A
should
'have correct code'
do
1494
N/A
assert_equal
'P04'
, @
element.code
1494
N/A
end
1494
N/A
1494
N/A
should
'have correct affects'
do
1494
N/A
assert_equal
[
'
http://sweet.jpl.nasa.gov/1.1/sunrealm.owl
#SunRealm'
], @
element.affects
1494
N/A
end
1494
N/A
end
1494
N/A
1494
N/A
end
1676
N/A
1676
N/A
def
do_request
(
cassette
,
url
)
1676
N/A
VCR.use
_cassette
"oops/#{cassette}"
,
match_requests_on
: [:
body
]
do
1494
N/A
Oops
::
Client.request
(
url
)
1494
N/A
end
1494
N/A
end
1494
N/A
1494
N/A
end
1494
N/A