acts_as_decimal 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -19,3 +19,4 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
+ *.rbc
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm --create use ruby-1.8.7@acts_as_decimal > /dev/null
1
+ rvm --create use ruby-1.9.2@acts_as_decimal > /dev/null
data/Gemfile CHANGED
@@ -5,7 +5,9 @@ gem "activerecord", "=3.0.0"
5
5
 
6
6
  group :development do
7
7
 
8
- gem "rspec", ">=2.0.0.beta.22"
8
+ gem "rspec", "2.0.0"
9
+ gem "jeweler"
10
+ gem "simplecov"
9
11
  gem "sqlite3-ruby"
10
12
 
11
13
  end
data/Gemfile.lock CHANGED
@@ -15,17 +15,29 @@ GEM
15
15
  activesupport (~> 3.0.0)
16
16
  builder (2.1.2)
17
17
  diff-lcs (1.1.2)
18
+ gemcutter (0.6.1)
19
+ git (1.2.5)
18
20
  i18n (0.4.1)
19
- rspec (2.0.0.beta.22)
20
- rspec-core (= 2.0.0.beta.22)
21
- rspec-expectations (= 2.0.0.beta.22)
22
- rspec-mocks (= 2.0.0.beta.22)
23
- rspec-core (2.0.0.beta.22)
24
- rspec-expectations (2.0.0.beta.22)
21
+ jeweler (1.4.0)
22
+ gemcutter (>= 0.1.0)
23
+ git (>= 1.2.5)
24
+ rubyforge (>= 2.0.0)
25
+ json_pure (1.4.6)
26
+ rspec (2.0.0)
27
+ rspec-core (= 2.0.0)
28
+ rspec-expectations (= 2.0.0)
29
+ rspec-mocks (= 2.0.0)
30
+ rspec-core (2.0.0)
31
+ rspec-expectations (2.0.0)
25
32
  diff-lcs (>= 1.1.2)
26
- rspec-mocks (2.0.0.beta.22)
27
- rspec-core (= 2.0.0.beta.22)
28
- rspec-expectations (= 2.0.0.beta.22)
33
+ rspec-mocks (2.0.0)
34
+ rspec-core (= 2.0.0)
35
+ rspec-expectations (= 2.0.0)
36
+ rubyforge (2.0.4)
37
+ json_pure (>= 1.1.7)
38
+ simplecov (0.3.6)
39
+ simplecov-html (>= 0.3.7)
40
+ simplecov-html (0.3.8)
29
41
  sqlite3-ruby (1.3.1)
30
42
  tzinfo (0.3.23)
31
43
 
@@ -34,5 +46,7 @@ PLATFORMS
34
46
 
35
47
  DEPENDENCIES
36
48
  activerecord (= 3.0.0)
37
- rspec (>= 2.0.0.beta.22)
49
+ jeweler
50
+ rspec (= 2.0.0)
51
+ simplecov
38
52
  sqlite3-ruby
data/README.rdoc CHANGED
@@ -1,6 +1,8 @@
1
1
  = acts_as_decimal
2
2
 
3
- A simple gem for Rails 3 to make an attribute behave like it is floating point, being stored as an integer in the database.
3
+ A simple gem for Rails 3 to make an attribute behave like it is floating point,
4
+ being stored as an integer in the database. Tested with Ruby 1.8, 1.9 and
5
+ Rubinius 1.1.
4
6
 
5
7
  Add it to your Gemfile:
6
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_decimal}
8
- s.version = "1.0.5"
8
+ s.version = "1.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oriol Gual", "Josep M. Bach", "Josep Jaume Rey"]
12
- s.date = %q{2010-09-15}
12
+ s.date = %q{2010-10-14}
13
13
  s.description = %q{Rails 3 gem to treat an attribute as a decimal (getting and setting floating-point values) but storing it as an integer in the database (useful for prices and other precision-needed attributes like money).}
14
14
  s.email = %q{info@codegram.com}
15
15
  s.extra_rdoc_files = [
@@ -1,15 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
- create_table "products" do end
4
-
5
- define_model('Product', :name => :string, :price => :integer)
6
-
7
3
  class Product < ActiveRecord::Base
8
- acts_as_decimal :price, :decimals => 2
9
4
  end
5
+ create_table "products" do end
6
+ define_model('Product', :name => :string, :price => :integer)
10
7
 
11
8
  describe Product do
12
9
 
10
+
13
11
  context "with a price of 10.30" do
14
12
 
15
13
  before(:all) do
@@ -1,41 +1,15 @@
1
1
  # This is based on Remarkable based on Shoulda model builder for Test::Unit.
2
2
  #
3
3
  module ModelBuilder
4
- def self.included(base)
5
- return unless base.name =~ /^Spec/
6
-
7
- base.class_eval do
8
- after(:each) do
9
- if @defined_constants
10
- @defined_constants.each do |class_name|
11
- Object.send(:remove_const, class_name)
12
- end
13
- end
14
-
15
- if @created_tables
16
- @created_tables.each do |table_name|
17
- ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS #{table_name}")
18
- end
19
- end
20
- end
21
- end
22
-
23
- base.extend ClassMethods
24
- end
25
4
 
26
5
  def create_table(table_name, &block)
27
6
  connection = ActiveRecord::Base.connection
28
7
 
29
- begin
30
- connection.execute("DROP TABLE IF EXISTS #{table_name}")
31
- connection.create_table(table_name, &block)
32
- @created_tables ||= []
33
- @created_tables << table_name
34
- connection
35
- rescue Exception => e
36
- connection.execute("DROP TABLE IF EXISTS #{table_name}")
37
- raise e
38
- end
8
+ connection.execute("DROP TABLE IF EXISTS #{table_name}")
9
+ connection.create_table(table_name, &block)
10
+ @created_tables ||= []
11
+ @created_tables << table_name
12
+ connection
39
13
  end
40
14
 
41
15
  def define_constant(class_name, base, &block)
@@ -75,26 +49,4 @@ module ModelBuilder
75
49
  instance
76
50
  end
77
51
 
78
- module ClassMethods
79
- # This is a macro to run validations of boolean optionals such as :allow_nil
80
- # and :allow_blank. This macro tests all scenarios. The specs must have a
81
- # define_and_validate method defined.
82
- #
83
- def create_optional_boolean_specs(optional, base, options={})
84
- base.describe "with #{optional} option" do
85
- it { should define_and_validate(options.merge(optional => true)).send(optional) }
86
- it { should define_and_validate(options.merge(optional => false)).send(optional, false) }
87
- it { should_not define_and_validate(options.merge(optional => true)).send(optional, false) }
88
- it { should_not define_and_validate(options.merge(optional => false)).send(optional) }
89
- end
90
- end
91
-
92
- def create_message_specs(base)
93
- base.describe "with message option" do
94
- it { should define_and_validate(:message => 'valid_message').message('valid_message') }
95
- it { should_not define_and_validate(:message => 'not_valid').message('valid_message') }
96
- end
97
- end
98
- end
99
-
100
- end
52
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,7 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_group "Lib", "lib"
4
+ end
1
5
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
7
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_decimal
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 0
9
- - 5
10
- version: 1.0.5
8
+ - 6
9
+ version: 1.0.6
11
10
  platform: ruby
12
11
  authors:
13
12
  - Oriol Gual
@@ -17,7 +16,7 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2010-09-15 00:00:00 +02:00
19
+ date: 2010-10-14 00:00:00 +02:00
21
20
  default_executable:
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
@@ -28,7 +27,6 @@ dependencies:
28
27
  requirements:
29
28
  - - ">="
30
29
  - !ruby/object:Gem::Version
31
- hash: 7712042
32
30
  segments:
33
31
  - 3
34
32
  - 0
@@ -45,7 +43,6 @@ dependencies:
45
43
  requirements:
46
44
  - - ">="
47
45
  - !ruby/object:Gem::Version
48
- hash: 62196421
49
46
  segments:
50
47
  - 2
51
48
  - 0
@@ -63,7 +60,6 @@ dependencies:
63
60
  requirements:
64
61
  - - ">="
65
62
  - !ruby/object:Gem::Version
66
- hash: 7712042
67
63
  segments:
68
64
  - 3
69
65
  - 0
@@ -113,7 +109,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
109
  requirements:
114
110
  - - ">="
115
111
  - !ruby/object:Gem::Version
116
- hash: 3
117
112
  segments:
118
113
  - 0
119
114
  version: "0"
@@ -122,7 +117,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
117
  requirements:
123
118
  - - ">="
124
119
  - !ruby/object:Gem::Version
125
- hash: 3
126
120
  segments:
127
121
  - 0
128
122
  version: "0"