Merge branch 'master' of github.com:bsag/tracks

This commit is contained in:
Reinier Balt 2010-05-13 18:37:47 +02:00
commit 51a8e98752
15 changed files with 43 additions and 393 deletions

View file

@ -55,7 +55,7 @@ class TodosController < ApplicationController
predecessor_list = p.predecessor_list predecessor_list = p.predecessor_list
@todo = current_user.todos.build(p.attributes) @todo = current_user.todos.build(p.attributes)
if p.project_specified_by_name? if p.project_specified_by_name?
project = current_user.projects.find_or_create_by_name(p.project_name) project = current_user.projects.find_or_create_by_name(p.project_name)
@new_project_created = project.new_record_before_save? @new_project_created = project.new_record_before_save?
@ -70,8 +70,16 @@ class TodosController < ApplicationController
end end
@todo.add_predecessor_list(predecessor_list) @todo.add_predecessor_list(predecessor_list)
# Fix for #977 because AASM overrides @state on creation
specified_state = @todo.state
@todo.update_state_from_project @todo.update_state_from_project
@saved = @todo.save @saved = @todo.save
# Fix for #977 because AASM overrides @state on creation
@todo.update_attribute('state', specified_state) unless specified_state == "immediate"
unless (@saved == false) || tag_list.blank? unless (@saved == false) || tag_list.blank?
@todo.tag_with(tag_list) @todo.tag_with(tag_list)
@todo.tags.reload @todo.tags.reload

View file

@ -119,10 +119,8 @@ module TodosHelper
def grip_span def grip_span
unless @todo.completed? unless @todo.completed?
image_tag('grip.png', :width => '7', :height => '16', :border => '0', image_tag('grip.png', :width => '7', :height => '16', :border => '0',
:title => 'Drag onto another action to make it depend on that action', :title => 'Drag onto another action to make it depend on that action',
:class => 'grip') + :class => 'grip')
image_tag('blank.png', :width => 16, :height => 16, :border => 0,
:title => "Drop an action to make it depend on this action", :class => 'successor_target drop_target')
end end
end end

View file

@ -30,7 +30,6 @@ class RecurringTodo < ActiveRecord::Base
validates_presence_of :description validates_presence_of :description
validates_presence_of :recurring_period validates_presence_of :recurring_period
validates_presence_of :target validates_presence_of :target
validates_presence_of :recurring_period
validates_presence_of :ends_on validates_presence_of :ends_on
validates_presence_of :context validates_presence_of :context

View file

@ -1,179 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.47pre4 r22446"
sodipodi:docname="predecessor.svg"
inkscape:export-filename="/Users/epall/code/tracks/public/images/add_successor_on.png"
inkscape:export-xdpi="9.6245861"
inkscape:export-ydpi="9.6245861">
<defs
id="defs4">
<linearGradient
id="linearGradient5258">
<stop
style="stop-color:#28343c;stop-opacity:1;"
offset="0"
id="stop5260" />
<stop
style="stop-color:#0096ff;stop-opacity:1;"
offset="1"
id="stop5262" />
</linearGradient>
<marker
inkscape:stockid="TriangleOutM"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutM"
style="overflow:visible">
<path
id="path3768"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
transform="scale(0.4)" />
</marker>
<marker
inkscape:stockid="TriangleOutS"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutS"
style="overflow:visible">
<path
id="path3771"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
transform="scale(0.2)" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mend"
style="overflow:visible;">
<path
id="path3649"
style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) rotate(180) translate(0,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Mend"
style="overflow:visible;">
<path
id="path3631"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
transform="scale(0.4) rotate(180) translate(10,0)" />
</marker>
<marker
inkscape:stockid="TriangleOutL"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutL"
style="overflow:visible">
<path
id="path3765"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
transform="scale(0.8)" />
</marker>
<inkscape:path-effect
effect="spiro"
id="path-effect2826"
is_visible="true" />
<inkscape:path-effect
effect="spiro"
id="path-effect2822"
is_visible="true" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="29.11825 : 616.44767 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5258"
id="linearGradient5264"
x1="142.18495"
y1="261.65085"
x2="142.54144"
y2="174.1613"
gradientUnits="userSpaceOnUse" />
<filter
inkscape:collect="always"
id="filter5282">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.63631671"
id="feGaussianBlur5284" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.3579107"
inkscape:cx="109.12131"
inkscape:cy="846.66442"
inkscape:document-units="px"
inkscape:current-layer="g5238"
showgrid="false"
inkscape:window-width="675"
inkscape:window-height="547"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g5238"
transform="translate(-23.335007,-4.8042662)"
style="fill:none;stroke:#ff0000;stroke-width:0.7;stroke-miterlimit:4;stroke-dasharray:none">
<path
id="path5244"
style="fill:url(#linearGradient5264);fill-opacity:1;stroke:#3a3a3a;stroke-width:4;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:none;filter:url(#filter5282)"
d="m 124.05478,198.95569 25.59428,-0.003 -38.08971,39.75365 -36.022918,-39.75365 23.518346,0.003 0,-11.2623 c 0,-11.56985 3.814362,-23.72799 12.843752,-32.8125 9.02939,-9.08451 22.71756,-14.28125 39.34375,-14.28125 15.89659,0 28.81237,4.90636 36.875,13.9375 8.06263,9.03114 10.40625,20.50418 10.40625,30.9375 l 0,97.6875 -25,0 0,-97.6875 c 0,-6.68688 -1.49995,-11.41088 -4.0625,-14.28125 -2.56255,-2.87037 -7.00817,-5.59375 -18.21875,-5.59375 -11.69655,0 -17.86524,3.15497 -21.59375,6.90625 -3.72851,3.75128 -5.59375,8.92322 -5.59375,15.1875 l 0,11.2623 z"
sodipodi:nodetypes="ccccccscsccccssscc"
transform="matrix(-1,0,0,1,274.05996,0)" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.1 KiB

View file

@ -1,175 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.47pre4 r22446"
sodipodi:docname="predecessor.svg">
<defs
id="defs4">
<linearGradient
id="linearGradient5258">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop5260" />
<stop
style="stop-color:#ececec;stop-opacity:1;"
offset="1"
id="stop5262" />
</linearGradient>
<marker
inkscape:stockid="TriangleOutM"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutM"
style="overflow:visible">
<path
id="path3768"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
transform="scale(0.4)" />
</marker>
<marker
inkscape:stockid="TriangleOutS"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutS"
style="overflow:visible">
<path
id="path3771"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
transform="scale(0.2)" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mend"
style="overflow:visible;">
<path
id="path3649"
style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) rotate(180) translate(0,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Mend"
style="overflow:visible;">
<path
id="path3631"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
transform="scale(0.4) rotate(180) translate(10,0)" />
</marker>
<marker
inkscape:stockid="TriangleOutL"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutL"
style="overflow:visible">
<path
id="path3765"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
transform="scale(0.8)" />
</marker>
<inkscape:path-effect
effect="spiro"
id="path-effect2826"
is_visible="true" />
<inkscape:path-effect
effect="spiro"
id="path-effect2822"
is_visible="true" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="29.11825 : 616.44767 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5258"
id="linearGradient5264"
x1="142.54144"
y1="285.28931"
x2="142.54144"
y2="174.1613"
gradientUnits="userSpaceOnUse" />
<filter
inkscape:collect="always"
id="filter5282">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.63631671"
id="feGaussianBlur5284" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.51319034"
inkscape:cx="156.62969"
inkscape:cy="949.8091"
inkscape:document-units="px"
inkscape:current-layer="g5238"
showgrid="false"
inkscape:window-width="675"
inkscape:window-height="547"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g5238"
transform="translate(-23.335007,-4.8042662)"
style="fill:none;stroke:#ff0000;stroke-width:0.7;stroke-miterlimit:4;stroke-dasharray:none">
<path
id="path5244"
style="fill:url(#linearGradient5264);stroke:#3a3a3a;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;marker-start:none;stroke-opacity:1;fill-opacity:1;filter:url(#filter5282)"
d="m 124.05478,198.95569 25.59428,-0.003 -38.08971,39.75365 -36.022918,-39.75365 23.518346,0.003 0,-11.2623 c 0,-11.56985 3.814362,-23.72799 12.843752,-32.8125 9.02939,-9.08451 22.71756,-14.28125 39.34375,-14.28125 15.89659,0 28.81237,4.90636 36.875,13.9375 8.06263,9.03114 10.40625,20.50418 10.40625,30.9375 l 0,97.6875 -25,0 0,-97.6875 c 0,-6.68688 -1.49995,-11.41088 -4.0625,-14.28125 -2.56255,-2.87037 -7.00817,-5.59375 -18.21875,-5.59375 -11.69655,0 -17.86524,3.15497 -21.59375,6.90625 -3.72851,3.75128 -5.59375,8.92322 -5.59375,15.1875 l 0,11.2623 z"
sodipodi:nodetypes="ccccccscsccccssscc" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.9 KiB

View file

@ -37,15 +37,8 @@ When /^I drag "(.*)" to "(.*)"$/ do |dragged, target|
drag_id = Todo.find_by_description(dragged).id drag_id = Todo.find_by_description(dragged).id
drop_id = Todo.find_by_description(target).id drop_id = Todo.find_by_description(target).id
drag_name = "xpath=//div[@id='line_todo_#{drag_id}']//img[@class='grip']" drag_name = "xpath=//div[@id='line_todo_#{drag_id}']//img[@class='grip']"
# xpath does not seem to work here... reverting to css drop_name = "xpath=//div[@id='line_todo_#{drop_id}']//div[@class='description']"
# xpath=//div[@id='line_todo_#{drop_id}']//img[@class='successor_target']
drop_name = "css=div#line_todo_#{drop_id} img.successor_target"
# HACK: the target img is hidden until drag starts. We need to show the img or the
# xpath will not find it
js="$('div#line_todo_#{drop_id} img.successor_target').show();"
selenium.get_eval "(function() {with(this) {#{js}}}).call(selenium.browserbot.getCurrentWindow());"
selenium.drag_and_drop_to_object(drag_name, drop_name) selenium.drag_and_drop_to_object(drag_name, drop_name)
arrow = "xpath=//div[@id='line_todo_#{drop_id}']/div/a[@class='show_successors']/img" arrow = "xpath=//div[@id='line_todo_#{drop_id}']/div/a[@class='show_successors']/img"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

View file

@ -229,7 +229,7 @@ function enable_rich_interaction(){
/* Drag & Drop for successor/predecessor */ /* Drag & Drop for successor/predecessor */
function drop_todo(evt, ui) { function drop_todo(evt, ui) {
dragged_todo = ui.draggable[0].id.split('_')[2]; dragged_todo = ui.draggable[0].id.split('_')[2];
dropped_todo = $(this).parents('.item-show').get(0).id.split('_')[2]; dropped_todo = this.id.split('_')[2];
ui.draggable.remove(); ui.draggable.remove();
$(this).block({message: null}); $(this).block({message: null});
$.post(relative_to_root('todos/add_predecessor'), $.post(relative_to_root('todos/add_predecessor'),
@ -247,7 +247,7 @@ function enable_rich_interaction(){
start: drag_todo, start: drag_todo,
stop: function() {$('.drop_target').hide();}}); stop: function() {$('.drop_target').hide();}});
$('.successor_target').droppable({drop: drop_todo, $('.item-show').droppable({drop: drop_todo,
tolerance: 'pointer', tolerance: 'pointer',
hoverClass: 'hover'}); hoverClass: 'hover'});

View file

@ -943,16 +943,9 @@ div.message {
display:none; display:none;
} }
.successor_target { .hover {
background-image:url("../images/add_successor_off.png"); background: #EAEAEA;
background-repeat: no-repeat; font-weight: bold;
background-position: center right;
}
.successor_target.hover {
background-image:url("../images/add_successor_on.png");
background-repeat: no-repeat;
background-position: center right;
} }
.context_target { .context_target {

View file

@ -1,4 +1,3 @@
<%
def today def today
Time.zone.now.beginning_of_day.to_s(:db) Time.zone.now.beginning_of_day.to_s(:db)
@ -30,7 +29,7 @@ call_bill_gates_every_day:
description: Call Bill Gates every day description: Call Bill Gates every day
notes: ~ notes: ~
state: active state: active
start_from: ~ start_from: <%= last_week %>
ends_on: no_end_date ends_on: no_end_date
end_date: ~ end_date: ~
number_of_occurences: ~ number_of_occurences: ~
@ -38,6 +37,7 @@ call_bill_gates_every_day:
show_from_delta: ~ show_from_delta: ~
recurring_period: daily recurring_period: daily
recurrence_selector: ~ recurrence_selector: ~
show_always: 0
every_other1: 1 every_other1: 1
every_other2: ~ every_other2: ~
every_other3: ~ every_other3: ~
@ -62,6 +62,7 @@ call_bill_gates_every_workday:
number_of_occurences: ~ number_of_occurences: ~
target: due_date target: due_date
show_from_delta: ~ show_from_delta: ~
show_always: 0
recurring_period: daily recurring_period: daily
recurrence_selector: ~ recurrence_selector: ~
every_other1: 1 every_other1: 1
@ -82,7 +83,7 @@ call_bill_gates_every_week:
description: Call Bill Gates every week description: Call Bill Gates every week
notes: ~ notes: ~
state: active state: active
start_from: ~ start_from: <%= today %>
ends_on: no_end_date ends_on: no_end_date
end_date: ~ end_date: ~
number_of_occurences: ~ number_of_occurences: ~
@ -90,6 +91,7 @@ call_bill_gates_every_week:
show_from_delta: ~ show_from_delta: ~
recurring_period: weekly recurring_period: weekly
recurrence_selector: ~ recurrence_selector: ~
show_always: 0
every_other1: 2 every_other1: 2
every_other2: ~ every_other2: ~
every_other3: ~ every_other3: ~
@ -108,7 +110,7 @@ check_with_bill_every_last_friday_of_month:
description: Check with Bill every last friday of the month description: Check with Bill every last friday of the month
notes: ~ notes: ~
state: active state: active
start_from: ~ start_from: <%= today %>
ends_on: no_end_date ends_on: no_end_date
end_date: ~ end_date: ~
number_of_occurences: ~ number_of_occurences: ~
@ -116,6 +118,7 @@ check_with_bill_every_last_friday_of_month:
show_from_delta: 5 show_from_delta: 5
recurring_period: monthly recurring_period: monthly
recurrence_selector: 1 recurrence_selector: 1
show_always: 0
every_other1: 1 every_other1: 1
every_other2: 2 every_other2: 2
every_other3: 5 every_other3: 5
@ -134,12 +137,13 @@ birthday_reinier:
description: Congratulate Reinier on his birthday description: Congratulate Reinier on his birthday
notes: ~ notes: ~
state: active state: active
start_from: ~ start_from: <%= today %>
ends_on: no_end_date ends_on: no_end_date
end_date: ~ end_date: ~
number_of_occurences: ~ number_of_occurences: ~
target: due_date target: due_date
show_from_delta: 5 show_from_delta: 5
show_always: 0
recurring_period: yearly recurring_period: yearly
recurrence_selector: 0 recurrence_selector: 0
every_other1: 8 every_other1: 8

View file

@ -51,7 +51,7 @@ class LoginControllerTest < ActionController::TestCase
def test_login_with_no_users_redirects_to_signup def test_login_with_no_users_redirects_to_signup
User.delete_all User.delete_all
get :login get :login
assert_redirected_to :controller => 'users', :action => 'new' assert_redirected_to signup_url
end end
def test_logout def test_logout

View file

@ -50,6 +50,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
"recurring_period"=>"yearly", "recurring_period"=>"yearly",
"recurring_show_days_before"=>"10", "recurring_show_days_before"=>"10",
"recurring_target"=>"due_date", "recurring_target"=>"due_date",
"recurring_show_always" => "1",
"start_from"=>"18/08/2008", "start_from"=>"18/08/2008",
"weekly_every_x_week"=>"1", "weekly_every_x_week"=>"1",
"weekly_return_monday"=>"m", "weekly_return_monday"=>"m",
@ -110,6 +111,9 @@ class RecurringTodosControllerTest < ActionController::TestCase
@yearly.every_other1 = target_date.day @yearly.every_other1 = target_date.day
@yearly.every_other2 = target_date.month @yearly.every_other2 = target_date.month
@yearly.show_from_delta = 10 @yearly.show_from_delta = 10
# unless @yearly.valid?
# @yearly.errors.each {|obj, error| puts error}
# end
assert @yearly.save assert @yearly.save
# toggle twice to force generation of new todo # toggle twice to force generation of new todo
@ -155,6 +159,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
"recurring_period"=>"yearly", "recurring_period"=>"yearly",
"recurring_show_days_before"=>"0", "recurring_show_days_before"=>"0",
"recurring_target"=>"due_date", "recurring_target"=>"due_date",
"recurring_show_always" => "1",
"start_from"=>"1/10/2012", # adjust after 2012 "start_from"=>"1/10/2012", # adjust after 2012
"weekly_every_x_week"=>"1", "weekly_every_x_week"=>"1",
"weekly_return_monday"=>"w", "weekly_return_monday"=>"w",

View file

@ -376,12 +376,16 @@ class TodosControllerTest < ActionController::TestCase
# change recurrence pattern to monthly and set show_from 2 days before due # change recurrence pattern to monthly and set show_from 2 days before due
# date this forces the next todo to be put in the tickler # date this forces the next todo to be put in the tickler
recurring_todo_1.show_from_delta = 2 recurring_todo_1.show_from_delta = 2
recurring_todo_1.show_always = 0
recurring_todo_1.target = 'due_date'
recurring_todo_1.recurring_period = 'monthly' recurring_todo_1.recurring_period = 'monthly'
recurring_todo_1.recurrence_selector = 0 recurring_todo_1.recurrence_selector = 0
recurring_todo_1.every_other1 = 1 recurring_todo_1.every_other1 = 1
recurring_todo_1.every_other2 = 2 recurring_todo_1.every_other2 = 2
recurring_todo_1.every_other3 = 5 recurring_todo_1.every_other3 = 5
recurring_todo_1.save # use assert to catch validation errors if present. we need to replace
# this with a good factory implementation
assert recurring_todo_1.save
# mark next_todo as complete by toggle_check # mark next_todo as complete by toggle_check
xhr :post, :toggle_check, :id => next_todo.id, :_source_view => 'todo' xhr :post, :toggle_check, :id => next_todo.id, :_source_view => 'todo'
@ -416,7 +420,7 @@ class TodosControllerTest < ActionController::TestCase
recurring_todo_1.recurrence_selector = 0 recurring_todo_1.recurrence_selector = 0
recurring_todo_1.every_other1 = today.day recurring_todo_1.every_other1 = today.day
recurring_todo_1.every_other2 = 1 recurring_todo_1.every_other2 = 1
recurring_todo_1.save assert recurring_todo_1.save
# mark todo_1 as complete by toggle_check, this gets rid of todo_1 that was # mark todo_1 as complete by toggle_check, this gets rid of todo_1 that was
# not correctly created from the adjusted recurring pattern we defined # not correctly created from the adjusted recurring pattern we defined

View file

@ -154,19 +154,19 @@ class UsersControllerTest < ActionController::TestCase
def test_create_with_invalid_password_redirects_to_new_user_page def test_create_with_invalid_password_redirects_to_new_user_page
login_as :admin_user login_as :admin_user
post :create, :user => {:login => 'newbie', :password => '', :password_confirmation => ''} post :create, :user => {:login => 'newbie', :password => '', :password_confirmation => ''}
assert_redirected_to :controller => 'users', :action => 'new' assert_redirected_to signup_path
end end
def test_create_with_invalid_login_does_not_add_a_new_user def test_create_with_invalid_login_does_not_add_a_new_user
login_as :admin_user login_as :admin_user
post :create, :user => {:login => 'n', :password => 'newbiepass', :password_confirmation => 'newbiepass'} post :create, :user => {:login => 'n', :password => 'newbiepass', :password_confirmation => 'newbiepass'}
assert_redirected_to :controller => 'users', :action => 'new' assert_redirected_to signup_path
end end
def test_create_with_invalid_login_redirects_to_new_user_page def test_create_with_invalid_login_redirects_to_new_user_page
login_as :admin_user login_as :admin_user
post :create, :user => {:login => 'n', :password => 'newbiepass', :password_confirmation => 'newbiepass'} post :create, :user => {:login => 'n', :password => 'newbiepass', :password_confirmation => 'newbiepass'}
assert_redirected_to :controller => 'users', :action => 'new' assert_redirected_to signup_path
end end
def test_create_with_duplicate_login_does_not_add_a_new_user def test_create_with_duplicate_login_does_not_add_a_new_user
@ -179,7 +179,7 @@ class UsersControllerTest < ActionController::TestCase
def test_create_with_duplicate_login_redirects_to_new_user_page def test_create_with_duplicate_login_redirects_to_new_user_page
login_as :admin_user login_as :admin_user
post :create, :user => {:login => 'jane', :password => 'newbiepass', :password_confirmation => 'newbiepass'} post :create, :user => {:login => 'jane', :password => 'newbiepass', :password_confirmation => 'newbiepass'}
assert_redirected_to :controller => 'users', :action => 'new' assert_redirected_to signup_path
end end
end end