Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F401851
fileset_spec.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Feb 20, 1:38 PM
Size
1 KB
Mime Type
text/x-ruby
Expires
Sat, Feb 22, 1:38 PM (18 h, 55 m)
Engine
blob
Format
Raw Data
Handle
191830
Attached To
rARCHIVING archiving
fileset_spec.rb
View Options
require
'spec_helper'
describe
Fileset
do
describe
'#to_bacula_config_array'
do
let
(
:fileset
)
do
FactoryGirl
.
create
(
:fileset
,
name
:
'Test Fileset'
,
exclude_directions
:
Fileset
::
DEFAULT_EXCLUDED
,
include_directions
:
{
options
:
Fileset
::
DEFAULT_INCLUDE_OPTIONS
,
file
:
Fileset
::
DEFAULT_INCLUDE_FILE_LIST
}
)
end
subject
{
fileset
.
to_bacula_config_array
}
it
'is a Fileset type resource'
do
expect
(
subject
.
first
)
.
to
eq
(
'FileSet {'
)
expect
(
subject
.
last
)
.
to
eq
(
'}'
)
end
it
'contains the name'
do
name_for_config
=
[
fileset
.
host
.
name
,
fileset
.
name
].
join
(
' '
)
expect
(
subject
)
.
to
include
(
" Name =
\"
#{
name_for_config
}
\"
"
)
end
end
context
'when duplicate exclude_directions are given'
do
let
(
:fileset
)
{
FactoryGirl
.
create
(
:fileset
,
exclude_directions
:
[
:foo
,
:foo
,
:bar
]
)
}
it
'keeps its exclude_directions uniq'
do
expect
(
fileset
.
exclude_directions
)
.
to
eq
(
[
:foo
,
:bar
]
)
end
end
context
'when exclude_directions are given'
do
let
(
:fileset
)
{
FactoryGirl
.
create
(
:fileset
,
exclude_directions
:
[
:foo
,
:foo
,
:bar
,
''
]
)
}
it
'rejects them'
do
expect
(
fileset
.
exclude_directions
)
.
to
eq
(
[
:foo
,
:bar
]
)
end
end
context
'when no include_files are given'
do
let
(
:fileset
)
{
FactoryGirl
.
build
(
:fileset
,
include_files
:
[]
)
}
it
'does not save the fileset'
do
expect
(
fileset
)
.
to
have
(
1
)
.
errors_on
(
:include_files
)
end
end
context
'when blank include_files are given'
do
let
(
:fileset
)
{
FactoryGirl
.
create
(
:fileset
,
include_files
:
[
:foo
,
''
]
)
}
it
'rejects them'
do
expect
(
fileset
.
include_directions
[
'file'
]
)
.
to
eq
(
[
'foo'
]
)
end
end
end
Event Timeline
Log In to Comment