summaryrefslogtreecommitdiff
path: root/spec/ruby/library/datetime/strftime_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/datetime/strftime_spec.rb')
-rw-r--r--spec/ruby/library/datetime/strftime_spec.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/spec/ruby/library/datetime/strftime_spec.rb b/spec/ruby/library/datetime/strftime_spec.rb
index 37705788a1..a07cc9c1aa 100644
--- a/spec/ruby/library/datetime/strftime_spec.rb
+++ b/spec/ruby/library/datetime/strftime_spec.rb
@@ -1,16 +1,18 @@
+require_relative '../../spec_helper'
require 'date'
-require File.expand_path('../../../shared/time/strftime_for_date', __FILE__)
-require File.expand_path('../../../shared/time/strftime_for_time', __FILE__)
+require_relative '../../shared/time/strftime_for_date'
+require_relative '../../shared/time/strftime_for_time'
+date_version = defined?(Date::VERSION) ? Date::VERSION : '3.1.0'
describe "DateTime#strftime" do
before :all do
- @new_date = lambda { |y,m,d| DateTime.civil(y,m,d) }
- @new_time = lambda { |*args| DateTime.civil(*args) }
- @new_time_in_zone = lambda { |zone,offset,*args|
+ @new_date = -> y, m, d { DateTime.civil(y,m,d) }
+ @new_time = -> *args { DateTime.civil(*args) }
+ @new_time_in_zone = -> zone, offset, *args {
y, m, d, h, min, s = args
DateTime.new(y, m||1, d||1, h||0, min||0, s||0, Rational(offset, 24))
}
- @new_time_with_offset = lambda { |y,m,d,h,min,s,offset|
+ @new_time_with_offset = -> y, m, d, h, min, s, offset {
DateTime.new(y,m,d,h,min,s, Rational(offset, 86_400))
}
@@ -31,10 +33,9 @@ describe "DateTime#strftime" do
@time.strftime("%Z").should == "+00:00"
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')
+ @time.strftime("%v").should == " 3-FEB-2001"
+ @time.strftime("%v").should != @time.strftime('%e-%b-%Y')
end
# additional conversion specifiers only in Date/DateTime