User creates an aspect
This commit is contained in:
parent
3e499c0f1b
commit
fd69f0201f
5 changed files with 48 additions and 3 deletions
|
|
@ -14,8 +14,12 @@ class AspectsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@aspect = current_user.aspect params[:aspect]
|
@aspect = current_user.aspect(params[:aspect])
|
||||||
|
if @aspect.valid?
|
||||||
flash[:notice] = I18n.t('aspects.create.success')
|
flash[:notice] = I18n.t('aspects.create.success')
|
||||||
|
else
|
||||||
|
flash[:notice] = I18n.t('aspects.create.failure')
|
||||||
|
end
|
||||||
respond_with :location => aspects_manage_path
|
respond_with :location => aspects_manage_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ en:
|
||||||
create: "Create"
|
create: "Create"
|
||||||
create:
|
create:
|
||||||
success: "Click on the plus on the left side to tell Diaspora who can see your new aspect."
|
success: "Click on the plus on the left side to tell Diaspora who can see your new aspect."
|
||||||
|
failure: "Aspect creation failed."
|
||||||
destroy:
|
destroy:
|
||||||
success: "%{name} was successfully removed."
|
success: "%{name} was successfully removed."
|
||||||
update:
|
update:
|
||||||
|
|
|
||||||
17
features/step_definitions/custom_web_steps.rb
Normal file
17
features/step_definitions/custom_web_steps.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
When /^(.*) in the header$/ do |action|
|
||||||
|
within('header') do
|
||||||
|
When action
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^(.*) in the modal window$/ do |action|
|
||||||
|
within('#fancybox-wrap') do
|
||||||
|
When action
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^(.*) in the aspect list$/ do |action|
|
||||||
|
within('#aspect_list') do
|
||||||
|
When action
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -9,7 +9,7 @@ end
|
||||||
|
|
||||||
World(SectionLocator)
|
World(SectionLocator)
|
||||||
|
|
||||||
sections = %w(h1 h2 h3 h4 h5 h6 legend caption dt strong)
|
sections = %w(h1 h2 h3 h4 h5 h6 legend caption dt strong header)
|
||||||
|
|
||||||
When /^(.*) in the "([^\"]*)" section$/ do |action, title|
|
When /^(.*) in the "([^\"]*)" section$/ do |action, title|
|
||||||
within_parent(title, sections) do
|
within_parent(title, sections) do
|
||||||
|
|
|
||||||
23
features/user_creates_an_aspect.feature
Normal file
23
features/user_creates_an_aspect.feature
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
@aspects @javascript
|
||||||
|
Feature: User creates an aspect
|
||||||
|
In order to share with a limited group
|
||||||
|
As a User
|
||||||
|
I want to create a new aspect
|
||||||
|
|
||||||
|
Scenario: success
|
||||||
|
Given I am signed in
|
||||||
|
And I follow "Manage" in the header
|
||||||
|
And I follow "Add a new aspect"
|
||||||
|
When I fill in "Name" with "Dorm Mates" in the modal window
|
||||||
|
And I press "Create" in the modal window
|
||||||
|
Then I should see "Manage Aspects"
|
||||||
|
And I should see "Dorm Mates" in the header
|
||||||
|
And I should see "Dorm Mates" in the aspect list
|
||||||
|
|
||||||
|
Scenario: I omit the name
|
||||||
|
Given I am signed in
|
||||||
|
And I follow "Manage" in the header
|
||||||
|
And I follow "Add a new aspect"
|
||||||
|
When I press "Create" in the modal window
|
||||||
|
Then I should see "Manage Aspects"
|
||||||
|
And I should see "Aspect creation failed."
|
||||||
Loading…
Reference in a new issue