\ No newline at end of file
diff --git a/app/views/feedlist/_legend.rhtml b/app/views/feedlist/_legend.rhtml
new file mode 100644
index 00000000..bc7e202f
--- /dev/null
+++ b/app/views/feedlist/_legend.rhtml
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/app/views/feedlist/get_feeds_for_context.erb b/app/views/feedlist/get_feeds_for_context.erb
new file mode 100644
index 00000000..f67ca8fd
--- /dev/null
+++ b/app/views/feedlist/get_feeds_for_context.erb
@@ -0,0 +1 @@
+
<%= all_feed_links_for_context(@context) %>
\ No newline at end of file
diff --git a/app/views/feedlist/get_feeds_for_project.erb b/app/views/feedlist/get_feeds_for_project.erb
new file mode 100644
index 00000000..98834bdb
--- /dev/null
+++ b/app/views/feedlist/get_feeds_for_project.erb
@@ -0,0 +1 @@
+
<%= all_feed_links_for_project(@project) %>
\ No newline at end of file
diff --git a/app/views/feedlist/index.html.erb b/app/views/feedlist/index.html.erb
index d1d761f8..2812f5d6 100644
--- a/app/views/feedlist/index.html.erb
+++ b/app/views/feedlist/index.html.erb
@@ -1,115 +1,23 @@
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2dabe1f4..fed656cd 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -90,7 +90,7 @@ en:
rss_feed: "RSS Feed"
plain_text_feed: "Plain Text Feed"
ical_feed: "iCal feed"
- notice_incomplete_only: "Note: All feeds show only actions that have not been marked as done."
+ notice_incomplete_only: "Note: All feeds show only actions that have not been marked as done, unless stated otherwise."
last_fixed_number: "Last {{number}} actions"
all_actions: "All actions"
actions_due_today: "Actions due today or earlier"
diff --git a/features/feedlist.feature b/features/feedlist.feature
new file mode 100644
index 00000000..f1f1b810
--- /dev/null
+++ b/features/feedlist.feature
@@ -0,0 +1,48 @@
+Feature: Get all sorts of lists from Tracks
+ In order to get reports on todos managed by Tracks
+ As a Tracks user
+ I want to be be able to select a feed
+
+ Background:
+ Given the following user record
+ | login | password | is_admin |
+ | testuser | secret | false |
+ And I have logged in as "testuser" with password "secret"
+ And I have the following contexts:
+ | context |
+ | @pc |
+ | @home |
+ | @shops |
+ | @boss |
+ And I have the following projects:
+ | project_name |
+ | Test feedlist |
+ | Get release out |
+
+ Scenario: I cannot see context scripts when I do not have a context
+ Given I have no contexts
+ When I go to the feeds page
+ Then I should see a message that you need a context to get feeds for contexts
+
+ Scenario: I cannot see proejct scripts when I do not have a project
+ Given I have no projects
+ When I go to the feeds page
+ Then I should see a message that you need a project to get feeds for projects
+
+ Scenario: I can see scripts when I have one or more contexts
+ When I go to the feeds page
+ Then I should see feeds for projects
+ And I should see "Test feedlist" as the selected project
+ And I should see feeds for contexts
+ And I should see "@pc" as the selected context
+
+ @selenium @wip
+ Scenario Outline: I can select the item for getting feeds for that item
+ When I go to the feeds page
+ And I select "" from ""
+ Then I should see feeds for "" in list of ""
+
+ Examples:
+ | item | item-list | item-type |
+ | @boss | feed-contexts | context |
+ | Get release out | feed-projects | project |
diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb
index 35f5a35b..c43f3bd3 100644
--- a/features/step_definitions/context_steps.rb
+++ b/features/step_definitions/context_steps.rb
@@ -10,7 +10,7 @@ Given /^there exists an active context called "([^"]*)" for user "([^"]*)"$/ do
end
Given /^there exists a context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
- Given "there exists an active context called \"#{context_name}\" for user \"#{login}\""
+ Given "there exists an active context called \"#{context_name}\" for user \"#{login}\""
end
Given /^there exists a hidden context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
@@ -75,3 +75,8 @@ end
Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
Then "I should not see \"#{context_name} (\""
end
+
+Then /^I should see feeds for "([^"]*)" in list of "([^"]*)"$/ do |name, list_type|
+ xpath= "//div[@id='feeds-for-#{list_type}']//strong"
+ name.should == response.selenium.get_text("xpath=#{xpath}")
+end
diff --git a/features/step_definitions/feedlist_steps.rb b/features/step_definitions/feedlist_steps.rb
new file mode 100644
index 00000000..90de4122
--- /dev/null
+++ b/features/step_definitions/feedlist_steps.rb
@@ -0,0 +1,31 @@
+Then /^I should see a message that you need a context to get feeds for contexts$/ do
+ Then "I should see \"There need to be at least one context before you can request a feed\""
+end
+
+Then /^I should see a message that you need a project to get feeds for projects$/ do
+ Then "I should see \"There need to be at least one project before you can request a feed\""
+end
+
+Then /^I should see feeds for projects$/ do
+ within 'select[id="feed-projects"]' do |scope|
+ scope.should have_selector("option[value=\"#{@current_user.projects.first.id}\"]")
+ end
+end
+
+Then /^I should see feeds for contexts$/ do
+ within 'select[id="feed-contexts"]' do |scope|
+ scope.should have_selector("option[value=\"#{@current_user.contexts.first.id}\"]")
+ end
+end
+
+Then /^I should see "([^"]*)" as the selected project$/ do |project_name|
+ within 'select[id="feed-projects"]' do |scope|
+ scope.should have_selector("option[selected=\"selected\"]", :content => project_name)
+ end
+end
+
+Then /^I should see "([^"]*)" as the selected context$/ do |context_name|
+ within 'select[id="feed-contexts"]' do |scope|
+ scope.should have_selector("option[selected=\"selected\"]", :content => context_name)
+ end
+end
diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb
index 5df89c2e..9882d5ba 100644
--- a/features/step_definitions/project_steps.rb
+++ b/features/step_definitions/project_steps.rb
@@ -24,6 +24,16 @@ Given /^I have a project called "([^"]*)"$/ do |project_name|
Given "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
end
+Given /^I have the following projects:$/ do |table|
+ table.hashes.each do |project|
+ Given 'I have a project called "'+project[:project_name]+'"'
+ end
+end
+
+Given /^I have no projects$/ do
+ Project.delete_all
+end
+
When /^I visit the "([^\"]*)" project$/ do |project_name|
@project = Project.find_by_name(project_name)
@project.should_not be_nil
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index c3f985ea..9bd497db 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -491,10 +491,10 @@ var FeedsPage = {
FeedsPage.get_script_for_project("#feeds-for-project", "get_feeds_for_project", this.value );
});
},
- get_script_for_context: function(element, getter, param){
+ get_script_for_context: function(element, getter, context){
generic_get_script_for_list(element, "feedlist/"+getter, "context_id="+context);
},
- get_script_for_project: function(element, getter, param){
+ get_script_for_project: function(element, getter, project){
generic_get_script_for_list(element, "feedlist/"+getter, "project_id="+project);
}
}