Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diaspora
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Milan
diaspora
Commits
b007ba14
Commit
b007ba14
authored
14 years ago
by
Sarah Mei
Browse files
Options
Downloads
Patches
Plain Diff
Fixed cucumber features. Backfilled tests for AspectsController#create.
parent
f8400389
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/aspects_controller.rb
+2
-1
2 additions, 1 deletion
app/controllers/aspects_controller.rb
spec/controllers/aspects_controller_spec.rb
+32
-6
32 additions, 6 deletions
spec/controllers/aspects_controller_spec.rb
with
34 additions
and
7 deletions
app/controllers/aspects_controller.rb
+
2
−
1
View file @
b007ba14
...
...
@@ -20,10 +20,11 @@ class AspectsController < ApplicationController
@aspect
=
current_user
.
aspect
(
params
[
:aspect
])
if
@aspect
.
valid?
flash
[
:notice
]
=
I18n
.
t
(
'aspects.create.success'
)
respond_with
@aspect
else
flash
[
:error
]
=
I18n
.
t
(
'aspects.create.failure'
)
redirect_to
aspects_manage_path
end
respond_with
@aspect
end
def
new
...
...
This diff is collapsed.
Click to expand it.
spec/controllers/aspects_controller_spec.rb
+
32
−
6
View file @
b007ba14
...
...
@@ -5,7 +5,8 @@
require
'spec_helper'
describe
AspectsController
do
render_views
render_views
before
do
@user
=
Factory
.
create
(
:user
)
@user
.
aspect
(
:name
=>
"lame-os"
)
...
...
@@ -13,11 +14,36 @@ describe AspectsController do
sign_in
:user
,
@user
end
it
"on index sets a variable containing all a user's friends when a user is signed in"
do
sign_in
:user
,
@user
Factory
.
create
:person
get
:index
assigns
[
:friends
].
should
==
@user
.
friends
describe
"#index"
do
it
"assigns @friends to all the user's friends"
do
Factory
.
create
:person
get
:index
assigns
[
:friends
].
should
==
@user
.
friends
end
end
describe
"#create"
do
describe
"with valid params"
do
it
"creates an aspect"
do
@user
.
aspects
.
count
.
should
==
1
post
:create
,
"aspect"
=>
{
"name"
=>
"new aspect"
}
@user
.
reload
.
aspects
.
count
.
should
==
2
end
it
"redirects to the aspect page"
do
post
:create
,
"aspect"
=>
{
"name"
=>
"new aspect"
}
response
.
should
redirect_to
(
aspect_path
(
Aspect
.
find_by_name
(
"new aspect"
)))
end
end
describe
"with invalid params"
do
it
"does not create an aspect"
do
@user
.
aspects
.
count
.
should
==
1
post
:create
,
"aspect"
=>
{
"name"
=>
""
}
@user
.
reload
.
aspects
.
count
.
should
==
1
end
it
"goes back to manage aspects"
do
post
:create
,
"aspect"
=>
{
"name"
=>
""
}
response
.
should
redirect_to
(
aspects_manage_path
)
end
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment