Cross Reference: jobcount_spec.rb
xref
: /
ontohub
/
spec
/
models
/
repository
/
jobcount_spec.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
jobcount_spec.rb revision 49f4112620975dae84bcd13f02667b00f16a3448
require
'spec_helper'
describe
'Repository saving (worker job count)'
do
let
(:
user
)
{
create
:
user
}
let
(:
repository
)
{
create
:
repository
,
user
:
user
}
let
(:
files
)
do
{
'
inroot1.clif
'
=>
"(In1 Root)\n"
,
'
inroot1.clf
'
=>
"(In1 Root Too)\n"
,
'
inroot2.clif
'
=>
"(In2 Root)\n"
}
end
let
(:
message
)
{
'test message'
}
it
'should get increased on saving first inroot1 file'
do
%w
(
inroot1.clif
)
.
each
do
|
path
|
tmpfile
=
Tempfile.new
(
path
)
tmpfile.write
(
files
[
path
])
tmpfile.close
repository.save
_file
(
tmpfile.path
,
path
,
message
,
user
)
end
expect
(
OntologyParsingWorker.jobs.count
)
.
to
eq
(
1
)
end
it
'should not get increased on saving second inroot1 file'
do
%w
(
inroot1.clif
inroot1.clf
)
.
each
do
|
path
|
tmpfile
=
Tempfile.new
(
path
)
tmpfile.write
(
files
[
path
])
tmpfile.close
repository.save
_file
(
tmpfile.path
,
path
,
message
,
user
)
end
expect
(
OntologyParsingWorker.jobs.count
)
.
to
eq
(
1
)
end
it
'should get increased on saving inroot2 file after two inroot1 files'
do
%w
(
inroot1.clif
inroot1.clf
inroot2.clif
)
.
each
do
|
path
|
tmpfile
=
Tempfile.new
(
path
)
tmpfile.write
(
files
[
path
])
tmpfile.close
repository.save
_file
(
tmpfile.path
,
path
,
message
,
user
)
end
expect
(
OntologyParsingWorker.jobs.count
)
.
to
eq
(
2
)
end
end