Sha256: 74927e1b346e89a4d286206d798e2fe740b66db8d34509dc9d04991b42586315

Contents?: true

Size: 1.45 KB

Versions: 22

Compression:

Stored size: 1.45 KB

Contents

require "test_helper"


class CoreExtDateTest < ActiveSupport::TestCase
  
  
  test "should correctly identify the nth weekday of the month of a date" do
    assert_equal 1, Date.new(2012, 7, 1).get_nth_wday_of_month
    assert_equal 1, Date.new(2012, 7, 7).get_nth_wday_of_month
    assert_equal 2, Date.new(2012, 7, 8).get_nth_wday_of_month
    assert_equal 2, Date.new(2012, 7, 14).get_nth_wday_of_month
    assert_equal 3, Date.new(2012, 7, 15).get_nth_wday_of_month
    assert_equal 3, Date.new(2012, 7, 21).get_nth_wday_of_month
    assert_equal 4, Date.new(2012, 7, 22).get_nth_wday_of_month
    assert_equal 4, Date.new(2012, 7, 28).get_nth_wday_of_month
    assert_equal 5, Date.new(2012, 7, 29).get_nth_wday_of_month
  end
  
  test "should correctly identify the nth weekday of the month of a date as a string" do
    assert_equal "1 Sunday", Date.new(2012, 7, 1).get_nth_wday_string
    assert_equal "1 Saturday", Date.new(2012, 7, 7).get_nth_wday_string
    assert_equal "2 Sunday", Date.new(2012, 7, 8).get_nth_wday_string
    assert_equal "2 Saturday", Date.new(2012, 7, 14).get_nth_wday_string
    assert_equal "3 Sunday", Date.new(2012, 7, 15).get_nth_wday_string
    assert_equal "3 Saturday", Date.new(2012, 7, 21).get_nth_wday_string
    assert_equal "4 Sunday", Date.new(2012, 7, 22).get_nth_wday_string
    assert_equal "4 Saturday", Date.new(2012, 7, 28).get_nth_wday_string
    assert_equal "5 Sunday", Date.new(2012, 7, 29).get_nth_wday_string
  end
  
  
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hiccup-0.5.14 test/core_ext_date_test.rb
hiccup-0.5.13 test/core_ext_date_test.rb
hiccup-0.5.12 test/core_ext_date_test.rb
hiccup-0.5.11 test/core_ext_date_test.rb
hiccup-0.5.10 test/core_ext_date_test.rb
hiccup-0.5.9 test/core_ext_date_test.rb
hiccup-0.5.8 test/core_ext_date_test.rb
hiccup-0.5.7 test/core_ext_date_test.rb
hiccup-0.5.6 test/core_ext_date_test.rb
hiccup-0.5.5 test/core_ext_date_test.rb
hiccup-0.5.4 test/core_ext_date_test.rb
hiccup-0.5.3 test/core_ext_date_test.rb
hiccup-0.5.2 test/core_ext_date_test.rb
hiccup-0.5.1 test/core_ext_date_test.rb
hiccup-0.5.0 test/core_ext_date_test.rb
hiccup-0.4.5 test/core_ext_date_test.rb
hiccup-0.4.4 test/core_ext_date_test.rb
hiccup-0.4.3 test/core_ext_date_test.rb
hiccup-0.4.2 test/core_ext_date_test.rb
hiccup-0.4.1 test/core_ext_date_test.rb