has_money_fields 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ # - jruby-18mode # JRuby in 1.8 mode
7
+ # - jruby-19mode # JRuby in 1.9 mode
8
+ # - rbx-18mode
9
+ # - rbx-19mode
10
+ # uncomment this line if your project needs to run something other than `rake`:
11
+ script: bundle exec rspec spec
data/History.md CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ 0.0.4 / 2012-05-17
3
+ ==================
4
+
5
+ * Fix error when using a Fixnum as argument
6
+
2
7
  0.0.3 / 2012-05-17
3
8
  ==================
4
9
 
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://secure.travis-ci.org/Zorros/has_money_fields.png?branch=master)](http://travis-ci.org/Zorros/has_money_fields)
2
+
1
3
  # Introduction
2
4
 
3
5
  `has_money_fields` is a try to DRY the following code from the Money gem
@@ -26,7 +26,6 @@ currency data in a safe and clean way.
26
26
  s.add_dependency "money"
27
27
  s.add_development_dependency "sqlite3"
28
28
  s.add_development_dependency "rspec", "~> 2"
29
- s.add_development_dependency "ruby-debug19"
30
29
  s.add_development_dependency "guard"
31
30
  s.add_development_dependency "guard-rspec"
32
31
  end
@@ -11,7 +11,7 @@ module HasMoneyFields
11
11
  args.each do |attr|
12
12
  converter = Proc.new do |value|
13
13
  # remove all non digit and period characters from the price
14
- value.gsub! /[^\.|\d]/, ""
14
+ value.gsub! /[^\.|\d]/, "" if value.instance_of? String
15
15
  if value.respond_to? :to_money
16
16
  value.to_money
17
17
  else
@@ -1,3 +1,3 @@
1
1
  module HasMoneyFields
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -49,6 +49,15 @@ describe "Model with money fields" do
49
49
  its(:currency_price){ should == "USD" }
50
50
  end
51
51
 
52
+ context "with number only prices" do
53
+ before do
54
+ @product = Product.create! :price => 1000
55
+ end
56
+ subject {@product}
57
+
58
+ its(:money_price){ should == 100000 }
59
+ end
60
+
52
61
  context "with validations" do
53
62
  before do
54
63
  Product.class_eval do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_money_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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: 2012-05-17 00:00:00.000000000 Z
12
+ date: 2012-05-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -75,22 +75,6 @@ dependencies:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
77
  version: '2'
78
- - !ruby/object:Gem::Dependency
79
- name: ruby-debug19
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
78
  - !ruby/object:Gem::Dependency
95
79
  name: guard
96
80
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +120,7 @@ extensions: []
136
120
  extra_rdoc_files: []
137
121
  files:
138
122
  - .gitignore
123
+ - .travis.yml
139
124
  - Gemfile
140
125
  - Guardfile
141
126
  - History.md