Cross Reference:
xref
: /
lxc
/
doc
/
Makefile
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
sentence_test.rb revision 481313bedd6b4845bd732f90585eaa0dfa620a03
5
N/A
require
'test_helper'
5
N/A
5
N/A
class
SentenceTest
<
ActiveSupport
::
TestCase
5
N/A
5
N/A
context
'Migrations'
do
5
N/A
%w
(
ontology_id
comments_count
)
.
each
do
|
column
|
5
N/A
should
have_db_column
(
column
)
.
of_type
(:
integer
)
8
N/A
end
8
N/A
8
N/A
%w
(
name
range
)
.
each
do
|
column
|
8
N/A
should
have_db_column
(
column
)
.
of_type
(:
string
)
105
N/A
end
105
N/A
105
N/A
%w
(
text
display_text
)
.
each
do
|
column
|
105
N/A
should
have_db_column
(
column
)
.
of_type
(:
text
)
105
N/A
end
105
N/A
105
N/A
should
have_db_index
([:
ontology_id
, :
id
])
.
unique
(
true
)
105
N/A
should
have_db_index
([:
ontology_id
, :
name
])
.
unique
(
true
)
105
N/A
end
105
N/A
105
N/A
context
'Associations'
do
105
N/A
should
belong_to
:
ontology
105
N/A
should
have_and_belong_to_many
:
entities
105
N/A
end
105
N/A
105
N/A
context
'OntologyInstance'
do
105
N/A
setup
do
105
N/A
@
ontology
=
FactoryGirl.create
:
single_ontology
105
N/A
end
105
N/A
context
'creating Sentences'
do
setup
do
@
sentence_hash
=
{
'name'
=>
'... (if exists)'
,
'range'
=>
'
Examples
/
Reichel
:40.9'
}
@
ontology.sentences.update
_or_create_from_hash
@
sentence_hash
end
context
'correct attribute'
do
setup
do
@
sentence
= @
ontology.sentences.first
end
%w[
name
range
].
each
do
|
attr
|
should
"be #{attr}"
do
assert_equal
@
sentence_hash
[
attr
],
eval
(
"@sentence.#{attr}"
)
end
end
end
end
context
'OWL2 sentences'
do
setup
do
@
ontology
=
FactoryGirl.create
:
single_ontology
@
ontology.import
_xml_from_file
Rails.root
+
'
test
/
fixtures
/
ontologies
/
xml
/
generations.xml
'
@
sentence
= @
ontology.sentences.first
end
should
'have display_text set'
do
assert_not_nil
@
sentence.display
_text
end
should
"not contain entities' iris"
do
@
sentence.entities.each
do
|x|
assert
!
(@
sentence.text.include
?
x.iri
)
end
end
end
end
end