Cross Reference: keys_controller_spec.rb
xref
: /
ontohub
/
spec
/
controllers
/
keys_controller_spec.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
keys_controller_spec.rb revision 23305f217b86a2ebf90a848af9036908e0070542
14d19b08f079988d61ea653d1d7c439522e9ae70
Eugen Kuksa
require
'spec_helper'
14d19b08f079988d61ea653d1d7c439522e9ae70
Eugen Kuksa
14d19b08f079988d61ea653d1d7c439522e9ae70
Eugen Kuksa
describe
KeysController
do
14d19b08f079988d61ea653d1d7c439522e9ae70
Eugen Kuksa
14d19b08f079988d61ea653d1d7c439522e9ae70
Eugen Kuksa
let
(:
user
)
{
create
:
user
}
14d19b08f079988d61ea653d1d7c439522e9ae70
Eugen Kuksa
14d19b08f079988d61ea653d1d7c439522e9ae70
Eugen Kuksa
context
'not signed in'
do
14d19b08f079988d61ea653d1d7c439522e9ae70
Eugen Kuksa
before
{
get
:
index
}
it
{
should
respond_with
:
redirect
}
end
context
'signed in'
do
before
{
sign_in
user
}
context
'GET to new'
do
before
{
get
:
new
}
it
{
should
respond_with
:
success
}
it
{
should
render_template
:
new
}
end
context
'POST to create'
do
before
{
post
:
create
,
key
:
attributes_for
(:
key
)
}
it
{
should
set_the_flash.to
(/
successfully
created
/)
}
it
{
should
redirect_to
(:
keys
)
}
end
context
'existing key'
do
let
!
(:
key
)
{
create
:
key
,
user
:
user
}
context
'GET to index'
do
before
{
get
:
index
}
it
{
should
respond_with
:
success
}
it
{
should
render_template
:
index
}
end
context
'DELETE to destroy'
do
before
{
delete
:
destroy
,
id
:
key.id
}
it
{
should
redirect_to
(:
keys
)
}
end
end
end
end