ruport 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/CHANGELOG +45 -0
- data/README +32 -13
- data/Rakefile +48 -51
- data/TODO +36 -23
- data/bin/ruport +75 -57
- data/lib/ruport/db/data_row.rb +64 -0
- data/lib/ruport/db/data_set.rb +101 -0
- data/lib/ruport/db/mailer.rb +42 -0
- data/lib/ruport/db/mock_db.rb +49 -0
- data/lib/ruport/db/mock_report.rb +44 -0
- data/lib/ruport/db/report.rb +212 -0
- data/lib/ruport/db/sql.rb +93 -0
- data/lib/ruport/format/chart.rb +1 -0
- data/lib/ruportlib.rb +7 -0
- data/test/tc_data_row.rb +53 -0
- data/test/tc_data_set.rb +67 -0
- data/test/tc_report.rb +104 -0
- data/test/ts_all.rb +4 -0
- metadata +20 -20
- data/bin/ruport.rb +0 -4
- data/lib/mailer.rb +0 -44
- data/lib/query.rb +0 -140
- data/lib/sql.rb +0 -93
- data/setup.rb +0 -1360
- data/tests/tc_ruport.rb +0 -69
data/tests/tc_ruport.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
#tc_ruport.rb
|
2
|
-
#
|
3
|
-
# Created by Gregory Thomas Brown on 2005-08-09
|
4
|
-
# Copyright 2005 (Gregory Brown) All rights reserved.
|
5
|
-
|
6
|
-
require "test/unit"
|
7
|
-
require "lib/query"
|
8
|
-
class TestRuport < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def setup
|
11
|
-
config = YAML.load(File.open("config/ruport.yaml"))
|
12
|
-
@query = Query.new("#{config[:driver]}:#{config[:database]}",
|
13
|
-
config[:db_user], config[:db_password])
|
14
|
-
@query.query_table = config[:query_table]
|
15
|
-
@month_days = [6,7,8,9]
|
16
|
-
@low_tide1 = ['05:11:00 am', '05:50:00 am',
|
17
|
-
'06:29:00 am', '07:08:00 am']
|
18
|
-
@low_tide2 = ['05:22:00 pm', '06:06:00 pm',
|
19
|
-
'06:50:00 pm', '07:37:00 pm']
|
20
|
-
@high_tide1 = ['11:01:00 am', '11:38:00 am',
|
21
|
-
'12:15:00 pm', '12:22:00 am']
|
22
|
-
@high_tide2 = ['11:06:00 pm', '11:43:00 pm',
|
23
|
-
'', '12:51:00 pm']
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_sql
|
27
|
-
@query.select("* FROM ruport_test WHERE day_of_month > 5 and
|
28
|
-
day_of_month < 10 ") do |row|
|
29
|
-
assert_equal(@low_tide1.shift, row["low_tide1"].to_s)
|
30
|
-
assert_equal(@low_tide2.shift, row["low_tide2"].to_s)
|
31
|
-
assert_equal(@high_tide1.shift, row["high_tide1"].to_s)
|
32
|
-
assert_equal(@high_tide2.shift, row["high_tide2"].to_s)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_sql_stored
|
37
|
-
@query.select( "sql_stored_test", :db) do |row|
|
38
|
-
assert_equal(@low_tide1.shift, row["low_tide1"].to_s)
|
39
|
-
assert_equal(@low_tide2.shift, row["low_tide2"].to_s)
|
40
|
-
assert_equal(@high_tide1.shift, row["high_tide1"].to_s)
|
41
|
-
assert_equal(@high_tide2.shift, row["high_tide2"].to_s)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_sql_file
|
46
|
-
@query.select("../tests/test.sql", :file) do |row|
|
47
|
-
assert_equal(@low_tide1.shift, row["low_tide1"].to_s)
|
48
|
-
assert_equal(@low_tide2.shift, row["low_tide2"].to_s)
|
49
|
-
assert_equal(@high_tide1.shift, row["high_tide1"].to_s)
|
50
|
-
assert_equal(@high_tide2.shift, row["high_tide2"].to_s)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_sql_generation
|
55
|
-
sql = @query.fetch do
|
56
|
-
from :ruport_test
|
57
|
-
end
|
58
|
-
assert_equal("SELECT * FROM ruport_test;", sql)
|
59
|
-
sql = @query.fetch do
|
60
|
-
from :ruport_test
|
61
|
-
condition :last_name, :"=", "Brown"
|
62
|
-
order :first_name
|
63
|
-
end
|
64
|
-
assert_equal("SELECT * FROM ruport_test WHERE last_name = 'Brown' " +
|
65
|
-
"ORDER BY first_name;",sql)
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|