summaryrefslogtreecommitdiff
path: root/spec/ruby/library/date
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-28 09:19:59 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-28 09:19:59 +0000
commit52d2636f3e7658f76136310359c2ba00e613d2bd (patch)
tree523a193924876ba20fe00debc3f45765fb21bd79 /spec/ruby/library/date
parentc555bd7f01c531af8d33ed494b278a765381afd9 (diff)
Update to ruby/spec@691755d
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/date')
-rw-r--r--spec/ruby/library/date/day_spec.rb5
-rw-r--r--spec/ruby/library/date/month_spec.rb5
-rw-r--r--spec/ruby/library/date/next_month_spec.rb14
-rw-r--r--spec/ruby/library/date/prev_day_spec.rb14
-rw-r--r--spec/ruby/library/date/prev_month_spec.rb14
-rw-r--r--spec/ruby/library/date/year_spec.rb5
6 files changed, 54 insertions, 3 deletions
diff --git a/spec/ruby/library/date/day_spec.rb b/spec/ruby/library/date/day_spec.rb
index 7dfca4d77c..d3561d802d 100644
--- a/spec/ruby/library/date/day_spec.rb
+++ b/spec/ruby/library/date/day_spec.rb
@@ -2,5 +2,8 @@ require File.expand_path('../../../spec_helper', __FILE__)
require 'date'
describe "Date#day" do
- it "needs to be reviewed for spec completeness"
+ it "returns the day" do
+ d = Date.new(2000, 7, 1).day
+ d.should == 1
+ end
end
diff --git a/spec/ruby/library/date/month_spec.rb b/spec/ruby/library/date/month_spec.rb
index 7a98f572b6..ea35430d6b 100644
--- a/spec/ruby/library/date/month_spec.rb
+++ b/spec/ruby/library/date/month_spec.rb
@@ -2,5 +2,8 @@ require File.expand_path('../../../spec_helper', __FILE__)
require 'date'
describe "Date#month" do
- it "needs to be reviewed for spec completeness"
+ it "returns the month" do
+ m = Date.new(2000, 7, 1).month
+ m.should == 7
+ end
end
diff --git a/spec/ruby/library/date/next_month_spec.rb b/spec/ruby/library/date/next_month_spec.rb
new file mode 100644
index 0000000000..22699a39a5
--- /dev/null
+++ b/spec/ruby/library/date/next_month_spec.rb
@@ -0,0 +1,14 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require 'date'
+
+describe "Date#next_month" do
+ it "returns the next month" do
+ d = Date.new(2000, 7, 1).next_month
+ d.should == Date.new(2000, 8, 1)
+ end
+
+ it "returns three months later" do
+ d = Date.new(2000, 7, 1).next_month(3)
+ d.should == Date.new(2000, 10, 1)
+ end
+end
diff --git a/spec/ruby/library/date/prev_day_spec.rb b/spec/ruby/library/date/prev_day_spec.rb
new file mode 100644
index 0000000000..8a42824154
--- /dev/null
+++ b/spec/ruby/library/date/prev_day_spec.rb
@@ -0,0 +1,14 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require 'date'
+
+describe "Date#prev_day" do
+ it "returns previous day" do
+ d = Date.new(2000, 7, 2).prev_day
+ d.should == Date.new(2000, 7, 1)
+ end
+
+ it "returns three days ago" do
+ d = Date.new(2000, 7, 4).prev_day(3)
+ d.should == Date.new(2000, 7, 1)
+ end
+end
diff --git a/spec/ruby/library/date/prev_month_spec.rb b/spec/ruby/library/date/prev_month_spec.rb
new file mode 100644
index 0000000000..eaf7f67ee0
--- /dev/null
+++ b/spec/ruby/library/date/prev_month_spec.rb
@@ -0,0 +1,14 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require 'date'
+
+describe "Date#prev_month" do
+ it "returns previous month" do
+ d = Date.new(2000, 9, 1).prev_month
+ d.should == Date.new(2000, 8, 1)
+ end
+
+ it "returns three months ago" do
+ d = Date.new(2000, 10, 1).prev_month(3)
+ d.should == Date.new(2000, 7, 1)
+ end
+end
diff --git a/spec/ruby/library/date/year_spec.rb b/spec/ruby/library/date/year_spec.rb
index cca95dbe2a..4720ddcd9a 100644
--- a/spec/ruby/library/date/year_spec.rb
+++ b/spec/ruby/library/date/year_spec.rb
@@ -2,5 +2,8 @@ require File.expand_path('../../../spec_helper', __FILE__)
require 'date'
describe "Date#year" do
- it "needs to be reviewed for spec completeness"
+ it "returns the year" do
+ y = Date.new(2000, 7, 1).year
+ y.should == 2000
+ end
end