Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F905156
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
Fri, Aug 29, 9:36 PM
Size
1 KB
Mime Type
text/x-ruby
Expires
Sun, Aug 31, 9:36 PM (9 h, 39 m)
Engine
blob
Format
Raw Data
Handle
252512
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