summaryrefslogtreecommitdiff
path: root/spec/ruby/library
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-09-28 19:14:02 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-09-28 19:14:02 +0900
commit395da04aa6d2c8043b82b257a76aecba48dac755 (patch)
tree5a1de7f89f796724c5b3fb6719836e1ec0cf6c09 /spec/ruby/library
parentbe51f4ce839c8a008178a1d757e7541922a00f7a (diff)
Followed up ruby/spec examples for date.
https://github.com/ruby/ruby/commit/f9f7f3a75ec5af4a70e3332f8f5aa300c13432e2
Diffstat (limited to 'spec/ruby/library')
-rw-r--r--spec/ruby/library/date/strftime_spec.rb15
-rw-r--r--spec/ruby/library/datetime/strftime_spec.rb15
2 files changed, 24 insertions, 6 deletions
diff --git a/spec/ruby/library/date/strftime_spec.rb b/spec/ruby/library/date/strftime_spec.rb
index 9d298e42e6..8b1ebe061c 100644
--- a/spec/ruby/library/date/strftime_spec.rb
+++ b/spec/ruby/library/date/strftime_spec.rb
@@ -22,9 +22,18 @@ describe "Date#strftime" do
end
# %v is %e-%b-%Y for Date/DateTime
- it "should be able to show the commercial week" do
- @date.strftime("%v").should == " 9-Apr-2000"
- @date.strftime("%v").should == @date.strftime('%e-%b-%Y')
+ ruby_version_is ""..."3.1" do
+ it "should be able to show the commercial week" do
+ @date.strftime("%v").should == " 9-Apr-2000"
+ @date.strftime("%v").should == @date.strftime('%e-%b-%Y')
+ end
+ end
+
+ ruby_version_is "3.1" do
+ it "should be able to show the commercial week" do
+ @date.strftime("%v").should == " 9-APR-2000"
+ @date.strftime("%v").should != @date.strftime('%e-%b-%Y')
+ end
end
# additional conversion specifiers only in Date/DateTime
diff --git a/spec/ruby/library/datetime/strftime_spec.rb b/spec/ruby/library/datetime/strftime_spec.rb
index cf07bbf9de..725bcafb0d 100644
--- a/spec/ruby/library/datetime/strftime_spec.rb
+++ b/spec/ruby/library/datetime/strftime_spec.rb
@@ -33,9 +33,18 @@ describe "DateTime#strftime" do
end
# %v is %e-%b-%Y for Date/DateTime
- it "should be able to show the commercial week" do
- @time.strftime("%v").should == " 3-Feb-2001"
- @time.strftime("%v").should == @time.strftime('%e-%b-%Y')
+ ruby_version_is ""..."3.1" do
+ it "should be able to show the commercial week" do
+ @time.strftime("%v").should == " 3-Feb-2001"
+ @time.strftime("%v").should == @time.strftime('%e-%b-%Y')
+ end
+ end
+
+ ruby_version_is "3.1" do
+ it "should be able to show the commercial week" do
+ @time.strftime("%v").should == " 3-FEB-2001"
+ @time.strftime("%v").should != @time.strftime('%e-%b-%Y')
+ end
end
# additional conversion specifiers only in Date/DateTime