populate-me 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@
4
4
 
5
5
  Integer.class_eval do
6
6
  def to_price_string
7
- ("%.2f" % (self/100.0)).sub(/\.00/, '')
7
+ ("%.2f" % (self/100.0)).sub(/\.00/, '').reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
8
8
  end
9
9
  end
10
10
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'populate-me'
3
- s.version = "0.0.15"
3
+ s.version = "0.0.16"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "ALPHA !!! Populate Me is relatively complete but simple CMS"
6
6
  s.description = "ALPHA !!! Populate Me is relatively complete but simple CMS. It includes a Rack middleware for putting in your Rack stack, and a bespoke MongoDB ODM. But Populate Me is not really finished yet."
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+ Encoding.default_internal = Encoding.default_external = Encoding::UTF_8 if RUBY_VERSION >= '1.9.0'
3
+
4
+ require 'rubygems'
5
+ require 'bacon'
6
+ $:.unshift './lib'
7
+ require "populate_me/ext"
8
+
9
+ describe 'Integer' do
10
+ describe '#to_price_string' do
11
+ should 'Display numbers correctly' do
12
+ 4595.to_price_string.should=='45.95'
13
+ 7000.to_price_string.should=='70'
14
+ 1234567890.to_price_string.should=='12,345,678.90'
15
+ -140000.to_price_string.should=='-1,400'
16
+ end
17
+ end
18
+ end
19
+
20
+ describe 'String' do
21
+ describe '#to_price_integer' do
22
+ should 'Parse numbers correctly' do
23
+ '28'.to_price_integer.should==2800
24
+ '45.95'.to_price_integer.should==4595
25
+ ' £-12,345,678.90 '.to_price_integer.should==-1234567890
26
+ end
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: populate-me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-29 00:00:00.000000000 Z
12
+ date: 2013-09-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack-golem
@@ -95,6 +95,7 @@ files:
95
95
  - lib/populate_me/mongo/plug.rb
96
96
  - lib/populate_me/mongo/stash.rb
97
97
  - populate-me.gemspec
98
+ - test/spec_ext.rb
98
99
  - test/spec_mongo_mutation.rb
99
100
  homepage: https://github.com/mig-hub/populate-me
100
101
  licenses: []