Sha256: eae2a4dbc2972f7211246afd09e8eed9badd1344bb1a5382578be065e8f34a1f
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
require "test_helper" class HumanizableTest < ActiveSupport::TestCase include Hiccup def self.test_humanize(*args) expected_string = args.shift attributes = args.shift test(expected_string) do schedule = Schedule.new(attributes) assert_equal expected_string, schedule.humanize end end test_humanize( "Every Sunday", {:kind => :weekly, :pattern => %w[Sunday]}) test_humanize( "Every other Sunday", {:kind => :weekly, :pattern => %w[Sunday], :skip => 2}) test_humanize( "Every Sunday and Monday", {:kind => :weekly, :pattern => %w[Sunday Monday]}) test_humanize( "Monday, Wednesday, and Friday of every third week", {:kind => :weekly, :pattern => %w[Monday Wednesday Friday], :skip => 3}) test_humanize( "The 4th of every month", {:kind => :monthly, :pattern => [4]}) test_humanize( "The 4th and 5th of every month", {:kind => :monthly, :pattern => [4,5]}) test_humanize( "The first Monday of every month", {:kind => :monthly, :pattern => [[1, "Monday"]]}) test_humanize( "The last Tuesday of every month", {:kind => :monthly, :pattern => [[-1, "Tuesday"]]}) test_humanize( "The first Monday and third Monday of every other month", {:kind => :monthly, :pattern => [[1, "Monday"], [3, "Monday"]], :skip => 2}) test_humanize( "Every year on #{Date.today.strftime('%b %d')}", {:kind => :annually}) test_humanize( "Every other year on #{Date.today.strftime('%b %d')}", {:kind => :annually, :skip => 2}) test_humanize( "Every fourth year on #{Date.today.strftime('%b %d')}", {:kind => :annually, :skip => 4}) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hiccup-0.2.0 | test/humanizable_test.rb |