Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1433310
hosts_controller_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
Mon, Jan 19, 6:13 AM
Size
1 KB
Mime Type
text/x-ruby
Expires
Wed, Jan 21, 6:13 AM (1 d, 11 h)
Engine
blob
Format
Raw Data
Handle
326260
Attached To
rARCHIVING archiving
hosts_controller_spec.rb
View Options
require
'spec_helper'
describe
HostsController
do
describe
'GET #new'
do
before
{
get
:new
}
it
'initializes a host'
do
expect
(
assigns
(
:host
))
.
to
be
end
it
'renders'
do
expect
(
response
)
.
to
render_template
(
:new
)
end
end
describe
'POST #create'
do
context
'with valid params'
do
let
(
:params
)
do
{
host
:
FactoryGirl
.
build
(
:host
)
.
attributes
.
symbolize_keys
.
slice
(
:password
,
:fqdn
,
:port
)
}
end
it
'creates the host'
do
expect
{
post
:create
,
params
}
.
to
change
{
Host
.
count
}
.
by
(
1
)
end
it
'redirects to root'
do
post
:create
,
params
expect
(
response
)
.
to
redirect_to
(
host_path
(
Host
.
last
))
end
end
context
'with invalid params'
do
let
(
:params
)
do
{
host
:
FactoryGirl
.
build
(
:host
)
.
attributes
.
symbolize_keys
.
slice
(
:fqdn
,
:port
)
}
end
before
{
post
:create
,
params
}
it
'initializes a host with errors'
do
expect
(
assigns
(
:host
))
.
to
be
end
it
'renders :new'
do
expect
(
response
)
.
to
render_template
(
:new
)
end
end
end
end
Event Timeline
Log In to Comment