rename repeating -> recurring, repeat -> recurrence

This commit is contained in:
Carsten Otto 2015-02-10 16:25:27 +01:00
parent ab02d09830
commit dfe8735c0d
35 changed files with 125 additions and 125 deletions

View file

@ -815,7 +815,7 @@ var RecurringTodosPage = {
$( "#new-recurring-todo" ).dialog( "open" );
});
/* setup dialog for new repeating action */
/* setup dialog for new recurring action */
$( "#new-recurring-todo" ).dialog({
autoOpen: false,
height: 690,
@ -847,7 +847,7 @@ var RecurringTodosPage = {
$('#recurring_'+this.id.split('_')[4]).show();
});
/* setup dialog for new repeating action */
/* setup dialog for new recurring action */
$( "#edit-recurring-todo" ).dialog({
autoOpen: false,
height: 690,

View file

@ -129,7 +129,7 @@ class ContextsController < ApplicationController
# actions, you'll get a warning dialogue. If you choose to go ahead, any
# actions in the context will also be deleted.
def destroy
# make sure the deleted recurring patterns are removed from associated todos
# make sure the deleted recurrence patterns are removed from associated todos
@context.recurring_todos.each { |rt| rt.clear_todos_association } unless @context.recurring_todos.nil?
@context.destroy

View file

@ -23,19 +23,19 @@ module RecurringTodos
end
def daily_pattern
@daily_pattern ||= create_pattern(DailyRepeatPattern)
@daily_pattern ||= create_pattern(DailyRecurrencePattern)
end
def weekly_pattern
@weekly_pattern ||= create_pattern(WeeklyRepeatPattern)
@weekly_pattern ||= create_pattern(WeeklyRecurrencePattern)
end
def monthly_pattern
@monthly_pattern ||= create_pattern(MonthlyRepeatPattern)
@monthly_pattern ||= create_pattern(MonthlyRecurrencePattern)
end
def yearly_pattern
@yearly_pattern ||= create_pattern(YearlyRepeatPattern)
@yearly_pattern ||= create_pattern(YearlyRecurrencePattern)
end
def method_missing(method, *args)

View file

@ -72,7 +72,7 @@ class RecurringTodo < ActiveRecord::Base
def pattern
if valid_period?
@pattern = eval("RecurringTodos::#{recurring_period.capitalize}RepeatPattern.new(user)")
@pattern = eval("RecurringTodos::#{recurring_period.capitalize}RecurrencePattern.new(user)")
@pattern.build_from_recurring_todo(self)
end
@pattern

View file

@ -1,6 +1,6 @@
module RecurringTodos
class AbstractRepeatPattern
class AbstractRecurrencePattern
attr_accessor :attributes
@ -41,7 +41,7 @@ module RecurringTodos
end
def recurrence_pattern
raise "Should not call AbstractRepeatPattern.recurrence_pattern directly. Overwrite in subclass"
raise "Should not call AbstractRecurrencePattern.recurrence_pattern directly. Overwrite in subclass"
end
def xth(x)
@ -151,7 +151,7 @@ module RecurringTodos
end
def get_next_date(previous)
raise "Should not call AbstractRepeatPattern.get_next_date directly. Overwrite in subclass"
raise "Should not call AbstractRecurrencePattern.get_next_date directly. Overwrite in subclass"
end
def continues_recurring?(previous)

View file

@ -1,6 +1,6 @@
module RecurringTodos
class DailyRepeatPattern < AbstractRepeatPattern
class DailyRecurrencePattern < AbstractRecurrencePattern
def initialize(user)
super user

View file

@ -4,7 +4,7 @@ module RecurringTodos
attr_reader :recurring_todo, :pattern
def initialize(user, attributes)
super(user, attributes, DailyRepeatPattern)
super(user, attributes, DailyRecurrencePattern)
end
def attributes_to_filter

View file

@ -1,6 +1,6 @@
module RecurringTodos
class MonthlyRepeatPattern < AbstractRepeatPattern
class MonthlyRecurrencePattern < AbstractRecurrencePattern
def initialize(user)
super user

View file

@ -4,7 +4,7 @@ module RecurringTodos
attr_reader :recurring_todo
def initialize(user, attributes)
super(user, attributes, MonthlyRepeatPattern)
super(user, attributes, MonthlyRecurrencePattern)
end
def attributes_to_filter

View file

@ -1,6 +1,6 @@
module RecurringTodos
class WeeklyRepeatPattern < AbstractRepeatPattern
class WeeklyRecurrencePattern < AbstractRecurrencePattern
def initialize(user)
super user

View file

@ -4,7 +4,7 @@ module RecurringTodos
attr_reader :recurring_todo
def initialize(user, attributes)
super(user, attributes, WeeklyRepeatPattern)
super(user, attributes, WeeklyRecurrencePattern)
end
def attributes_to_filter

View file

@ -1,6 +1,6 @@
module RecurringTodos
class YearlyRepeatPattern < AbstractRepeatPattern
class YearlyRecurrencePattern < AbstractRecurrencePattern
def initialize(user)
super user

View file

@ -4,7 +4,7 @@ module RecurringTodos
attr_reader :recurring_todo
def initialize(user, attributes)
super(user, attributes, YearlyRepeatPattern)
super(user, attributes, YearlyRecurrencePattern)
end
def attributes_to_filter

View file

@ -254,7 +254,7 @@ en:
common:
back: Back
third: Third
recurring_todos: Repeating Actions
recurring_todos: Recurring Actions
actions: Actions
actions_midsentence:
zero: actions
@ -387,7 +387,7 @@ en:
home: Home
navigation:
manage_users_title: Add or delete users
recurring_todos: Repeating todos
recurring_todos: Recurring todos
api_docs: REST API Docs
feeds: Feeds
starred: Starred
@ -697,7 +697,7 @@ en:
due_date: with a due date %{due_date} or earlier
overdue: Overdue
add_new_recurring: Add a new recurring action
edit_recurring_todo: Edit repeating action
edit_recurring_todo: Edit recurring action
see_all_completed: You can see all completed actions %{link}
all_completed_here: here
contexts:
@ -705,7 +705,7 @@ en:
all_completed_tasks_title: "TRACKS::All Completed actions in the context '%{context_name}'"
hide_form: Hide form
show_form_title: Add a context
delete_context_confirmation: "Are you sure that you want to delete the context '%{name}'? Be aware that this will also delete all (repeating) actions in this context!"
delete_context_confirmation: "Are you sure that you want to delete the context '%{name}'? Be aware that this will also delete all (recurring) actions in this context!"
delete_context: Delete context
edit_context: Edit context
hide_form_title: Hide new context form

View file

@ -35,7 +35,7 @@ Feature: Existing user logging in
| contexts page | contexts page | Logout (Test User) |
| projects page | projects page | Logout (Test User) |
| notes page | notes page | Logout (Test User) |
| repeating todos page | repeating todos page | Logout (Test User) |
| recurring todos page | recurring todos page | Logout (Test User) |
| statistics page | statistics page | Logout (Test User) |
| manage users page | manage users page | 401 Unauthorized |
| integrations page | integrations page | Logout (Test User) |

View file

@ -1,7 +1,7 @@
Feature: Manage recurring todos
In order to manage repeating todos
In order to manage recurring todos
As a Tracks user
I want to view, edit, add, or remove recurrence patterns of repeating todos
I want to view, edit, add, or remove recurrence patterns of recurring todos
Background:
Given the following user record
@ -9,11 +9,11 @@ Feature: Manage recurring todos
| testuser | secret | false |
And I have logged in as "testuser" with password "secret"
And I have a context called "test context"
And I have a repeat pattern called "run tests"
And I have a recurrence pattern called "run tests"
@javascript
Scenario: Being able to select daily, weekly, monthly and yearly pattern
When I go to the repeating todos page
When I go to the recurring todos page
And I follow "Add a new recurring action"
Then I should see the form for "Daily" recurrence pattern
When I select "Weekly" recurrence pattern
@ -26,27 +26,27 @@ Feature: Manage recurring todos
Then I should see the form for "Daily" recurrence pattern
@javascript
Scenario: I can mark a repeat pattern as starred
When I go to the repeating todos page
Scenario: I can mark a recurrence pattern as starred
When I go to the recurring todos page
And I star the pattern "run tests"
Then the pattern "run tests" should be starred
@javascript
Scenario: I can edit a repeat pattern
When I go to the repeating todos page
Scenario: I can edit a recurrence pattern
When I go to the recurring todos page
And I edit the name of the pattern "run tests" to "report test results"
Then the pattern "report test results" should be in the state list "active"
And I should not see "run tests"
@javascript
Scenario: I can delete a repeat pattern
When I go to the repeating todos page
Scenario: I can delete a recurrence pattern
When I go to the recurring todos page
And I delete the pattern "run tests"
And I should not see "run tests"
@javascript
Scenario: I can mark a repeat pattern as done
When I go to the repeating todos page
Scenario: I can mark a recurrence pattern as done
When I go to the recurring todos page
Then the pattern "run tests" should be in the state list "active"
And the state list "completed" should be empty
When I mark the pattern "run tests" as complete
@ -54,9 +54,9 @@ Feature: Manage recurring todos
And the state list "active" should be empty
@javascript
Scenario: I can reactivate a repeat pattern
Given I have a completed repeat pattern "I'm done"
When I go to the repeating todos page
Scenario: I can reactivate a recurrence pattern
Given I have a completed recurrence pattern "I'm done"
When I go to the recurring todos page
Then the pattern "I'm done" should be in the state list "completed"
When I mark the pattern "I'm done" as active
Then the pattern "I'm done" should be in the state list "active"
@ -67,11 +67,11 @@ Feature: Manage recurring todos
When I go to the home page
Then I should see the todo "run tests"
When I follow the recurring todo link of "run tests"
Then I should be on the repeating todos page
Then I should be on the recurring todos page
@javascript
Scenario: Deleting a recurring todo with ending pattern will show message
When I go to the repeating todos page
When I go to the recurring todos page
And I mark the pattern "run tests" as complete
And I go to the home page
Then I should see "run tests"

View file

@ -111,27 +111,27 @@ Then /^I should see "([^"]*)" in the due next month container$/ do |todo_descrip
end
end
####### Repeat patterns #######
####### Recurrence patterns #######
Then /^I should (see|not see) "([^"]*)" in the active recurring todos container$/ do |visibility, repeat_pattern|
repeat = @current_user.recurring_todos.where(:description => repeat_pattern).first
Then /^I should (see|not see) "([^"]*)" in the active recurring todos container$/ do |visibility, recurrence_pattern|
recurrence = @current_user.recurring_todos.where(:description => recurrence_pattern).first
unless repeat.nil?
xpath = "//div[@id='active_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
unless recurrence.nil?
xpath = "//div[@id='active_recurring_todos_container']//div[@id='recurring_todo_#{recurrence.id}']"
check_xpath_visibility(visibility, xpath)
else
step "I should #{visibility} \"#{repeat_pattern}\""
step "I should #{visibility} \"#{recurrence_pattern}\""
end
end
Then /^I should (see|not see) "([^"]*)" in the completed recurring todos container$/ do |visible, repeat_pattern|
repeat = @current_user.todos.where(:description => repeat_pattern).first
Then /^I should (see|not see) "([^"]*)" in the completed recurring todos container$/ do |visible, recurrence_pattern|
recurrence = @current_user.todos.where(:description => recurrence_pattern).first
unless repeat.nil?
xpath = "//div[@id='completed_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
unless recurrence.nil?
xpath = "//div[@id='completed_recurring_todos_container']//div[@id='recurring_todo_#{recurrence.id}']"
check_xpath_visibility(visible, xpath)
else
step "I should #{visible} \"#{repeat_pattern}\""
step "I should #{visible} \"#{recurrence_pattern}\""
end
end

View file

@ -4,7 +4,7 @@ When /^I delete the context "([^\"]*)"$/ do |context_name|
handle_js_confirm do
click_link "delete_context_#{context.id}"
end
expect(get_confirm_text).to eq("Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (repeating) actions in this context!")
expect(get_confirm_text).to eq("Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (recurring) actions in this context!")
# wait until the context is removed
expect(page).to_not have_css("a#delete_context_#{context.id}")

View file

@ -1,4 +1,4 @@
Given /^I have a repeat pattern called "([^"]*)"$/ do |pattern_name|
Given /^I have a recurrence pattern called "([^"]*)"$/ do |pattern_name|
context = @current_user.contexts.first
@recurring_todo = @current_user.recurring_todos.create!(
@ -21,15 +21,15 @@ Given /^I have a repeat pattern called "([^"]*)"$/ do |pattern_name|
:recurring_todo_id => @recurring_todo.id)
end
Given /^I have a completed repeat pattern "([^"]*)"$/ do |pattern_name|
step "I have a repeat pattern called \"#{pattern_name}\""
Given /^I have a completed recurrence pattern "([^"]*)"$/ do |pattern_name|
step "I have a recurrence pattern called \"#{pattern_name}\""
@recurring_todo.toggle_completion!
expect(@recurring_todo.completed?).to be true
end
Given /^I have (\d+) completed repeat patterns$/ do |number_of_patterns|
Given /^I have (\d+) completed recurrence patterns$/ do |number_of_patterns|
1.upto number_of_patterns.to_i do |i|
step "I have a completed repeat pattern \"Repeating Todo #{i}\""
step "I have a completed recurrence pattern \"Recurring Todo #{i}\""
end
end

View file

@ -74,7 +74,7 @@ module NavigationHelpers
projects_path(options)
when /the manage users page/
users_path(options)
when /the repeating todos page/
when /the recurring todos page/
recurring_todos_path(options)
when /the integrations page/
integrations_path(options)

View file

@ -16,7 +16,7 @@ Feature: Show done
When I go to the done page
Then I should see "Last Completed Actions"
And I should see "Last Completed Projects"
And I should see "Last Completed Repeating Actions"
And I should see "Last Completed Recurring Actions"
Scenario Outline: Page with actions links to show all completed actions
When I go to the <page>
@ -95,7 +95,7 @@ Feature: Show done
And the page should be "2"
Scenario: The recurring todos page shows a link to all completed recurring todos
Given I have a completed repeat pattern "finished"
Given I have a completed recurrence pattern "finished"
When I go to the recurring todos page
Then I should see "finished"
And I should see "Show all"
@ -104,7 +104,7 @@ Feature: Show done
And I should see "finished"
Scenario: I can browse all completed recurring todos by page
Given I have 40 completed repeat patterns
Given I have 40 completed recurrence patterns
When I go to the recurring todos page
And I follow "Show all"
Then I should see the page selector
@ -115,7 +115,7 @@ Feature: Show done
@javascript
Scenario: I can toggle a done recurring todo active from done page
Given I have a completed repeat pattern "test pattern"
Given I have a completed recurrence pattern "test pattern"
When I go to the done recurring todos page
Then I should see "test pattern"
When I mark the pattern "test pattern" as active
@ -125,7 +125,7 @@ Feature: Show done
@javascript
Scenario: I can delete a recurring todo from the done page
Given I have a completed repeat pattern "test pattern"
Given I have a completed recurrence pattern "test pattern"
When I go to the done recurring todos page
Then I should see "test pattern"
When I delete the pattern "test pattern"

View file

@ -37,7 +37,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
{
"daily_every_x_days"=>"1",
"daily_selector"=>"daily_every_x_day",
"description"=>"new recurring pattern",
"description"=>"new recurrence pattern",
"end_date" => "31/08/2010",
"ends_on" => "ends_on_end_date",
"monthly_day_of_week" => "1",
@ -122,7 +122,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
login_as(:admin_user)
# check new rec todo is not there
assert_nil RecurringTodo.where(:description => "new recurring pattern").first
assert_nil RecurringTodo.where(:description => "new recurrence pattern").first
put :create,
"context_name"=>"library",
@ -131,7 +131,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
{
"daily_every_x_days"=>"1",
"daily_selector"=>"daily_every_x_day",
"description"=>"new recurring pattern",
"description"=>"new recurrence pattern",
"end_date" => "31/08/2010",
"ends_on" => "ends_on_end_date",
"monthly_day_of_week" => "1",
@ -158,7 +158,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
},
"tag_list"=>"one, two, three, four", :format => :js
new_rec_todo = RecurringTodo.where(:description => "new recurring pattern").first
new_rec_todo = RecurringTodo.where(:description => "new recurrence pattern").first
assert_not_nil new_rec_todo
@ -245,7 +245,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
{
"daily_every_x_days"=>"1",
"daily_selector"=>"daily_every_x_day",
"description"=>"new recurring pattern",
"description"=>"new recurrence pattern",
"end_date" => "",
"ends_on" => "no_end_date",
"monthly_day_of_week" => "1",
@ -278,7 +278,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
assert_equal orig_todo_count+1, Todo.count
# find the newly created todo
new_todo = Todo.where(:description => "new recurring pattern").first
new_todo = Todo.where(:description => "new recurrence pattern").first
assert !new_todo.nil?
# the date should be 31 march 2013
@ -299,7 +299,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
{
"daily_every_x_days"=>"1",
"daily_selector"=>"daily_every_x_day",
"description"=>"new recurring pattern",
"description"=>"new recurrence pattern",
"end_date" => "",
"ends_on" => "no_end_date",
"monthly_day_of_week" => "1",
@ -332,7 +332,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
assert_equal orig_todo_count+1, Todo.count
# find the newly created recurring todo
recurring_todo = RecurringTodo.where(:description => "new recurring pattern").first
recurring_todo = RecurringTodo.where(:description => "new recurrence pattern").first
assert !recurring_todo.nil?
assert_equal "due_date", recurring_todo.target
@ -351,7 +351,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
{
"daily_every_x_days"=>"1",
"daily_selector"=>"daily_every_x_day",
"description"=>"new recurring pattern",
"description"=>"new recurrence pattern",
"end_date" => nil,
"ends_on" => "no_end_date",
"monthly_day_of_week" => "2",
@ -378,7 +378,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
},
"tag_list"=>"one, two, three, four", format: :js
assert_equal "new recurring pattern", assigns['recurring_todo'].description
assert_equal "new recurrence pattern", assigns['recurring_todo'].description
assert_equal "2013-01-02 00:00:00 +0000", assigns['recurring_todo'].start_from.to_s
todo = assigns['recurring_todo'].todos.first
assert_equal "2013-01-02 00:00:00 +0000", todo.show_from.to_s
@ -393,12 +393,12 @@ class RecurringTodosControllerTest < ActionController::TestCase
assert_not_nil todo
assert_equal "active", todo.state, "todo should be active"
assert_equal "active", rt.state, "repeat pattern should be active"
assert_equal "active", rt.state, "recurrence pattern should be active"
get :index # will call find_and_inactivate
rt.reload
assert_equal "active", rt.state, "repeat pattern should still be active"
assert_equal "active", rt.state, "recurrence pattern should still be active"
# disconnect todo from pattern thus leaving the pattern without
# any active todos, but in active state
@ -408,11 +408,11 @@ class RecurringTodosControllerTest < ActionController::TestCase
todo.reload
rt.reload
assert_equal "active", rt.state, "repeat pattern should still be active and not changed"
assert_equal "active", rt.state, "recurrence pattern should still be active and not changed"
get :index
rt.reload
assert_equal "completed", rt.state, "repeat pattern should be completed"
assert_equal "completed", rt.state, "recurrence pattern should be completed"
end
def test_update_recurring_todo

View file

@ -676,7 +676,7 @@ class TodosControllerTest < ActionController::TestCase
count = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'active').count
assert_equal 1, count
# check there is a new todo linked to the recurring pattern
# check there is a new todo linked to the recurrence pattern
next_todo = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'active').first
assert_equal "Call Bill Gates every day", next_todo.description
# check that the new todo is not the same as todo_1
@ -706,7 +706,7 @@ class TodosControllerTest < ActionController::TestCase
count = Todo.where(:recurring_todo_id => recurring_todo_1.id).count
assert_equal 3, count
# check there is a new todo linked to the recurring pattern in the tickler
# check there is a new todo linked to the recurrence pattern in the tickler
next_todo = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'deferred').first
assert !next_todo.nil?
assert_equal "Call Bill Gates every day", next_todo.description
@ -758,16 +758,16 @@ class TodosControllerTest < ActionController::TestCase
tomorrow = Time.zone.now + 1.day
# Given a repeat pattern with recurring date set to tomorrow
# Given a recurrence pattern with recurring date set to tomorrow
recurring_todo_1 = RecurringTodo.find(5)
recurring_todo_1.every_other1 = tomorrow.day
recurring_todo_1.every_other2 = tomorrow.month
recurring_todo_1.save
# Given a recurring todo (todo) that belongs to the repeat pattern (recurring_todo_1) and is due tomorrow
# Given a recurring todo (todo) that belongs to the recurrence pattern (recurring_todo_1) and is due tomorrow
todo = Todo.where(:recurring_todo_id => 1).first
assert todo.from_recurring_todo?
todo.recurring_todo_id = 5 # rewire todo to the repeat pattern above
todo.recurring_todo_id = 5 # rewire todo to the recurrence pattern above
todo.due = tomorrow
todo.save!
@ -776,7 +776,7 @@ class TodosControllerTest < ActionController::TestCase
todo = Todo.find(todo.id) #reload does not seem to work here
assert todo.completed?
# Then there should not be an active todo belonging to the repeat pattern
# Then there should not be an active todo belonging to the recurrence pattern
next_todo = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'active').first
assert next_todo.nil?
@ -794,7 +794,7 @@ class TodosControllerTest < ActionController::TestCase
tomorrow = Time.zone.now + 1.day
# Given a monthly repeat pattern
# Given a monthly recurrence pattern
recurring_todo = RecurringTodo.find(5)
recurring_todo.target = "due_date"
recurring_todo.recurring_period = "monthly"
@ -802,10 +802,10 @@ class TodosControllerTest < ActionController::TestCase
recurring_todo.every_other2 = 1
recurring_todo.save
# Given a recurring todo (todo) that belongs to the repeat pattern (recurring_todo) and is due tomorrow
# Given a recurring todo (todo) that belongs to the recurrence pattern (recurring_todo) and is due tomorrow
todo = Todo.where(:recurring_todo_id => 1).first
assert todo.from_recurring_todo?
todo.recurring_todo_id = 5 # rewire todo to the repeat pattern above
todo.recurring_todo_id = 5 # rewire todo to the recurrence pattern above
todo.due = tomorrow
todo.save!
@ -814,7 +814,7 @@ class TodosControllerTest < ActionController::TestCase
todo.reload
assert todo.completed?
# Then there should not be an active todo belonging to the repeat pattern
# Then there should not be an active todo belonging to the recurrence pattern
next_todo = Todo.where(:recurring_todo_id => recurring_todo.id, :state => 'active').first
assert next_todo.nil?

View file

@ -2,7 +2,7 @@ require 'test_helper'
module RecurringTodos
class AbstractRepeatPatternTest < ActiveSupport::TestCase
class AbstractRecurrencePatternTest < ActiveSupport::TestCase
fixtures :users
def setup
@ -14,7 +14,7 @@ module RecurringTodos
rt = @admin.recurring_todos.first
pattern = rt.pattern
assert pattern.is_a?(DailyRepeatPattern), "recurring todo should have daily pattern"
assert pattern.is_a?(DailyRecurrencePattern), "recurring todo should have daily pattern"
end
def test_validation_on_due_date
@ -156,7 +156,7 @@ module RecurringTodos
create_pattern(attributes.reverse_merge({
'recurring_period' => 'weekly',
'recurring_target' => 'due_date',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'ends_on' => 'ends_on_end_date',
'end_date' => Time.zone.now + 1.week,
'context_id' => @admin.contexts.first.id,

View file

@ -5,7 +5,7 @@ module RecurringTodos
class AbstractRecurringTodosBuilderTest < ActiveSupport::TestCase
fixtures :users
class TestRepeatPattern < AbstractRepeatPattern
class TestRecurringPattern < AbstractRecurrencePattern
def selector_key
'test'
end
@ -33,7 +33,7 @@ module RecurringTodos
})
assert_raise(Exception, "should have exception since we are using abstract builder") do
builder = AbstractRecurringTodosBuilder.new(@admin, attributes, DailyRepeatPattern)
builder = AbstractRecurringTodosBuilder.new(@admin, attributes, DailyRecurrencePattern)
end
end

View file

@ -2,7 +2,7 @@ require 'test_helper'
module RecurringTodos
class DailyRepeatPatternTest < ActiveSupport::TestCase
class DailyRecurrencePatternTest < ActiveSupport::TestCase
fixtures :users
def setup

View file

@ -17,7 +17,7 @@ module RecurringTodos
def test_filter_non_daily_attributes
attributes = {
'recurring_period' => 'daily',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'daily_selector' => 'daily_every_x_day', # daily specific
'bla_bla' => 'go away' # irrelevant for daily
}
@ -27,7 +27,7 @@ module RecurringTodos
assert_nil result.get('bla_bla'), "bla_bla should be filtered"
assert_nil result.get(:bla_bla), "bla_bla should be filtered"
assert_equal false, result.get(:only_work_days), "daily attributes should be preserved"
assert_equal "a repeating todo", result.get(:description), "description should be preserved"
assert_equal "a recurring todo", result.get(:description), "description should be preserved"
end
def test_valid_selector
@ -54,7 +54,7 @@ module RecurringTodos
def test_mapping_of_attributes
attributes = Tracks::AttributeHandler.new(@admin, {
'recurring_period' => 'daily',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'daily_selector' => 'daily_every_x_day', # daily specific --> mapped to only_work_days=false
'daily_every_x_days' => '5' # mapped to every_other1
})
@ -66,7 +66,7 @@ module RecurringTodos
attributes = Tracks::AttributeHandler.new(@admin, {
'recurring_period' => 'daily',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'daily_selector' => 'daily_every_work_day', # daily specific --> mapped to only_work_days=true
})

View file

@ -13,11 +13,11 @@ module RecurringTodos
h = FormHelper.new(rt)
assert_equal 42, h.daily_every_x_days, "should be passed to DailyRepeatPattern"
assert_equal 42, h.weekly_every_x_week, "should be passed to WeeklyRepeatPattern"
assert_equal 42, h.monthly_every_x_day, "should be passed to MonthlyRepeatPattern"
assert_equal 42, h.yearly_every_x_day, "should be passed to YearlyRepeatPattern"
assert h.on_monday, "should be passed to WeeklyRepeatPattern"
assert_equal 42, h.daily_every_x_days, "should be passed to DailyRecurrencePattern"
assert_equal 42, h.weekly_every_x_week, "should be passed to WeeklyRecurrencePattern"
assert_equal 42, h.monthly_every_x_day, "should be passed to MonthlyRecurrencePattern"
assert_equal 42, h.yearly_every_x_day, "should be passed to YearlyRecurrencePattern"
assert h.on_monday, "should be passed to WeeklyRecurrencePattern"
end
end

View file

@ -2,7 +2,7 @@ require 'test_helper'
module RecurringTodos
class MonthlyRepeatPatternTest < ActiveSupport::TestCase
class MonthlyRecurrencePatternTest < ActiveSupport::TestCase
fixtures :users
def setup
@ -13,7 +13,7 @@ module RecurringTodos
def test_attribute_mapping
builder = RecurringTodosBuilder.new(@admin, {
'recurring_period' => 'monthly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'recurring_target' => 'show_from_date',
'ends_on' => 'ends_on_end_date',
'end_date' => Time.zone.now + 1.week,
@ -28,7 +28,7 @@ module RecurringTodos
assert builder.save, "should save: #{builder.errors.full_messages}"
rt = builder.saved_recurring_todo
assert builder.pattern.is_a?(MonthlyRepeatPattern), "should be monthly pattern, but is #{builder.pattern.class}"
assert builder.pattern.is_a?(MonthlyRecurrencePattern), "should be monthly pattern, but is #{builder.pattern.class}"
assert builder.pattern.every_x_day?, "should be true for monthly_every_x_day"
assert 1, rt.recurrence_selector
@ -42,7 +42,7 @@ module RecurringTodos
def test_every_x_month
builder = RecurringTodosBuilder.new(@admin, {
'recurring_period' => 'monthly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'recurring_target' => 'show_from_date',
'ends_on' => 'ends_on_end_date',
'end_date' => Time.zone.now + 1.week,
@ -61,7 +61,7 @@ module RecurringTodos
builder = RecurringTodosBuilder.new(@admin, {
'recurring_period' => 'monthly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'recurring_target' => 'show_from_date',
'ends_on' => 'ends_on_end_date',
'end_date' => Time.zone.now + 1.week,

View file

@ -17,7 +17,7 @@ module RecurringTodos
def test_filter_non_daily_attributes
attributes = {
'recurring_period' => 'monthly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'monthly_selector' => 'monthly_every_x_day', # monthly specific
'monthly_every_x_day' => 5, # should be preserved as :every_other1
'bla_bla' => 'go away' # irrelevant for daily
@ -54,7 +54,7 @@ module RecurringTodos
def test_mapping_of_attributes
attributes = Tracks::AttributeHandler.new(@admin, {
'recurring_period' => 'monthly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'monthly_selector' => 'monthly_every_x_day', # monthly specific
'monthly_every_x_day' => '5', # mapped to :every_other1
'monthly_every_xth_day' => '7', # mapped to :every_other3
@ -75,7 +75,7 @@ module RecurringTodos
attributes = Tracks::AttributeHandler.new(@admin, {
'recurring_period' => 'monthly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'monthly_selector' => 'monthly_every_xth_day', # monthly specific
'monthly_every_x_day' => '5', # mapped to :every_other1
'monthly_every_x_month' => '10', # not mapped

View file

@ -2,7 +2,7 @@ require 'test_helper'
module RecurringTodos
class WeeklyRepeatPatternTest < ActiveSupport::TestCase
class WeeklyRecurrencePatternTest < ActiveSupport::TestCase
fixtures :users
def setup

View file

@ -17,7 +17,7 @@ module RecurringTodos
def test_filter_non_daily_attributes
attributes = {
'recurring_period' => 'weekly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'weekly_return_monday' => 'm', # weekly specific
'bla_bla' => 'go away' # irrelevant
}
@ -27,13 +27,13 @@ module RecurringTodos
assert_nil result.get('bla_bla'), "bla_bla should be filtered"
assert_nil result.get(:bla_bla), "bla_bla should be filtered"
assert_equal ' m ', result.get(:every_day), "weekly attributes should be preserved"
assert_equal "a repeating todo", result.get(:description), "description should be preserved"
assert_equal "a recurring todo", result.get(:description), "description should be preserved"
end
def test_attributes_to_filter
attributes = Tracks::AttributeHandler.new(@admin, {
'recurring_period' => 'weekly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'weekly_return_monday' => 'm', # weekly specific
})
@ -46,7 +46,7 @@ module RecurringTodos
def test_mapping_of_attributes
attributes = Tracks::AttributeHandler.new(@admin, {
'recurring_period' => 'weekly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'weekly_every_x_week' => '5', # mapped to every_other1
'weekly_return_monday' => 'm'
})
@ -60,7 +60,7 @@ module RecurringTodos
def test_map_day
attributes = Tracks::AttributeHandler.new(@admin, {
'recurring_period' => 'weekly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'weekly_every_x_week' => '5' # mapped to every_other1
})

View file

@ -2,7 +2,7 @@ require 'test_helper'
module RecurringTodos
class YearlyRepeatPatternTest < ActiveSupport::TestCase
class YearlyRecurrencePatternTest < ActiveSupport::TestCase
fixtures :users
def setup
@ -13,7 +13,7 @@ module RecurringTodos
def test_attribute_mapping
builder = RecurringTodosBuilder.new(@admin, {
'recurring_period' => 'yearly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'recurring_target' => 'show_from_date',
'ends_on' => 'ends_on_end_date',
'end_date' => Time.zone.now + 1.week,
@ -30,7 +30,7 @@ module RecurringTodos
assert builder.save, "should save: #{builder.errors.full_messages}"
rt = builder.saved_recurring_todo
assert builder.pattern.is_a?(YearlyRepeatPattern), "should be yearly pattern, but is #{builder.pattern.class}"
assert builder.pattern.is_a?(YearlyRecurrencePattern), "should be yearly pattern, but is #{builder.pattern.class}"
assert_equal rt.recurrence_selector, builder.pattern.recurrence_selector
assert_equal rt.every_other2, builder.pattern.month_of_year

View file

@ -17,7 +17,7 @@ module RecurringTodos
def test_filter_non_daily_attributes
attributes = {
'recurring_period' => 'yearly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'yearly_selector' => 'yearly_every_x_day', # daily specific
'yearly_month_of_year' => '1', # mapped to evert_other2 because yearly_selector is yearly_every_x_day
'bla_bla' => 'go away' # irrelevant for daily
@ -28,7 +28,7 @@ module RecurringTodos
assert_nil result.get('bla_bla'), "bla_bla should be filtered"
assert_nil result.get(:bla_bla), "bla_bla should be filtered"
assert_equal '1', result.get(:every_other2), "yearly attributes should be preserved"
assert_equal "a repeating todo", result.get(:description), "description should be preserved"
assert_equal "a recurring todo", result.get(:description), "description should be preserved"
end
def test_valid_selector
@ -55,7 +55,7 @@ module RecurringTodos
def test_mapping_of_attributes
attributes = {
'recurring_period' => 'yearly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'yearly_selector' => 'yearly_every_x_day', # yearly specific
'yearly_every_x_day' => '5', # mapped to every_other1
'yearly_every_xth_day' => '7', # mapped to every_other3
@ -73,7 +73,7 @@ module RecurringTodos
attributes = {
'recurring_period' => 'yearly',
'description' => 'a repeating todo', # generic
'description' => 'a recurring todo', # generic
'yearly_selector' => 'yearly_every_xth_day', # daily specific --> mapped to only_work_days=false
'yearly_month_of_year' => '1', # ignored because yearly_selector is yearly_every_xth_day
'yearly_month_of_year2' => '2' # mapped to evert_other2 because yearly_selector is yearly_every_xth_day

View file

@ -385,7 +385,7 @@ class UserTest < ActiveSupport::TestCase
assert_equal expect_todos_count, Todo.count, "expected #{nr_of_todos} todos to be gone"
assert_equal expect_projects_count, Project.count, "expected #{nr_of_projects} projects to be gone"
assert_equal expect_contexts_count, Context.count, "expected #{nr_of_contexts} contexts to be gone"
assert_equal expect_rec_todos_count, RecurringTodo.count, "expected #{nr_of_rec_todos} repeating todos to be gone"
assert_equal expect_rec_todos_count, RecurringTodo.count, "expected #{nr_of_rec_todos} recurring todos to be gone"
assert_equal expect_notes_count, Note.count, "expected #{nr_of_notes} notes to be gone"
assert_equal expect_deps_count, Dependency.count, "expected #{nr_of_deps} dependencies to be gone"
end