Skip to content

Commit

Permalink
Start adding event editing features. [#27]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed May 21, 2009
1 parent 3dc9b1b commit 8f8205c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
18 changes: 18 additions & 0 deletions features/edit_events.feature
@@ -0,0 +1,18 @@
Feature: Create events
In order to keep content current
any administrator OR the author of an event should be able to
edit events already created.

Scenario: Non-admin subscribers can edit their own events
Given I am logged in
And I am subscribed to "Calendar 1"
And I have an event called "My event" in "Calendar 1"
When I am on the event list
Then I should see "edit"

Scenario: Non-admin subscribers cannot edit others' events
Given I am logged in
And I am subscribed to "Calendar 1"
And someone else has an event called "Someone else's event" in "Calendar 1"
When I am on the event list
Then I should not see "edit"
14 changes: 14 additions & 0 deletions features/step_definitions/event_steps.rb
Expand Up @@ -2,6 +2,20 @@
Event.destroy_all
end

Given /^I have an event called "([^\"]*)" in "([^\"]*)"$/ do |name, calendar|
cal = Calendar.find_by_name(calendar) || Calendar.make(:name => calendar)
e = Event.make :name => name, :calendar => cal, :date => Time.now + 10.years # so it will show up on default event list
e.created_by = User.current_user
e.save!
end

Given /^someone else has an event called "([^\"]*)" in "([^\"]*)"$/ do |name, calendar|
cal = Calendar.find_by_name(calendar) || Calendar.make(:name => calendar)
e = Event.make :name => name, :calendar => cal, :date => Time.now + 10.years # so it will show up on default event list
e.created_by = User.make
e.save!
end

Then /^I should have an event called "([^\"]*)" in "([^\"]*)"$/ do |name, calendar|
cal = Calendar.find_by_name(calendar)
cal.should_not be_nil
Expand Down
5 changes: 4 additions & 1 deletion features/support/paths.rb
Expand Up @@ -10,13 +10,16 @@ def path_to(page_name)

when /the homepage/
'/'

# Add more mappings here.
# Here is a more fancy example:
#
# when /^(.*)'s profile page$/i
# user_profile_path(User.find_by_login($1))

when /\bevent list/
events_path

when /\blogin page/
login_path

Expand Down

0 comments on commit 8f8205c

Please sign in to comment.