date_ext 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.1.0
data/date_ext.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{date_ext}
8
- s.version = "0.0.6"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["hasclass"]
data/lib/quarter.rb CHANGED
@@ -32,8 +32,8 @@ class Quarter
32
32
 
33
33
  def months; (first_month..last_month).to_a; end
34
34
 
35
- def first_month; Month.new(@year,@quarter); end
36
- def last_month; Month.new(@year,@quarter+2); end
35
+ def first_month; Month.new(@year,((@quarter - 1)*3)+1); end
36
+ def last_month; Month.new(@year,((@quarter - 1)*3)+3); end
37
37
 
38
38
  def dates; (first_date..last_date).to_a; end
39
39
 
data/test/quarter_test.rb CHANGED
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
3
  class QuarterTest < Test::Unit::TestCase
4
4
 
5
- context "Quarter 2009" do
5
+ context "Quarter 2009,1" do
6
6
  setup {
7
7
  @quarter = Quarter.new(2009,1)
8
8
  }
@@ -25,6 +25,18 @@ class QuarterTest < Test::Unit::TestCase
25
25
  assert_equal Date.new(2009,3,31), @quarter.last_weekday
26
26
  end
27
27
  end
28
+
29
+ context "Quarter 2009,1" do
30
+ setup {
31
+ @quarter = Quarter.new(2009,4)
32
+ }
33
+ should "have 2009-10 as first_month" do
34
+ assert_equal Month.new(2009,10), @quarter.first_month
35
+ end
36
+ should "have 2009-12 as last_month" do
37
+ assert_equal Month.new(2009,12), @quarter.last_month
38
+ end
39
+ end
28
40
 
29
41
  context "#new" do
30
42
  should "accept year and quarter as string" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: date_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hasclass