spec/mongoid/extensions/string_spec.rb in mongoid-6.4.8 vs spec/mongoid/extensions/string_spec.rb in mongoid-7.0.0.beta
- old
+ new
@@ -275,80 +275,52 @@
describe "#numeric?" do
context "when the string is an integer" do
it "returns true" do
- expect("1234".numeric?).to eq(true)
+ expect("1234").to be_numeric
end
end
context "when string is a float" do
it "returns true" do
- expect("1234.123".numeric?).to eq(true)
+ expect("1234.123").to be_numeric
end
end
context "when the string is has exponents" do
it "returns true" do
- expect("1234.123123E4".numeric?).to eq(true)
+ expect("1234.123123E4").to be_numeric
end
end
context "when the string is non numeric" do
it "returns false" do
- expect("blah".numeric?).to eq(false)
+ expect("blah").to_not be_numeric
end
end
context "when the string is NaN" do
it "returns true" do
- expect("NaN".numeric?).to eq(true)
+ expect("NaN").to be_numeric
end
end
- context "when the string is NaN and junk in front" do
-
- it "returns false" do
- expect("a\nNaN".numeric?).to eq(false)
- end
- end
-
- context "when the string is NaN and whitespace at end" do
-
- it "returns false" do
- expect("NaN\n".numeric?).to eq(false)
- end
- end
-
context "when the string is Infinity" do
it "returns true" do
- expect("Infinity".numeric?).to eq(true)
+ expect("Infinity").to be_numeric
end
end
- context "when the string contains Infinity and junk in front" do
-
- it "returns false" do
- expect("a\nInfinity".numeric?).to eq(false)
- end
- end
-
- context "when the string contains Infinity and whitespace at end" do
-
- it "returns false" do
- expect("Infinity\n".numeric?).to eq(false)
- end
- end
-
context "when the string is -Infinity" do
it "returns true" do
- expect("-Infinity".numeric?).to eq(true)
+ expect("-Infinity").to be_numeric
end
end
end
describe "#singularize" do