Cross Reference: sentences_controller_spec.rb
xref
: /
ontohub
/
spec
/
controllers
/
api
/
v1
/
sentences_controller_spec.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
sentences_controller_spec.rb revision e3885aacc4f26c817827173a754510807b6bc84c
require
'spec_helper'
describe
Api
::
V1
::
SentencesController
do
context
'on GET to show'
do
let
(:
sentence
)
{
create
:
sentence
}
let
(:
ontology
)
{
sentence.ontology
}
context
'requesting json representation'
,
api_specification
:
true
do
let
(:
sentence_schema
)
{
schema_for
(
'sentence'
)
}
before
do
get
:
show
,
repository_id
:
ontology.repository.to
_param
,
ontology_id
:
ontology.to
_param
,
id
:
sentence.to
_param
,
locid
:
sentence.locid
,
format
: :
json
end
it
{
should
respond_with
:
success
}
it
'respond with json content type'
do
expect
(
response.content_type.to
_s
)
.
to
eq
(
'
application
/
json
'
)
end
it
'should return a representation that validates against the schema'
do
VCR.use
_cassette
'
api
/
json-schemata
/
sentence
'
do
expect
(
response.body
)
.
to
match_json_schema
(
sentence_schema
)
end
end
end
end
end