mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-08 02:08:50 +01:00
Add smoke tests for feeds. Fix bug in all projects feed.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@408 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
f364b039d7
commit
707b8cdf86
4 changed files with 106 additions and 2 deletions
|
|
@ -48,6 +48,7 @@ class FeedController < ApplicationController
|
|||
|
||||
def list_projects_only
|
||||
init_not_done_counts('project')
|
||||
init_project_hidden_todo_counts
|
||||
@projects = @user.projects
|
||||
@description = "Lists all the projects for #{@user.login}."
|
||||
render :action => 'projects_' + params['feedtype']
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ module FeedHelper
|
|||
end
|
||||
|
||||
def format_ical_uid(todo)
|
||||
sprintf("%s%s%s%s", @request.protocol, @request.host, @request.port_string, todo_url(todo))
|
||||
sprintf("%s%s%s%s", request.protocol, request.host, request.port_string, todo_url(todo))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
|
|||
done = "<div>Completed: #{format_date(i.completed_at)}</div>\n" if i.completed?
|
||||
context_link = link_to( i.context.name, context_url(i.context) )
|
||||
if i.project_id?
|
||||
project_link = link_to (i.project.name, project_url(i.project) )
|
||||
project_link = link_to(i.project.name, project_url(i.project) )
|
||||
else
|
||||
project_link = "<em>none</em>"
|
||||
end
|
||||
|
|
|
|||
103
tracks/test/integration/feed_smoke_test.rb
Normal file
103
tracks/test/integration/feed_smoke_test.rb
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'projects_controller'
|
||||
require 'contexts_controller'
|
||||
require 'feed_controller'
|
||||
|
||||
# Re-raise errors caught by the controller.
|
||||
class ProjectsController; def rescue_action(e) raise e end; end
|
||||
class ContextsController; def rescue_action(e) raise e end; end
|
||||
class FeedController; def rescue_action(e) raise e end; end
|
||||
|
||||
class FeedSmokeTest < ActionController::IntegrationTest
|
||||
fixtures :users, :preferences, :projects, :contexts, :todos, :notes
|
||||
|
||||
def setup
|
||||
assert_test_environment_ok
|
||||
end
|
||||
|
||||
def test_last_15_actions_rss
|
||||
assert_success "/feed/rss/admin/#{ users(:admin_user).word }?limit=15"
|
||||
end
|
||||
|
||||
def test_last_15_actions_txt
|
||||
assert_success "/feed/text/admin/#{ users(:admin_user).word }?limit=15"
|
||||
end
|
||||
|
||||
def test_last_15_actions_ical
|
||||
assert_success "/feed/ical/admin/#{ users(:admin_user).word }?limit=15"
|
||||
end
|
||||
|
||||
def test_all_actions_rss
|
||||
assert_success "/feed/rss/admin/#{ users(:admin_user).word }"
|
||||
end
|
||||
|
||||
def test_all_actions_txt
|
||||
assert_success "/feed/text/admin/#{ users(:admin_user).word }"
|
||||
end
|
||||
|
||||
def test_all_actions_ical
|
||||
assert_success "/feed/ical/admin/#{ users(:admin_user).word }"
|
||||
end
|
||||
|
||||
def test_all_actions_due_today_or_earlier_rss
|
||||
assert_success "/feed/rss/admin/#{ users(:admin_user).word }?due=0"
|
||||
end
|
||||
|
||||
def test_all_actions_due_today_or_earlier_txt
|
||||
assert_success "/feed/text/admin/#{ users(:admin_user).word }?due=0"
|
||||
end
|
||||
|
||||
def test_all_actions_due_today_or_earlier_ical
|
||||
assert_success "/feed/ical/admin/#{ users(:admin_user).word }?due=0"
|
||||
end
|
||||
|
||||
def test_all_actions_due_in_7_days_or_earlier_rss
|
||||
assert_success "/feed/rss/admin/#{ users(:admin_user).word }?due=6"
|
||||
end
|
||||
|
||||
def test_all_actions_due_in_7_days_or_earlier_txt
|
||||
assert_success "/feed/text/admin/#{ users(:admin_user).word }?due=6"
|
||||
end
|
||||
|
||||
def test_all_actions_due_in_7_days_or_earlier_ical
|
||||
assert_success "/feed/ical/admin/#{ users(:admin_user).word }?due=6"
|
||||
end
|
||||
|
||||
def test_all_actions_completed_in_last_7_days_rss
|
||||
assert_success "/feed/rss/admin/#{ users(:admin_user).word }?done=7"
|
||||
end
|
||||
|
||||
def test_all_actions_completed_in_last_7_days_txt
|
||||
assert_success "/feed/text/admin/#{ users(:admin_user).word }?done=7"
|
||||
end
|
||||
|
||||
def test_all_contexts_rss
|
||||
assert_success "/contexts/feed/rss/admin/#{ users(:admin_user).word }"
|
||||
end
|
||||
|
||||
def test_all_contexts_txt
|
||||
assert_success "/contexts/feed/text/admin/#{ users(:admin_user).word }"
|
||||
end
|
||||
|
||||
def test_all_projects_rss
|
||||
assert_success "/projects/feed/rss/admin/#{ users(:admin_user).word }"
|
||||
end
|
||||
|
||||
def test_all_projects_txt
|
||||
assert_success "/projects/feed/text/admin/#{ users(:admin_user).word }"
|
||||
end
|
||||
|
||||
def test_all_projects_txt_with_hidden_project
|
||||
p = projects(:timemachine)
|
||||
p.hide!
|
||||
assert_success "/projects/feed/text/admin/#{ users(:admin_user).word }"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assert_success(url)
|
||||
get url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue