strong_json 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec2fc74653b07371d8619d7d830ede16d86e277f
4
- data.tar.gz: 07b28f98c1d24ec5136bf77b86e66cb77fd2e103
3
+ metadata.gz: d8c22cee2e96c616585aab8e4c116daa4e64944a
4
+ data.tar.gz: 0b52394883010d69ffa7cfc65107f2b7bd381987
5
5
  SHA512:
6
- metadata.gz: f5a0c16aa825b4d59c7cccb177ad349117dd3a441546a88b7e30f851fed3cb30ed67d46fae6afd45def233082441e73e8495a7ed57f13747884131e3097313c9
7
- data.tar.gz: debfe3a79493d228f22970b022aae0f2d73acc9800f0be93356a18d6cfa85f4de40302d89b7c7ce1e83844a326d589856233e4d88bcc0715775d51a15b3f64dd
6
+ metadata.gz: 553c80f3d3c1941cf154b852662cbc462b523e77e11a2d49c12d98847ec412bf17a200c3756bb31f165c3e1c84759a278e4e65de90bff9f0db1998c693796561
7
+ data.tar.gz: 55fcd6bbb18191de401fc6aa9d29b23d0c0a07a5d217aebe3db7b477959602d22ae7670f744ae75c686b1ac3eaf25168c957caefc58ad08fcd4ea2f0ce4182da
@@ -22,7 +22,7 @@ class StrongJSON
22
22
  when :boolean
23
23
  value == true || value == false
24
24
  when :numeric
25
- value.is_a?(Numeric) || value.is_a?(String) && /\A[\d.]+\Z/ =~ value
25
+ value.is_a?(Numeric) || value.is_a?(String) && /\A[\-\+]?[\d.]+\Z/ =~ value
26
26
  else
27
27
  false
28
28
  end
@@ -1,3 +1,3 @@
1
1
  class StrongJSON
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -73,6 +73,18 @@ describe StrongJSON::Type::Base do
73
73
  expect(type.test("123")).to be_truthy
74
74
  end
75
75
 
76
+ it "accepts negative number" do
77
+ expect(type.test("-123")).to be_truthy
78
+ end
79
+
80
+ it "accepts number with plus sign" do
81
+ expect(type.test("+123")).to be_truthy
82
+ end
83
+
84
+ it "accepts decimal number" do
85
+ expect(type.test("0.3")).to be_truthy
86
+ end
87
+
76
88
  it "rejects non numeric format string" do
77
89
  expect(type.test("test")).to be_falsey
78
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strong_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-26 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.2.2
99
+ rubygems_version: 2.4.5
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Type check JSON objects