Sha256: acfd430cb45e1f4b81f58aa0c6df4f50e6f7ac37a72aa489ae3016af7f6818f4
Contents?: true
Size: 1.56 KB
Versions: 4
Compression:
Stored size: 1.56 KB
Contents
require 'quantify' describe String do describe "applying superscripts" do it "should replace 2s with superscripts" do "kg^2".with_superscript_characters.should eql "kg²" end it "should replace 3s with superscripts" do "kg^3".with_superscript_characters.should eql "kg³" end it "should not replace 4s with superscripts" do "kg^4".with_superscript_characters.should eql "kg^4" end it "should not replace larger numbers starting with 2 with superscripts" do "kg^25".with_superscript_characters.should eql "kg^25" end it "should replace multiple 2s and 3s with superscripts" do "kg^3 m^2 K^2".with_superscript_characters.should eql "kg³ m² K²" end it "should replace multiple 2s and 3s with superscripts except negatives or larger numbers" do "kg^3 bq^-2 m^2 K^2 A^2500".with_superscript_characters.should eql "kg³ bq^-2 m² K² A^2500" end end describe "removing superscripts" do it "should replace superscripts with 2s" do "kg²".without_superscript_characters.should eql "kg^2" end it "should replace superscripts with 3s" do "kg³".without_superscript_characters.should eql "kg^3" end it "should replace multiple superscripts with 2s and 3s" do "kg³ m² K²".without_superscript_characters.should eql "kg^3 m^2 K^2" end it "should replace multiple superscripts with 2s and 3s except negatives or larger numbers" do "kg³ bq^-2 m² K² A^2500".without_superscript_characters.should eql "kg^3 bq^-2 m^2 K^2 A^2500" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
quantify-1.2.2 | spec/string_spec.rb |
quantify-1.2.1 | spec/string_spec.rb |
quantify-1.2.0 | spec/string_spec.rb |
quantify-1.1.0 | spec/string_spec.rb |