activerecord-metal 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,3 +3,13 @@ module ActiveRecord::Metal::Postgresql::Aggregate
|
|
3
3
|
ask "SELECT COUNT(*) FROM #{table_name}"
|
4
4
|
end
|
5
5
|
end
|
6
|
+
|
7
|
+
module ActiveRecord::Metal::Postgresql::Aggregate::Etest
|
8
|
+
def test_count
|
9
|
+
metal.ask "DELETE FROM alloys"
|
10
|
+
expect! metal.count("alloys") => 0
|
11
|
+
metal.import "alloys", [[1,1], [2,2]], :columns => [ "id", "num"]
|
12
|
+
expect! metal.count("alloys") => 2
|
13
|
+
metal.ask "DELETE FROM alloys"
|
14
|
+
end
|
15
|
+
end
|
@@ -76,4 +76,22 @@ module ActiveRecord::Metal::Postgresql::Etest
|
|
76
76
|
import_performance(100)
|
77
77
|
import_performance(10000)
|
78
78
|
end
|
79
|
+
|
80
|
+
def test_timestamp(mode = "with time zone")
|
81
|
+
metal.ask "DROP TABLE IF EXISTS timetable"
|
82
|
+
metal.ask "CREATE TABLE IF NOT EXISTS timetable (name varchar, created_at timestamp #{mode})"
|
83
|
+
|
84
|
+
now = Time.at(Time.now.to_i)
|
85
|
+
back = Time.parse("2010-10-01 12:00:00")
|
86
|
+
|
87
|
+
metal.ask "INSERT INTO timetable VALUES($1, $2)", "now", now
|
88
|
+
metal.ask "INSERT INTO timetable VALUES($1, $2)", "back", back
|
89
|
+
|
90
|
+
expect! metal.ask("SELECT created_at FROM timetable WHERE name=$1", "now") => now
|
91
|
+
expect! metal.ask("SELECT created_at FROM timetable WHERE name=$1", "back") => back
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_timestamp_without_tz
|
95
|
+
test_timestamp "without time zone"
|
96
|
+
end
|
79
97
|
end
|
data/test/pg_test.rb
CHANGED
@@ -13,4 +13,6 @@ class PostgresTest < Test::Unit::TestCase
|
|
13
13
|
include ActiveRecord::Metal::Postgresql::Conversions::Etest
|
14
14
|
include ActiveRecord::Metal::Postgresql::Queries::Etest
|
15
15
|
include ActiveRecord::Metal::Postgresql::Exec::Etest
|
16
|
+
include ActiveRecord::Metal::Postgresql::PreparedQueries::Etest
|
17
|
+
include ActiveRecord::Metal::Postgresql::Aggregate::Etest
|
16
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-metal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -16,18 +16,18 @@ dependencies:
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '3.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
description:
|
29
|
+
version: '3.2'
|
30
|
+
description: Sometimes you just need SQL.
|
31
31
|
email: eno@radiospiel.org
|
32
32
|
executables: []
|
33
33
|
extensions: []
|
@@ -64,7 +64,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
segments:
|
66
66
|
- 0
|
67
|
-
hash:
|
67
|
+
hash: 1704688507352734289
|
68
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
70
70
|
requirements:
|
@@ -76,5 +76,5 @@ rubyforge_project:
|
|
76
76
|
rubygems_version: 1.8.25
|
77
77
|
signing_key:
|
78
78
|
specification_version: 3
|
79
|
-
summary:
|
79
|
+
summary: Sometimes you just need SQL.
|
80
80
|
test_files: []
|