summaryrefslogtreecommitdiff
path: root/spec/ruby/library/date/constants_spec.rb
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 20:18:52 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 20:18:52 +0000
commit1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch)
treea3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/ruby/library/date/constants_spec.rb
parent75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff)
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory. [Misc #13792] [ruby-core:82287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/date/constants_spec.rb')
-rw-r--r--spec/ruby/library/date/constants_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/ruby/library/date/constants_spec.rb b/spec/ruby/library/date/constants_spec.rb
new file mode 100644
index 0000000000..8e564fe665
--- /dev/null
+++ b/spec/ruby/library/date/constants_spec.rb
@@ -0,0 +1,44 @@
+require 'date'
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "Date constants" do
+
+ it "defines JULIAN" do
+ (Date::JULIAN <=> Date::Infinity.new).should == 0
+ end
+
+ it "defines GREGORIAN" do
+ (Date::GREGORIAN <=> -Date::Infinity.new).should == 0
+ end
+
+ it "defines ITALY" do
+ Date::ITALY.should == 2299161 # 1582-10-15
+ end
+
+ it "defines ENGLAND" do
+ Date::ENGLAND.should == 2361222 # 1752-09-14
+ end
+
+ it "defines MONTHNAMES" do
+ Date::MONTHNAMES.should == [nil] + %w(January February March April May June July
+ August September October November December)
+ end
+
+ it "defines DAYNAMES" do
+ Date::DAYNAMES.should == %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
+ end
+
+ it "defines ABBR_MONTHNAMES" do
+ Date::ABBR_DAYNAMES.should == %w(Sun Mon Tue Wed Thu Fri Sat)
+ end
+
+ it "freezes MONTHNAMES, DAYNAMES, ABBR_MONTHNAMES, ABBR_DAYSNAMES" do
+ [Date::MONTHNAMES, Date::DAYNAMES, Date::ABBR_MONTHNAMES, Date::ABBR_DAYNAMES].each do |ary|
+ lambda { ary << "Unknown" }.should raise_error
+ ary.compact.each do |name|
+ lambda { name << "modified" }.should raise_error
+ end
+ end
+ end
+
+end