aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-05-13 18:50:23 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-05-24 18:55:39 +0200
commita0925ae845600d7e07a672b2a1a62d749154fabc (patch)
treee3516e75b60116a7f7fa4aa7ee5e77f5a38e0f9b /site/features
parentUse fuubar (diff)
downloadcouncil-webapp-a0925ae845600d7e07a672b2a1a62d749154fabc.tar.gz
council-webapp-a0925ae845600d7e07a672b2a1a62d749154fabc.tar.bz2
council-webapp-a0925ae845600d7e07a672b2a1a62d749154fabc.zip
Agenda lifecycle (semi-automatically managed)
When starting application create new (open) agenda if there are 0 non-archival agendas. When archiving agenda create a new open agenda. Agenda is valid only if it's archival agenda or if there are no other non-archival agendas.
Diffstat (limited to 'site/features')
-rw-r--r--site/features/agendas.feature37
-rw-r--r--site/features/step_definitions/agenda_steps.rb26
-rw-r--r--site/features/step_definitions/within_steps.rb3
-rw-r--r--site/features/support/paths.rb2
4 files changed, 62 insertions, 6 deletions
diff --git a/site/features/agendas.feature b/site/features/agendas.feature
index 77267a5..582f904 100644
--- a/site/features/agendas.feature
+++ b/site/features/agendas.feature
@@ -3,13 +3,42 @@ Feature: Agendas
I want to have agendas
Scenario: View agendas listing as a guest
+ Given an agenda
+ Given an old agenda
When I am on the homepage
And I follow "Agendas"
- Then I should not see "Agenda" in the content body
-
- Given an agenda
- When I follow "Agendas"
Then I should see "Agenda" in the agendas collection
+ And I should see "Agenda" as current agenda
When I follow link to first agenda
Then I should see current date as meeting time
+
+ Scenario: Change current agenda state as a council member
+ Given an agenda
+ When I am logged in as a council member
+ And I follow "Agendas"
+ And I follow link to current agenda
+ Then I should see "open" as agenda state
+ And I should see "Close this agenda" as transition
+
+ When I close current agenda
+ Then I should see "submissions_closed" as agenda state
+ And I should see "Reopen this agenda" as transition
+ And I should see "Archive this agenda" as transition
+
+ When I reopen current agenda
+ Then I should see "open" as agenda state
+
+ When I close current agenda
+ When I archive current agenda
+ Then I should see "old" as agenda state
+
+ Scenario: Change current agenda state as a council member
+ Given an closed agenda
+ When I am logged in as a council member
+ And I am on the current agenda page
+ And I archive current agenda
+
+ When I follow "Agendas"
+ And I follow link to current agenda
+ Then I should see "open" as agenda state
diff --git a/site/features/step_definitions/agenda_steps.rb b/site/features/step_definitions/agenda_steps.rb
index 95c7406..8613fb1 100644
--- a/site/features/step_definitions/agenda_steps.rb
+++ b/site/features/step_definitions/agenda_steps.rb
@@ -1,5 +1,8 @@
-Given /^an agenda$/ do
- Agenda.new(:meeting_time => Time.now).save!
+Given /^an ?(\w*) agenda$/ do |state|
+ a = Agenda.new
+ state = 'submissions_closed' if state == 'closed'
+ a.state = state unless state.empty?
+ a.save! if a.valid?
end
Then /^I should see current date as meeting time$/ do
@@ -10,3 +13,22 @@ When /^I follow link to first agenda$/ do
link_text = page.find(:xpath, "//a[contains(@class, 'agenda-link')]").text
When "I follow \"#{link_text}\""
end
+
+When /^I follow link to current agenda$/ do
+ a = Agenda.current
+ When "I follow \"Agenda #{a.id}\""
+end
+
+When /^I am logged in as a council member$/ do
+ Given 'example user'
+ user = User.last
+ user.council_member = true
+ user.save
+ When 'I am on the login page'
+ When 'I login as example user'
+end
+
+When /^I (\w+) current agenda$/ do |action|
+ When "I follow \"#{action.camelize} this agenda\""
+ When "I press \"#{action.camelize}\""
+end
diff --git a/site/features/step_definitions/within_steps.rb b/site/features/step_definitions/within_steps.rb
index 3f42f37..80bb8f0 100644
--- a/site/features/step_definitions/within_steps.rb
+++ b/site/features/step_definitions/within_steps.rb
@@ -1,4 +1,7 @@
{
+ 'as current agenda' => '.current-agenda',
+ 'as agenda state' => '.state-tag.view.agenda-state',
+ 'as transition' => '.transition',
'in the notices' => '.flash.notice',
'in the errors' => '.error-messages',
'in the content body' => '.content-body',
diff --git a/site/features/support/paths.rb b/site/features/support/paths.rb
index 90b611b..515a7ec 100644
--- a/site/features/support/paths.rb
+++ b/site/features/support/paths.rb
@@ -17,6 +17,8 @@ module NavigationHelpers
when /the signup page/
user_signup_path
+ when /the current agenda page/
+ agenda_path(Agenda.current)
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#