diff options
Diffstat (limited to 'spec/ruby/library/datetime')
-rw-r--r-- | spec/ruby/library/datetime/add_spec.rb | 9 | ||||
-rw-r--r-- | spec/ruby/library/datetime/subtract_spec.rb | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/ruby/library/datetime/add_spec.rb b/spec/ruby/library/datetime/add_spec.rb new file mode 100644 index 0000000000..a6d98914bd --- /dev/null +++ b/spec/ruby/library/datetime/add_spec.rb @@ -0,0 +1,9 @@ +require_relative '../../spec_helper' +require 'date' + +describe "DateTime#+" do + it "is able to add sub-millisecond precision values" do + datetime = DateTime.new(2017) + (datetime + 0.00001).to_time.usec.should == 864000 + end +end diff --git a/spec/ruby/library/datetime/subtract_spec.rb b/spec/ruby/library/datetime/subtract_spec.rb new file mode 100644 index 0000000000..ed88533246 --- /dev/null +++ b/spec/ruby/library/datetime/subtract_spec.rb @@ -0,0 +1,9 @@ +require_relative '../../spec_helper' +require 'date' + +describe "DateTime#-" do + it "is able to subtract sub-millisecond precision values" do + date = DateTime.new(2017) + ((date + 0.00001) - date).should == Rational(1, 100000) + end +end |