mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-29 12:16:11 +01:00
rename repeating -> recurring, repeat -> recurrence
This commit is contained in:
parent
ab02d09830
commit
dfe8735c0d
35 changed files with 125 additions and 125 deletions
|
|
@ -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,
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
module RecurringTodos
|
||||
|
||||
class DailyRepeatPatternTest < ActiveSupport::TestCase
|
||||
class DailyRecurrencePatternTest < ActiveSupport::TestCase
|
||||
fixtures :users
|
||||
|
||||
def setup
|
||||
|
|
@ -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
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
module RecurringTodos
|
||||
|
||||
class WeeklyRepeatPatternTest < ActiveSupport::TestCase
|
||||
class WeeklyRecurrencePatternTest < ActiveSupport::TestCase
|
||||
fixtures :users
|
||||
|
||||
def setup
|
||||
|
|
@ -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
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue