rquerypad 0.1.11 → 0.1.20
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.
- data/CHANGELOG +37 -1
- data/README +1 -1
- data/Rakefile +53 -10
- data/lib/rquerypad.rb +56 -27
- data/test/fixtures/{replies.yml → forum_replies.yml} +4 -4
- data/test/migrate/002_create_threads.rb +2 -2
- data/test/migrate/003_create_replies.rb +3 -3
- data/test/model.rb +8 -8
- data/test/rquerypad_test.rb +16 -6
- data/test/test_helper.rb +4 -37
- metadata +17 -22
- data/test/db.rquerypad +0 -0
- /data/test/fixtures/{threads.yml → forum_threads.yml} +0 -0
data/CHANGELOG
CHANGED
@@ -1,6 +1,42 @@
|
|
1
|
+
Changes in version 0.1.20 (2009-3-9)
|
2
|
+
------------------------------------
|
3
|
+
Support rails 2.3
|
4
|
+
Changes in version 0.1.19 (2008-11-25)
|
5
|
+
-------------------------------------
|
6
|
+
fix a bug related to wrong table_name in some status
|
7
|
+
|
8
|
+
Changes in version 0.1.18 (2008-07-11)
|
9
|
+
-------------------------------------
|
10
|
+
fix a bug related to ` which occurred in rails 2.1
|
11
|
+
|
12
|
+
Changes in version 0.1.17 (2008-06-16)
|
13
|
+
-------------------------------------
|
14
|
+
fix a bug when use model.exists(id)
|
15
|
+
|
16
|
+
Changes in version 0.1.16 (2008-05-29)
|
17
|
+
-------------------------------------
|
18
|
+
fix a bug related to 'like' and 'in' escape in processing conditions
|
19
|
+
|
20
|
+
Changes in version 0.1.15 (2008-05-21)
|
21
|
+
-------------------------------------
|
22
|
+
fix a bug when conditions is simgle String
|
23
|
+
|
24
|
+
Changes in version 0.1.14 (2008-05-21)
|
25
|
+
-------------------------------------
|
26
|
+
fix a bug due to option key missing model identity
|
27
|
+
|
28
|
+
Changes in version 0.1.13 (2008-05-21)
|
29
|
+
-------------------------------------
|
30
|
+
fix a bug when conditions include symbol as later hash's key
|
31
|
+
|
32
|
+
Changes in version 0.1.12 (2008-05-13)
|
33
|
+
-------------------------------------
|
34
|
+
fix bugs about wrong Marshal call in the method related to construct_calculation_sql
|
35
|
+
|
1
36
|
Changes in version 0.1.11 (2008-04-29)
|
2
37
|
-------------------------------------
|
3
38
|
fix bugs about invalid cache for options
|
39
|
+
|
4
40
|
Changes in version 0.1.10 (2008-03-26)
|
5
41
|
-------------------------------------
|
6
42
|
make alias_method name with 4rqp(for rquerypad) suffix to avoid confliction with the 3rd plugins
|
@@ -45,4 +81,4 @@ support to rails 1.2.6
|
|
45
81
|
|
46
82
|
Changes in version 0.1.0 (2008-03-18)
|
47
83
|
-------------------------------------
|
48
|
-
fix bug about table_name.field as parameter
|
84
|
+
fix bug about table_name.field as parameter
|
data/README
CHANGED
data/Rakefile
CHANGED
@@ -1,32 +1,75 @@
|
|
1
|
+
require 'rake'
|
1
2
|
require 'rubygems'
|
2
3
|
require 'rake/gempackagetask'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/rdoctask'
|
6
|
+
|
3
7
|
PKG_NAME = "rquerypad"
|
4
|
-
PKG_VERSION = "0.1.
|
8
|
+
PKG_VERSION = "0.1.20"
|
5
9
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
6
10
|
PKG_FILES = FileList[
|
7
|
-
'[A-
|
11
|
+
'[A-Z]*',
|
8
12
|
'lib/**/*',
|
9
|
-
'test/**/*',
|
10
13
|
'tasks/**/*',
|
14
|
+
'test/**/*'
|
11
15
|
]
|
12
16
|
spec = Gem::Specification.new do |s|
|
13
17
|
s.platform = Gem::Platform::RUBY
|
14
|
-
s.summary = "Simplify query
|
18
|
+
s.summary = "Simplify query with OO way and improve inner join for ActiveRecord"
|
15
19
|
s.name = PKG_NAME
|
16
20
|
s.version = PKG_VERSION
|
17
|
-
s.requirements << 'none'
|
18
21
|
s.require_path = 'lib'
|
19
|
-
s.
|
20
|
-
|
21
|
-
|
22
|
+
s.homepage = %q{http://rquerypad.rubyforge.org/}
|
23
|
+
s.rubyforge_project = 'Rquerypad'
|
24
|
+
s.has_rdoc = false
|
22
25
|
s.authors = ["Leon Li"]
|
23
26
|
s.email = "scorpio_leon@hotmail.com"
|
24
27
|
s.files = PKG_FILES
|
25
28
|
s.description = <<-EOF
|
26
|
-
Simplify query options with association automation and improve inner join for
|
29
|
+
Simplify query options with association automation and improve inner join for ActiveRecord of rails by providing a compact and OO query language instead of writing some explicit join
|
27
30
|
EOF
|
28
31
|
end
|
29
32
|
Rake::GemPackageTask.new(spec) do |pkg|
|
30
33
|
pkg.need_zip = true
|
31
34
|
pkg.need_tar = true
|
32
|
-
end
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Default: run unit tests.'
|
38
|
+
task :default => :test
|
39
|
+
|
40
|
+
desc 'Test the rquerypad plugin.'
|
41
|
+
Rake::TestTask.new(:test) do |t|
|
42
|
+
t.libs << 'lib'
|
43
|
+
t.pattern = 'test/**/*_test.rb'
|
44
|
+
t.verbose = true
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Generate documentation for the rquerypad plugin.'
|
48
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = 'Rquerypad'
|
51
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
52
|
+
rdoc.rdoc_files.include('README')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'Create the database defined in config/database.yml for the current RAILS_ENV'
|
57
|
+
require 'activerecord'
|
58
|
+
task :migrate do
|
59
|
+
config = {'adapter' => "sqlite3", 'database' => "test/db.rquerypad", 'timeout' => 5000}
|
60
|
+
begin
|
61
|
+
FileUtils.rm_f(File.dirname(__FILE__) + "/" + config['database'])
|
62
|
+
rescue
|
63
|
+
end
|
64
|
+
begin
|
65
|
+
ActiveRecord::Base.establish_connection(config)
|
66
|
+
ActiveRecord::Base.connection
|
67
|
+
rescue
|
68
|
+
`sqlite3 "#{config['database']}"`
|
69
|
+
end
|
70
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/migrate.log")
|
71
|
+
ActiveRecord::Migrator.migrate("test/migrate/")
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
|
data/lib/rquerypad.rb
CHANGED
@@ -3,7 +3,6 @@ author: Leon Li(scorpio_leon@hotmail.com)
|
|
3
3
|
=end
|
4
4
|
require 'md5'
|
5
5
|
class Rquerypad
|
6
|
-
#todo scope support
|
7
6
|
class << self
|
8
7
|
|
9
8
|
def prepare_with_debug
|
@@ -12,6 +11,21 @@ class Rquerypad
|
|
12
11
|
def prepare(debug = $RQUERYPAD_DEBUG)
|
13
12
|
return nil unless @prepared.nil?
|
14
13
|
@prepared = true
|
14
|
+
ActiveRecord::Base.class_eval %{
|
15
|
+
class << self
|
16
|
+
def group_tables(options)
|
17
|
+
group = [options[:group], scope(:find, :group) ].join(", ")
|
18
|
+
return [] unless group && group.is_a?(String)
|
19
|
+
group.scan(/([\.a-zA-Z_]+).?\./).flatten
|
20
|
+
end
|
21
|
+
def include_eager_group?(options, tables = nil)
|
22
|
+
((tables || group_tables(options)) - [table_name]).any?
|
23
|
+
end
|
24
|
+
def references_eager_loaded_tables?(options)
|
25
|
+
include_eager_order?(options) || include_eager_conditions?(options) || include_eager_select?(options) || include_eager_group?(options)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
}
|
15
29
|
ActiveRecord::Base.class_eval %{
|
16
30
|
require "rquerypad"
|
17
31
|
|
@@ -25,7 +39,7 @@ class Rquerypad
|
|
25
39
|
if !options.empty? && (options.include?(:conditions) || options.include?(:group) || options.include?(:order))
|
26
40
|
# if (!options.empty? && (!options[:conditions].nil? || !options[:group].nil? || !options[:order].nil?))
|
27
41
|
#{"p 'original options:', options" if debug}
|
28
|
-
cache_key = Rquerypad.options_key(options)
|
42
|
+
cache_key = Rquerypad.options_key(self, options)
|
29
43
|
#p "cache_key: #\{cache_key\}"
|
30
44
|
#p "rquerypad_cache[cache_key]: #\{rquerypad_cache[cache_key]\}"
|
31
45
|
if rquerypad_cache[cache_key].nil?
|
@@ -63,13 +77,13 @@ class Rquerypad
|
|
63
77
|
def construct_calculation_sql(operation, column_name, options)
|
64
78
|
if !options.empty? && (options.include?(:conditions) || options.include?(:group) || options.include?(:order))
|
65
79
|
#{"p 'original options:', options" if debug}
|
66
|
-
cache_key = Rquerypad.options_key(options)
|
80
|
+
cache_key = Rquerypad.options_key(self, options)
|
67
81
|
if rquerypad_cache[cache_key].nil?
|
68
82
|
#{"p 'process for:', options" if debug}
|
69
83
|
Rquerypad.new(self).improve_options!(options)
|
70
|
-
rquerypad_cache[cache_key] = Marshal.
|
84
|
+
rquerypad_cache[cache_key] = Marshal.dump(options)
|
71
85
|
else
|
72
|
-
options = rquerypad_cache[cache_key]
|
86
|
+
options = Marshal.load(rquerypad_cache[cache_key])
|
73
87
|
end
|
74
88
|
#{"p 'new options:', options" if debug}
|
75
89
|
end
|
@@ -110,8 +124,8 @@ class Rquerypad
|
|
110
124
|
sql
|
111
125
|
end
|
112
126
|
|
113
|
-
def options_key(options)
|
114
|
-
key = options.to_a.to_s
|
127
|
+
def options_key(obj, options)
|
128
|
+
key = obj.to_s + options.to_a.to_s
|
115
129
|
key = MD5.hexdigest(key) if key.length > 100
|
116
130
|
key
|
117
131
|
end
|
@@ -119,7 +133,8 @@ class Rquerypad
|
|
119
133
|
def initialize(obj)
|
120
134
|
@owner = obj
|
121
135
|
@class_name = obj.to_s.scan(/(\w*::)*([^\(]*)/)[0][1]
|
122
|
-
|
136
|
+
#@table_name = @class_name.pluralize.underscore
|
137
|
+
@table_name = obj.table_name
|
123
138
|
@tnwithdot = @table_name + "."
|
124
139
|
@new_include = []
|
125
140
|
@old_include = nil
|
@@ -130,11 +145,12 @@ class Rquerypad
|
|
130
145
|
|
131
146
|
option_hash.each do |key, value|
|
132
147
|
next if value.blank?
|
133
|
-
|
148
|
+
key_str = key.to_s
|
149
|
+
if key_str == "conditions"
|
134
150
|
option_hash[key] = improve_conditions(value)
|
135
|
-
elsif (
|
151
|
+
elsif (key_str == "order" || key_str == "group" || key_str == "group_field")
|
136
152
|
option_hash[key] = improve_ordergroup(value).join(", ")
|
137
|
-
elsif (
|
153
|
+
elsif (key_str == "include")
|
138
154
|
@old_include = value
|
139
155
|
end
|
140
156
|
end
|
@@ -189,17 +205,37 @@ class Rquerypad
|
|
189
205
|
end
|
190
206
|
|
191
207
|
def improve_conditions(options)
|
192
|
-
|
208
|
+
|
209
|
+
if options.is_a?(Hash)
|
210
|
+
#work around frozen issue
|
211
|
+
new_options = {}
|
212
|
+
until options.empty?
|
213
|
+
key, value = options.shift
|
214
|
+
key = key.to_s.dup
|
215
|
+
new_options[process_single!(key)] = value
|
216
|
+
end
|
217
|
+
options.merge!(new_options)
|
218
|
+
else
|
219
|
+
if options.is_a?(String)
|
220
|
+
options = [options]
|
221
|
+
end
|
193
222
|
str = options[0]
|
194
|
-
|
223
|
+
return nil if str.nil?
|
224
|
+
qp = /['"][^."]*['"]/
|
225
|
+
temp = str.scan(qp)
|
195
226
|
#replace string in quote to avoid unecessary processing
|
196
|
-
str.gsub!(
|
227
|
+
str.gsub!(qp, "'[??]'") unless temp.empty?
|
197
228
|
str.gsub!(/(([\w\(\)]+\.)+\w+)[ !><=]/) do |n|
|
198
229
|
#cut last char and abstract association for include
|
199
|
-
|
230
|
+
if n =~ /^\(/
|
231
|
+
'(' + abstract_association(n[1..-2]) + n[-1, 1]
|
232
|
+
else
|
233
|
+
abstract_association(n[0..-2]) + n[-1, 1]
|
234
|
+
end
|
235
|
+
|
200
236
|
end
|
201
237
|
#add @table_name on single field
|
202
|
-
str.gsub!(/[
|
238
|
+
str.gsub!(/[\.:]?[`"']?\w+[`"']?[\.]?/) {|x| (x =~ /\D+/).nil? || x[-1, 1] == "." || x[0, 1] == ":" || ["and", "or", "is", "null", "not", "like", "in"].include?(x.downcase) ? x : @tnwithdot + x}
|
203
239
|
str.gsub!(/\.#{@table_name}\./, ".")
|
204
240
|
#recover string in quote
|
205
241
|
unless temp.empty?
|
@@ -211,20 +247,11 @@ class Rquerypad
|
|
211
247
|
end
|
212
248
|
options[0] = str
|
213
249
|
end
|
214
|
-
if options.is_a?(Hash)
|
215
|
-
#work around frozen issue
|
216
|
-
new_options = {}
|
217
|
-
until options.empty?
|
218
|
-
key, value = options.shift
|
219
|
-
key = key.to_s.dup
|
220
|
-
new_options[process_single!(key)] = value
|
221
|
-
end
|
222
|
-
options.merge!(new_options)
|
223
|
-
end
|
224
250
|
options
|
225
251
|
end
|
226
252
|
|
227
253
|
def process_single!(key)
|
254
|
+
return key.sub!('=', '') if key[0, 1] == '='
|
228
255
|
if key.include?(".")
|
229
256
|
if /^(.+)[ ]/ =~ key
|
230
257
|
key.sub!("#$1", abstract_association("#$1"))
|
@@ -252,12 +279,13 @@ class Rquerypad
|
|
252
279
|
owners = []
|
253
280
|
#get relevant owner for each table
|
254
281
|
tables.each_index do |i|
|
282
|
+
#tables[i] = tables[i].pluralize
|
255
283
|
if i == 0
|
256
284
|
owners[i] = owner
|
257
285
|
else
|
258
286
|
tname = cut_end_underscore(tables[i-1])
|
259
287
|
r = owners[i-1].reflections[tname.to_sym].options
|
260
|
-
owners[i] = r[:class_name].nil? ? eval(owners[i-1].to_s.gsub(/\w*$/, "")+tname.singularize.camelize) :
|
288
|
+
owners[i] = r[:class_name].nil? ? eval(owners[i-1].to_s.gsub(/\w*$/, "")+tname.singularize.camelize) : eval("#{r[:class_name]}")
|
261
289
|
end
|
262
290
|
end
|
263
291
|
owners.reverse!
|
@@ -300,6 +328,7 @@ class Rquerypad
|
|
300
328
|
end
|
301
329
|
|
302
330
|
def transfer_table_name(name, owner = @owner)
|
331
|
+
#p "=======================================", name,"=======================================", owner.inspect, "=======================================", owner.reflections.inspect, "=======================================" if owner.reflections[name.to_sym].nil?
|
303
332
|
owner.reflections[name.to_sym].class_name.gsub(/([\w]+::)*/, "").pluralize.underscore
|
304
333
|
end
|
305
334
|
|
@@ -1,25 +1,25 @@
|
|
1
1
|
reply_one:
|
2
2
|
id: 1
|
3
3
|
title: "rquerypad"
|
4
|
-
|
4
|
+
forum_thread_id: 1
|
5
5
|
user_id: 1
|
6
6
|
|
7
7
|
reply_two:
|
8
8
|
id: 2
|
9
9
|
title: "thank you"
|
10
|
-
|
10
|
+
forum_thread_id: 2
|
11
11
|
user_id: 2
|
12
12
|
|
13
13
|
reply_three:
|
14
14
|
id: 3
|
15
15
|
title: "thank you-1"
|
16
|
-
|
16
|
+
forum_thread_id: 2
|
17
17
|
parent_id: 2
|
18
18
|
user_id: 2
|
19
19
|
|
20
20
|
reply_four:
|
21
21
|
id: 4
|
22
22
|
title: "thank you-2"
|
23
|
-
|
23
|
+
forum_thread_id: 2
|
24
24
|
parent_id: 2
|
25
25
|
user_id: 2
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class CreateThreads < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
create_table :
|
3
|
+
create_table :forum_threads do |t|
|
4
4
|
t.string "title"
|
5
5
|
t.string "content"
|
6
6
|
t.integer "user_id"
|
@@ -10,6 +10,6 @@ class CreateThreads < ActiveRecord::Migration
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.down
|
13
|
-
drop_table :
|
13
|
+
drop_table :forum_threads
|
14
14
|
end
|
15
15
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class CreateReplies < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
create_table :
|
3
|
+
create_table :forum_replies do |t|
|
4
4
|
t.string "title"
|
5
5
|
t.string "content"
|
6
6
|
t.integer "user_id"
|
7
|
-
t.integer "
|
7
|
+
t.integer "forum_thread_id"
|
8
8
|
t.integer "parent_id"
|
9
9
|
t.datetime "created_at"
|
10
10
|
t.datetime "updated_at"
|
@@ -12,6 +12,6 @@ class CreateReplies < ActiveRecord::Migration
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.down
|
15
|
-
drop_table :
|
15
|
+
drop_table :forum_replies
|
16
16
|
end
|
17
17
|
end
|
data/test/model.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Model
|
2
2
|
class User < ActiveRecord::Base
|
3
|
-
has_many :threads
|
4
|
-
has_many :
|
3
|
+
has_many :threads, :class_name => "Model::ForumThread"
|
4
|
+
has_many :repliess, :class_name => "Model::ForumReply"
|
5
5
|
end
|
6
|
-
class
|
7
|
-
has_many :replies
|
6
|
+
class ForumThread < ActiveRecord::Base
|
7
|
+
has_many :replies, :class_name => "Model::ForumReply"
|
8
8
|
belongs_to :user
|
9
9
|
end
|
10
|
-
class
|
11
|
-
belongs_to :thread
|
12
|
-
has_many :replies
|
13
|
-
belongs_to :reply, :foreign_key => "parent_id"
|
10
|
+
class ForumReply < ActiveRecord::Base
|
11
|
+
belongs_to :thread, :class_name => "Model::ForumThread"
|
12
|
+
has_many :replies, :class_name => "Model::ForumReply"
|
13
|
+
belongs_to :reply, :foreign_key => "parent_id", :class_name => "Model::ForumReply"
|
14
14
|
belongs_to :user
|
15
15
|
acts_as_tree
|
16
16
|
end
|
data/test/rquerypad_test.rb
CHANGED
@@ -3,23 +3,33 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
3
3
|
|
4
4
|
require 'rquerypad'
|
5
5
|
require 'test/model'
|
6
|
-
class RquerypadTest <
|
6
|
+
class RquerypadTest < THE_TEST_CLASS
|
7
7
|
# Replace this with your real tests.
|
8
8
|
include Model
|
9
9
|
def test_this_plugin
|
10
10
|
@fixture_path = 'vendor/plugins/rquerypad/test/fixtures'
|
11
11
|
|
12
12
|
@users = User.find(:all, :group => ["threads.created_at", "name"])
|
13
|
+
p @users
|
13
14
|
assert_equal @users.size, 2
|
14
|
-
|
15
|
+
|
15
16
|
c = User.count(:conditions => ["threads_.replies.title = ?", "rquerypad"])
|
16
17
|
assert_equal c, 1
|
17
|
-
|
18
|
+
|
18
19
|
@users = User.find(:all, :conditions => ["threads.replies.title = ? and threads.id = ?", "rquerypad", 1])
|
19
20
|
assert_equal @users.size, 1
|
20
|
-
|
21
|
-
@
|
22
|
-
|
21
|
+
|
22
|
+
@users = User.find(:all, :conditions => ["threads.replies.title = :title and threads.id = :id", {:title => "rquerypad", :id => 1}])
|
23
|
+
assert_equal @users.size, 1
|
24
|
+
|
25
|
+
@replies = ForumReply.find(:all, :conditions => ["thread.id = ?", 2])
|
26
|
+
assert_equal @replies.size, 3
|
27
|
+
|
28
|
+
@replies = ForumReply.find(:all, :conditions => ["id = ?", 2])
|
29
|
+
assert_equal @replies.size, 1
|
30
|
+
|
31
|
+
@replies = User.find(:all, :conditions => ["id = ?", 2])
|
32
|
+
assert_equal @replies.size, 1
|
23
33
|
|
24
34
|
end
|
25
35
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,43 +1,10 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
3
|
-
|
4
|
-
require 'rquerypad'
|
5
|
-
|
6
1
|
ENV["RAILS_ENV"] = "rquerypad"
|
7
|
-
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
|
8
3
|
require 'test_help'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
# in a transaction that's rolled back on completion. This ensures that the
|
13
|
-
# test database remains unchanged so your fixtures don't have to be reloaded
|
14
|
-
# between every test method. Fewer database queries means faster tests.
|
15
|
-
#
|
16
|
-
# Read Mike Clark's excellent walkthrough at
|
17
|
-
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
18
|
-
#
|
19
|
-
# Every Active Record database supports transactions except MyISAM tables
|
20
|
-
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
21
|
-
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
22
|
-
# is recommended.
|
23
|
-
#
|
24
|
-
# The only drawback to using transactional fixtures is when you actually
|
25
|
-
# need to test transactions. Since your test is bracketed by a transaction,
|
26
|
-
# any transactions started in your code will be automatically rolled back.
|
4
|
+
THE_TEST_CLASS = eval(RAILS_GEM_VERSION >= "2.3" ? "ActiveSupport::TestCase" : "Test::Unit::TestCase")
|
5
|
+
THE_TEST_CLASS.fixture_path = File.expand_path(File.dirname(__FILE__) + "/fixtures/")
|
6
|
+
class THE_TEST_CLASS
|
27
7
|
self.use_transactional_fixtures = true
|
28
|
-
|
29
|
-
# Instantiated fixtures are slow, but give you @david where otherwise you
|
30
|
-
# would need people(:david). If you don't want to migrate your existing
|
31
|
-
# test cases which use the @david style and don't mind the speed hit (each
|
32
|
-
# instantiated fixtures translates to a database query per test method),
|
33
|
-
# then set this back to true.
|
34
8
|
self.use_instantiated_fixtures = false
|
35
|
-
|
36
|
-
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
37
|
-
#
|
38
|
-
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
39
|
-
# -- they do not yet inherit this setting
|
40
9
|
fixtures :all
|
41
|
-
|
42
|
-
# Add more helper methods to be used by all tests here...
|
43
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rquerypad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leon Li
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-03-09 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description: Simplify query options with association automation and improve inner join for
|
16
|
+
description: Simplify query options with association automation and improve inner join for ActiveRecord of rails by providing a compact and OO query language instead of writing some explicit join
|
17
17
|
email: scorpio_leon@hotmail.com
|
18
18
|
executables: []
|
19
19
|
|
@@ -22,30 +22,25 @@ extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
23
23
|
|
24
24
|
files:
|
25
|
-
- CHANGELOG
|
26
|
-
- lib
|
27
25
|
- MIT-LICENSE
|
28
|
-
- pkg
|
29
26
|
- Rakefile
|
27
|
+
- CHANGELOG
|
30
28
|
- README
|
31
|
-
- tasks
|
32
|
-
- test
|
33
29
|
- lib/rquerypad.rb
|
34
|
-
-
|
30
|
+
- tasks/rquerypad_tasks.rake
|
31
|
+
- test/test_helper.rb
|
32
|
+
- test/rquerypad_test.rb
|
33
|
+
- test/model.rb
|
35
34
|
- test/fixtures
|
36
|
-
- test/fixtures/
|
37
|
-
- test/fixtures/threads.yml
|
35
|
+
- test/fixtures/forum_replies.yml
|
38
36
|
- test/fixtures/users.yml
|
37
|
+
- test/fixtures/forum_threads.yml
|
39
38
|
- test/migrate
|
39
|
+
- test/migrate/003_create_replies.rb
|
40
40
|
- test/migrate/001_create_users.rb
|
41
41
|
- test/migrate/002_create_threads.rb
|
42
|
-
- test/migrate/003_create_replies.rb
|
43
|
-
- test/model.rb
|
44
|
-
- test/rquerypad_test.rb
|
45
|
-
- test/test_helper.rb
|
46
|
-
- tasks/rquerypad_tasks.rake
|
47
42
|
has_rdoc: false
|
48
|
-
homepage:
|
43
|
+
homepage: http://rquerypad.rubyforge.org/
|
49
44
|
post_install_message:
|
50
45
|
rdoc_options: []
|
51
46
|
|
@@ -63,12 +58,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
58
|
- !ruby/object:Gem::Version
|
64
59
|
version: "0"
|
65
60
|
version:
|
66
|
-
requirements:
|
67
|
-
|
68
|
-
rubyforge_project:
|
69
|
-
rubygems_version: 1.
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
rubyforge_project: Rquerypad
|
64
|
+
rubygems_version: 1.3.1
|
70
65
|
signing_key:
|
71
66
|
specification_version: 2
|
72
|
-
summary: Simplify query
|
67
|
+
summary: Simplify query with OO way and improve inner join for ActiveRecord
|
73
68
|
test_files: []
|
74
69
|
|
data/test/db.rquerypad
DELETED
Binary file
|
File without changes
|