activerecord-time 0.1.0 → 0.2.0

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: 9191c5f543363446595ac56995e20183695cc689
4
- data.tar.gz: 2a9480f6e1ef46a9df53ecb51b1d09f7cb7531c3
3
+ metadata.gz: 9726749c08e7f21a192df63e9969d9ac2e6b6ed9
4
+ data.tar.gz: a6ea5592bc0fdfc1988468ed78f97e9546dffa73
5
5
  SHA512:
6
- metadata.gz: b8190c77ed345a716ca0f9426d1f3d6b57488c9c757a6e5d3ffa966f4cc41f6c9a56de71b36a2c5aa9f09d50bf9a2cb9c9a902a1d6c45d5981420382aa721299
7
- data.tar.gz: 6fad7c2cc20029685ad15ff4fccfdb8e490fe6c63ec65a7223bd7aa4630a7b3948f6ecef0a0fc2514ebe12b104c50542119e985371765f9b14b32f59765993f0
6
+ metadata.gz: cd921d9c1954b63dc1d885ed2eb526ac2317879ba530425423f574fe341d5d3232b5cf50723c9860d125a0651487b10632f3d3526ef172830767c2a21c10296a
7
+ data.tar.gz: efb1a223cb7bbc0cb1b4cdfb07f363f7de4faa7af412e7fdaf6990f3091b6c38c732c9fcd7ce9b5117b50f037af1e862cc82cfe1116716826ac81c9114729f8b
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module Time
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
data/lib/time_of_day.rb CHANGED
@@ -7,7 +7,7 @@ class TimeOfDay
7
7
  attr_accessor :minute # 0 - 59
8
8
  attr_accessor :second # 0 - 59
9
9
 
10
- def initialize(hour, minute, second = 0)
10
+ def initialize(hour, minute = 0, second = 0)
11
11
  raise "Invalid hour: #{hour}" unless hour >= 0 && hour <= 23
12
12
  raise "Invalid minute: #{minute}" unless minute >= 0 && minute <= 59
13
13
  raise "Invalid second: #{second}" unless second >= 0 && hour <= 59
data/test/database.yml CHANGED
@@ -2,7 +2,7 @@ sqlite:
2
2
  :adapter: sqlite
3
3
  :dbfile: plugin.sqlite.db
4
4
  sqlite3:
5
- :adapter: jdbcsqlite3
5
+ :adapter: sqlite3
6
6
  :dbfile: ":memory:"
7
7
  postgresql:
8
8
  :adapter: postgresql
metadata CHANGED
@@ -1,30 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-30 00:00:00.000000000 Z
11
+ date: 2013-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-jdbcsqlite3-adapter
15
- version_requirements: !ruby/object:Gem::Requirement
15
+ requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- requirement: !ruby/object:Gem::Requirement
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
21
23
  requirements:
22
24
  - - '>='
23
25
  - !ruby/object:Gem::Version
24
26
  version: '0'
25
- prerelease: false
26
- type: :development
27
- description: A handler for storing TimeOfDay objects in ActiveRecord objects as sql time values.
27
+ description: A handler for storing TimeOfDay objects in ActiveRecord objects as sql
28
+ time values.
28
29
  email:
29
30
  - uwe@kubosch.no
30
31
  executables: []
@@ -42,14 +43,13 @@ files:
42
43
  - lib/activerecord-time/version.rb
43
44
  - lib/time_of_day.rb
44
45
  - test/database.yml
45
- - test/rails_time_test.rb
46
46
  - test/schema.rb
47
47
  - test/test_helper.rb
48
48
  - test/time_of_day_test.rb
49
49
  homepage: https://github.com/donv/activerecord-time
50
50
  licenses: []
51
51
  metadata: {}
52
- post_install_message:
52
+ post_install_message:
53
53
  rdoc_options: []
54
54
  require_paths:
55
55
  - lib
@@ -64,14 +64,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  requirements: []
67
- rubyforge_project:
68
- rubygems_version: 2.1.9
69
- signing_key:
67
+ rubyforge_project:
68
+ rubygems_version: 2.0.6
69
+ signing_key:
70
70
  specification_version: 4
71
- summary: A handler for storing TimeOfDay objects in ActiveRecord objects as sql time values.
71
+ summary: A handler for storing TimeOfDay objects in ActiveRecord objects as sql time
72
+ values.
72
73
  test_files:
73
74
  - test/database.yml
74
- - test/rails_time_test.rb
75
75
  - test/schema.rb
76
76
  - test/test_helper.rb
77
77
  - test/time_of_day_test.rb
78
+ has_rdoc:
@@ -1,87 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- class Thing < ActiveRecord::Base
4
- end
5
-
6
- def thing
7
- Thing.new(:name => 'Thing One',:price_in_cents=> 125)
8
- end
9
-
10
- class RailsMoneyTest < Test::Unit::TestCase
11
-
12
- def test_should_return_price_as_money_object
13
- price = thing.price
14
- assert_kind_of Money, price
15
- assert_equal "$1.25", thing.price.to_s
16
- end
17
-
18
- def test_should_set_price_from_money_object
19
- thing1 = thing
20
- thing1.price = Money.new(1095)
21
- assert_equal 109500, thing1.price_in_cents
22
- assert_equal "$1,095.00", thing1.price.to_s
23
- end
24
-
25
- def test_should_set_price_from_fixnum
26
- thing1 = thing
27
- thing1.price = 1095
28
- assert_equal 109500, thing1.price_in_cents
29
- end
30
-
31
- def test_should_set_price_from_float
32
- thing1 = thing
33
- thing1.price = 10.95
34
- assert_equal 1095, thing1.price_in_cents
35
- end
36
-
37
- def test_should_set_price_from_string
38
- thing1 = thing
39
- thing1.price = "$10.95"
40
- assert_equal 1095, thing1.price_in_cents
41
- thing1.price = "10"
42
- assert_equal 1000, thing1.price_in_cents
43
- end
44
-
45
- def test_should_format_correctly
46
- assert_equal "$12.40", Money.new(12.40).to_s
47
- end
48
-
49
- def test_should_raise_exception_setting_invalid_price
50
- assert_raise(MoneyError) { thing.price = [] }
51
- end
52
- end
53
-
54
- class MoneyTest < Test::Unit::TestCase
55
-
56
- def test_should_create_money_object
57
- assert cash_money = Money.new(1290)
58
- assert_equal 129000, cash_money.cents
59
- assert_equal 1290, cash_money.dollars
60
- assert_equal "$1,290.00", cash_money.to_s
61
- assert_equal false, cash_money.free?
62
- assert_equal 0, Money.new(nil).cents
63
- end
64
-
65
- def test_should_create_money_object_from_float_with_proper_rounding
66
- money = Money.new(12.196)
67
- assert_equal 1220, money.cents
68
- assert_instance_of Fixnum, money.cents
69
- end
70
-
71
- def test_should_raise_exception_if_invalid_type_passed_to_initialize
72
- assert_raise(MoneyError) { Money.new([]) }
73
- end
74
-
75
- def test_should_return_free_on_to_s_if_cents_is_zero
76
- cash_money = Money.new(0)
77
- assert_equal 'free', cash_money.to_s
78
- assert_equal true, cash_money.free?
79
- assert_equal true, cash_money.zero?
80
- end
81
-
82
- def test_should_be_comparable
83
- assert Money.include?(Comparable)
84
- assert Money.new(0) == Money.new(0)
85
- end
86
-
87
- end