uk_working_days 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -1,6 +1,7 @@
1
1
  require 'date'
2
2
  require 'active_support/core_ext/date/conversions'
3
- require 'active_support/core_ext/time/calculations'
3
+ require 'active_support/core_ext/date/calculations'
4
+ require 'active_support/core_ext/date/acts_like'
4
5
  require 'active_support/core_ext/numeric/time'
5
6
  require File.dirname(__FILE__) + '/uk_working_days/easter'
6
7
  require File.dirname(__FILE__) + '/uk_working_days/date_extensions'
@@ -23,6 +23,7 @@ module UkWorkingDays
23
23
 
24
24
  # Returns the next (or count'th) working day
25
25
  def next_working_day(count = 1)
26
+ return self if count == 0
26
27
  negative = count < 0
27
28
  count = count.abs
28
29
  date = negative ? yesterday : tomorrow
@@ -45,6 +45,16 @@ class TestUkWorkingDays < Test::Unit::TestCase
45
45
  assert_equal Date.new(2010, 3, 31), Date.new(2010, 4, 1).previous_working_day
46
46
  assert_equal Time.local(2010, 3, 31), Time.local(2010, 4, 1).previous_working_day
47
47
  end
48
+
49
+ should "return self when passing 0 to #next_working_day or #previous_working_day" do
50
+ date, time = Date.today, Time.now
51
+
52
+ assert_equal date, date.next_working_day(0)
53
+ assert_equal time, time.next_working_day(0)
54
+
55
+ assert_equal date, date.previous_working_day(0)
56
+ assert_equal time, time.previous_working_day(0)
57
+ end
48
58
 
49
59
  context "Date#new_years_day_holiday" do
50
60
  should "return new year's day if it is a weekday" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uk_working_days
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roland Swingler
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-17 00:00:00 +00:00
19
- default_executable:
18
+ date: 2011-11-16 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: activesupport
@@ -57,7 +56,6 @@ extra_rdoc_files:
57
56
  - README.rdoc
58
57
  files:
59
58
  - .document
60
- - .gitignore
61
59
  - LICENSE
62
60
  - README.rdoc
63
61
  - Rakefile
@@ -68,13 +66,12 @@ files:
68
66
  - test/helper.rb
69
67
  - test/test_easter.rb
70
68
  - test/test_uk_working_days.rb
71
- has_rdoc: true
72
69
  homepage: http://github.com/knaveofdiamonds/uk_working_days
73
70
  licenses: []
74
71
 
75
72
  post_install_message:
76
- rdoc_options:
77
- - --charset=UTF-8
73
+ rdoc_options: []
74
+
78
75
  require_paths:
79
76
  - lib
80
77
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -98,11 +95,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
95
  requirements: []
99
96
 
100
97
  rubyforge_project:
101
- rubygems_version: 1.3.7
98
+ rubygems_version: 1.8.6
102
99
  signing_key:
103
100
  specification_version: 3
104
101
  summary: Provide date helpers for UK working days
105
- test_files:
106
- - test/helper.rb
107
- - test/test_easter.rb
108
- - test/test_uk_working_days.rb
102
+ test_files: []
103
+
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC