Skip to content

Commit

Permalink
User creates an aspect
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmemes-eth committed Sep 26, 2010
1 parent 3e499c0 commit fd69f02
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/controllers/aspects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ def index
end

def create
@aspect = current_user.aspect params[:aspect]
flash[:notice] = I18n.t('aspects.create.success')
@aspect = current_user.aspect(params[:aspect])
if @aspect.valid?
flash[:notice] = I18n.t('aspects.create.success')
else
flash[:notice] = I18n.t('aspects.create.failure')
end
respond_with :location => aspects_manage_path
end

Expand Down
1 change: 1 addition & 0 deletions config/locales/diaspora/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ en:
create: "Create"
create:
success: "Click on the plus on the left side to tell Diaspora who can see your new aspect."
failure: "Aspect creation failed."
destroy:
success: "%{name} was successfully removed."
update:
Expand Down
17 changes: 17 additions & 0 deletions features/step_definitions/custom_web_steps.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion features/step_definitions/scope_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def within_parent(content, elements = ['*'], &block)

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|
within_parent(title, sections) do
Expand Down
23 changes: 23 additions & 0 deletions features/user_creates_an_aspect.feature
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit fd69f02

Please sign in to comment.