johnbender-rquery 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,16 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/mock_active_record.rb")
2
2
  require File.expand_path(File.dirname(__FILE__) + "/../lib/rquery.rb")
3
3
 
4
- describe RQuery::Serializers::Operations do
4
+ describe RQuery::OperationCollector do
5
5
 
6
6
  before(:all) do
7
- RQuery.adapter = RQuery::Adapters::Sqlite
7
+ RQuery::Config.adapter = RQuery::Adapters::Sqlite
8
8
  end
9
9
 
10
10
  it "should group two operations on the same line with parens and the 'or' keyword when the | operator is used" do
11
11
 
12
12
  ActiveRecord::MockObject.where{ |mock|
13
- (mock.foo.is == 2) | (mock.foo.in 1,2,3)
13
+ (mock.foo == 2) | (mock.foo.in 1,2,3)
14
14
  }.should == [:all, {:conditions => ["((foo = ? or foo in (?)))", 2, [1,2,3]]}]
15
15
 
16
16
  end
@@ -18,7 +18,7 @@ describe RQuery::Serializers::Operations do
18
18
  it "should group two operations on the same line with parns and the 'and' keyword when the & operator is used" do
19
19
 
20
20
  ActiveRecord::MockObject.where{ |mock|
21
- (mock.foo.is == 2) & (mock.foo.in 1,2,3)
21
+ (mock.foo == 2) & (mock.foo.in 1,2,3)
22
22
  }.should == [:all, {:conditions => ["((foo = ? and foo in (?)))", 2, [1,2,3]]}]
23
23
 
24
24
  end
@@ -26,8 +26,8 @@ describe RQuery::Serializers::Operations do
26
26
  it "should group two operations on the same line and continue to add subsequent operations" do
27
27
 
28
28
  ActiveRecord::MockObject.where{ |mock|
29
- (mock.foo.is == 2) & (mock.foo.in 1,2,3)
30
- mock.foo.is > 3
29
+ (mock.foo == 2) & (mock.foo.in 1,2,3)
30
+ mock.foo > 3
31
31
  }.should == [:all, {:conditions => ["((foo = ? and foo in (?)) and foo > ?)", 2, [1,2,3], 3]}]
32
32
 
33
33
  end
@@ -35,17 +35,17 @@ describe RQuery::Serializers::Operations do
35
35
  it "should properly group multiple nested groupings on the same line" do
36
36
 
37
37
  ActiveRecord::MockObject.where{ |mock|
38
- (mock.foo.is == 2) & (mock.foo.in 1,2,3) | (mock.foo.contains "george")
39
- mock.foo.is > 3
40
- (mock.foo.is == 2) & (mock.foo.in 1,2,3)
41
- }.should == [:all, {:conditions => ["(((foo = ? and foo in (?)) or foo like '%' || ? || '%') and foo > ? and (foo = ? and foo in (?)))", 2, [1,2,3], "george", 3, 2, [1,2,3]]}]
38
+ (mock.foo == 2) | (mock.foo.in 1,2,3) | (mock.foo.contains "george")
39
+ mock.foo > 3
40
+ (mock.foo == 2) & (mock.foo.in 1,2,3)
41
+ }.should == [:all, {:conditions => ["((foo = ? or foo in (?) or foo like '%' || ? || '%') and foo > ? and (foo = ? and foo in (?)))", 2, [1,2,3], "george", 3, 2, [1,2,3]]}]
42
42
 
43
43
  end
44
44
 
45
45
  it "& should have precedence when evaluating multiple operation group types on a single line" do
46
46
 
47
47
  ActiveRecord::MockObject.where{ |mock|
48
- (mock.foo.is == 2) | (mock.foo.in 1,2,3) & (mock.foo.contains "george")
48
+ (mock.foo == 2) | (mock.foo.in 1,2,3) & (mock.foo.contains "george")
49
49
  }.should == [:all, {:conditions => ["((foo = ? or (foo in (?) and foo like '%' || ? || '%')))", 2, [1,2,3], "george"]}]
50
50
 
51
51
 
@@ -15,7 +15,7 @@ describe RQuery::Adapters::Sqlite do
15
15
  @adapter.not_between.should == "not " + @adapter.between
16
16
  @adapter.neq.should == "<> ?"
17
17
  @adapter.contains.should == "like '%' || ? || '%'"
18
- @adapter.not_contains.should == "not " + @adapter.contains
18
+ @adapter.without.should == "not " + @adapter.contains
19
19
  end
20
20
 
21
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: johnbender-rquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John bender
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2000-04-27 00:00:00 -07:00
12
+ date: 2009-08-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,26 +24,21 @@ extra_rdoc_files: []
24
24
  files:
25
25
  - README.markdown
26
26
  - rakefile.rb
27
- - examples/user.rb
28
27
  - lib/rquery.rb
29
- - lib/rquery/declarations.rb
30
- - lib/rquery/serializers.rb
31
- - lib/rquery/attribute.rb
32
28
  - lib/rquery/attribute_collection.rb
33
29
  - lib/rquery/active_record.rb
34
30
  - lib/rquery/active_record/base.rb
35
31
  - lib/rquery/adapters.rb
36
32
  - lib/rquery/adapters/sql.rb
37
33
  - lib/rquery/adapters/sqlite.rb
34
+ - lib/rquery/operation_collector.rb
38
35
  - spec/active_record_base_spec_attribute_collection.rb
39
- - spec/active_record_base_spec_symbols.rb
40
- - spec/declarations_spec.rb
41
36
  - spec/mock_active_record.rb
42
37
  - spec/or_and_operations_spec.rb
43
- - spec/serializers_spec.rb
44
38
  - spec/sqlite_adapter_spec.rb
45
39
  has_rdoc: false
46
- homepage: http://nickelcode.com/rquery/
40
+ homepage: http://github.com/johnbender/rquery
41
+ licenses:
47
42
  post_install_message:
48
43
  rdoc_options: []
49
44
 
@@ -64,9 +59,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
59
  requirements: []
65
60
 
66
61
  rubyforge_project:
67
- rubygems_version: 1.2.0
62
+ rubygems_version: 1.3.5
68
63
  signing_key:
69
64
  specification_version: 2
70
- summary: A ruby DSL for building data queries in SQL and other query languages.
65
+ summary: An ActiveRecord extension providing a DSL replacement for complex find queries.
71
66
  test_files: []
72
67
 
@@ -1,49 +0,0 @@
1
- #All operations need to be on the same line and in parens
2
- #either the | operator or the & operator can be used on a singel line
3
- User.where do |user|
4
- (mock.age.is > 20) | (mock.age.in 16,18)
5
- end
6
-
7
- #the & takes precedence here and will be grouped with the contains "Alice" which will be
8
- #or'd with the contains "George"
9
- #=> name contains "George" or (name contains "Alice and age from 20 to 30)
10
- User.where do |user|
11
- (user.name.contains "George") | (user.name.contains "Alice") & (use.age.from 20..30)
12
- end
13
-
14
- #to correct the above to the more intuitive version add parens to force precedence of the
15
- #contains operations
16
- #=> (name contains "George" or name contains "Alice) and age from 20 to 30
17
- User.where do |user|
18
- ((user.name.contains "George") | (user.name.contains "Alice")) & (use.age.from 20..30)
19
- end
20
-
21
- #in this sutation it would be cleaner and easier to just move the and'd statement down
22
- #a line as all seperate lines are and'd and lines have precedence from top to bottom
23
- #additionaly operations on seperate lines don't need parens
24
- User.where do |user|
25
- (user.name.contains "George") | (user.name.contains "Alice")
26
- use.age.from 20..30
27
- end
28
-
29
- #should you attempt to use and attribute that doesn't exist for a given model
30
- #rquery will tell you before it's sent to the db
31
- User.where do |user|
32
- user.ssn.is == 123-45-6789
33
- end
34
- # RQuery::AttributeNotFoundError: The field 'ssn' doesn't exist for this object
35
- # from /Users/johnbender/Projects/rquery/lib/rquery/attribute_collection.rb:28:in `method_missing'
36
- # from (irb):24
37
- # from /Users/johnbender/Projects/rquery/lib/rquery/active_record/base.rb:16:in `where'
38
- # from /Users/johnbender/Projects/rquery/lib/rquery/active_record/base.rb:11:in `synchronize'
39
- # from /Users/johnbender/Projects/rquery/lib/rquery/active_record/base.rb:11:in `where'
40
- # from (irb):23
41
-
42
- #environment config
43
- RQuery.use_symbols
44
-
45
- #example of using symbols, you can see more at the RQuery page on my site.
46
- User.where do |user|
47
- (:name.contains "George") | (:name.contains "Alice")
48
- :age.from 20..30
49
- end
@@ -1,14 +0,0 @@
1
- module RQuery
2
- class Attribute
3
- #adds is, is_not, between, in, contains, and from (alias)
4
- include RQuery::Declarations
5
-
6
- #define name for the Declarations included methods
7
- #as it needs to be different than the default
8
- attr_accessor :name
9
-
10
- def initialize(field_name)
11
- @name = field_name
12
- end
13
- end
14
- end
@@ -1,34 +0,0 @@
1
- module RQuery
2
- module Declarations
3
- #Allows the methods below to be included in
4
- #the Field class and the Symbol class but remain
5
- #the same in implementation
6
- #!name is redefined as an attr_accessor in the Field class!
7
- def name
8
- self.to_s if @name == nil
9
- end
10
-
11
- def is
12
- Serializers::IsOperations.add_operation(name)
13
- Serializers::IsOperations.prefix = nil
14
- Serializers::IsOperations
15
- end
16
-
17
- def is_not
18
- Serializers::IsNotOperations.add_operation(name)
19
- Serializers::IsNotOperations.prefix = "not_"
20
- Serializers::IsNotOperations
21
- end
22
-
23
- [:in, :between, :contains].each do |m|
24
- define_method(m) do |*args|
25
- Serializers::IsOperations.add_operation(name)
26
- Serializers::IsOperations.prefix = nil
27
- Serializers::IsOperations.send(m, *args)
28
- end
29
- end
30
-
31
- alias :from :between
32
- end
33
- end
34
-
@@ -1,184 +0,0 @@
1
- module RQuery
2
- module Serializers
3
- #The Operations serializer, handles the limiting factors imposed
4
- #by a given query. The methods in this class apply to both is and is_not
5
- #operations. An example in sql would look like:
6
- #
7
- #where foo = bar and foo > 2
8
- #
9
- #This class is a gateway to the selected RQuery.adapter methods.
10
- #Calls to methods here, will be passed on to the selected adapter
11
- class Operations
12
-
13
- @@prefix = nil
14
- @@ops = []
15
- @@values = []
16
-
17
- class << self
18
- def prefix=(val)
19
- @@prefix = val
20
- end
21
-
22
- def to_s
23
- RQuery.adapter.join(@@ops)
24
- end
25
-
26
- #return a conditions array for use with ActiveRecord.find
27
- def conditions
28
- [to_s] + @@values
29
- end
30
-
31
- #add and operation to the @@ops array which will be popped
32
- #and pushed depending on the operations sequence and arrangement
33
- def add_operation(val)
34
- @@ops << val.to_s
35
- end
36
-
37
- #clean out the Operations singleton class variables
38
- def clear
39
- @@ops.clear
40
- @@values.clear
41
- end
42
-
43
- #grouping is done by using the | and & operators between multiple operations
44
- #objects on a single line.
45
- #
46
- #This works because each operation ie (user.age.is == 2) is
47
- #evaluated before these two operators thus pushing
48
- #the equivelant operation string onto the @@ops array (ie 'age = ?').
49
- #When an operation is evaluated it returns the Operations class which can be compared
50
- #using the aforementioned operators. Those operators call the group method
51
- #popping the last two arguments off the stack and dealing with them in one of two ways
52
- #
53
- #1. if the second object popped is a string both objects should be
54
- # added to a new OperationGroup which is then put back onto the stack
55
- #
56
- #2. if the second object popped is an OperationGroup the firest belongs to this group as
57
- # well (it was on the same line). It is added to the OperationGroup and put back on the
58
- # stack
59
- def group(type)
60
- second_op, first_op = @@ops.pop, @@ops.pop
61
-
62
- #if the previous operation on the stack is an Operation Group we need to add to it
63
- if first_op.class == RQuery::Serializers::OperationsGroup
64
- if first_op.type == type
65
- first_op.ops << second_op
66
- @@ops << first_op
67
- else
68
- @@ops << OperationsGroup.new(first_op.to_s, second_op, type)
69
- end
70
- else
71
- @@ops << OperationsGroup.new(first_op, second_op, type)
72
- end
73
- end
74
-
75
- #used to group operations for anding on a single line
76
- #example with sqlite adapter
77
- #(user.age.in [1,2,3]) | (user.name.contains "foo")
78
- #=>(age in (?) and name like '%' || 'foo' || '%')
79
- def &(second)
80
- self.group(:and)
81
- self
82
- end
83
-
84
- def |(second)
85
- self.group(:or)
86
- self
87
- end
88
-
89
- def in(*args)
90
- #flatten our args to prevent having to check for an array first arg
91
- args.flatten!
92
-
93
- #if a range is passed as the first argument
94
- #use it alone, otherwise use the args array
95
- #examples:
96
- #ruby => args.flatten! => stored values
97
- #:id.between 1..100 => [1..100] => 1..100
98
- #:id.between [1, 2, 3] => [1, 2, 3] => [1, 2, 3]
99
- #:id.between 1, 2 => [1, 2] => [1, 2]
100
- @@values << (args.first.class == Range ? args.first : args)
101
- @@ops[@@ops.length-1] += " #{RQuery.adapter.send("#{@@prefix}in")}"
102
- self
103
- end
104
-
105
- def between(*args)
106
- #flatten our args to prevent having to check for an array first arg
107
- args.flatten!
108
-
109
- #if a range is passed use its first/last element
110
- #otherwise use the first and last element of the flattened args array
111
- #examples:
112
- #ruby => args.flatten! => stored values
113
- #:id.between 1..100 => [1..100] => 1 100
114
- #:id.between [1, 2, 3] => [1, 2, 3] => 1 3
115
- #:id.between 1, 2 => [1, 2] => 1 2
116
- #
117
- @@values += (args.first.class == Range ? [args.first.first, args.first.last] : [args.first, args.last])
118
- @@ops[@@ops.length-1] += " #{RQuery.adapter.send("#{@@prefix}between")}"
119
- self
120
- end
121
-
122
- def contains(str)
123
- @@values << str
124
- @@ops[@@ops.length-1] += " #{RQuery.adapter.send("#{@@prefix}contains")}"
125
- self
126
- end
127
-
128
- #allows for is.from
129
- #examples:
130
- #
131
- #:id.is.from 1,2
132
- #:is.is.from 2..10
133
- alias :from :between
134
- end
135
- end
136
-
137
- class OperationsGroup
138
- attr_accessor :ops, :type
139
-
140
- def initialize(left, right, type)
141
- @ops = Array.new
142
- @ops << left
143
- @ops << right
144
- @type = type
145
- end
146
-
147
- def to_s
148
- RQuery.adapter.send("#{type.to_s}_group", @ops)
149
- end
150
- end
151
-
152
- #The IsOpertaions serializer defines only methods that apply to the .is operator
153
- #that is added to the Symbol class in the Declarations module.
154
- class IsOperations < Operations
155
- #define the normal operators for is to call the adapter for the equivelant sql
156
- class << self
157
- [:==, :>, :>=, :<, :<=].each do |operator|
158
- define_method(operator) do |val|
159
- @@values << val
160
- @@ops[@@ops.length-1] += " #{RQuery.adapter.send(operator)}"
161
- self
162
- end
163
- end
164
- end
165
-
166
- end
167
-
168
- #The IsNotOperations serializer defines only methods that apply to the .is_not operator
169
- #that is added to the symbol class in the declarations module. Specifically, == as
170
- #ruby does not allow for the overloading of !=
171
- class IsNotOperations < Operations
172
- #define the == value for is_not to call the adapter for the equivelant sql
173
- class << self
174
- def ==(val)
175
- @@values << val
176
- @@ops[@@ops.length-1] += " #{RQuery.adapter.send(:neq)}"
177
- self
178
- end
179
- end
180
-
181
- end
182
-
183
- end
184
- end
@@ -1,214 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/mock_active_record.rb")
2
- require File.expand_path(File.dirname(__FILE__) + "/../lib/rquery.rb")
3
-
4
- describe ActiveRecord do
5
-
6
- before(:all) do
7
- RQuery.adapter = RQuery::Adapters::Sqlite
8
- RQuery.use_symbols
9
- end
10
-
11
- #should really set up the find method defined above to use the ruby db libraries and
12
- #create the final sql string
13
- #all run with default adapter
14
-
15
- it "should set up a where method" do
16
- ActiveRecord::MockObject.respond_to?(:where).should == true
17
- end
18
-
19
- it "should return sql with foo, the operations, and the values for :foo.is <operation> <value>" do
20
-
21
- ActiveRecord::MockObject.where{
22
- :foo.is == "bar"
23
- }.should == [:all, {:conditions => ["(foo = ?)", "bar"]}]
24
-
25
- ActiveRecord::MockObject.where{
26
- :foo.is > 1
27
- }.should == [:all, {:conditions => ["(foo > ?)", 1]}]
28
-
29
- ActiveRecord::MockObject.where{
30
- :foo.is < 2
31
- }.should == [:all, {:conditions => ["(foo < ?)", 2]}]
32
-
33
- ActiveRecord::MockObject.where{
34
- :foo.is >= 3
35
- }.should == [:all, {:conditions => ["(foo >= ?)", 3]}]
36
-
37
- ActiveRecord::MockObject.where{
38
- :foo.is <= 4
39
- }.should == [:all, {:conditions => ["(foo <= ?)", 4]}]
40
-
41
- end
42
-
43
- it "should return sql with foo, the operations, and the values for :foo.is_not <operation> <value>" do
44
- ActiveRecord::MockObject.where{
45
- :foo.is_not == "bar"
46
- }.should == [:all, {:conditions => ["(foo <> ?)", "bar"]}]
47
-
48
- ActiveRecord::MockObject.where{
49
- :foo.is_not.in 1,2
50
- }.should == [:all, {:conditions => ["(foo not in (?))", [1,2]]}]
51
-
52
- ActiveRecord::MockObject.where{
53
- :foo.is_not.between 1..3
54
- }.should == [:all, {:conditions => ["(foo not between ? and ?)", 1, 3]}]
55
-
56
- ActiveRecord::MockObject.where{
57
- :foo.is_not.from 1..3
58
- }.should == [:all, {:conditions => ["(foo not between ? and ?)", 1, 3]}]
59
-
60
- end
61
-
62
- it "should return sql with foo, the operations, and values for :foo.is.in and :foo.in when used with a list of args, array, and range" do
63
-
64
- resulting_conditions = [:all, {:conditions => ["(foo in (?))", [1,2,3,4]]}]
65
-
66
- ActiveRecord::MockObject.where{
67
- :foo.is.in 1,2,3,4
68
- }.should == resulting_conditions
69
-
70
- ActiveRecord::MockObject.where{
71
- :foo.is.in [1,2,3,4]
72
- }.should == resulting_conditions
73
-
74
- ActiveRecord::MockObject.where{
75
- :foo.is.in 1..4
76
- }.should == [:all, {:conditions => ["(foo in (?))", 1..4]}]
77
-
78
- ActiveRecord::MockObject.where{
79
- :foo.in 1,2,3,4
80
- }.should == resulting_conditions
81
-
82
- ActiveRecord::MockObject.where{
83
- :foo.in [1,2,3,4]
84
- }.should == resulting_conditions
85
-
86
- ActiveRecord::MockObject.where{
87
- :foo.in 1..4
88
- }.should == [:all, {:conditions => ["(foo in (?))", 1..4]}]
89
-
90
- end
91
-
92
- it "should return sql with foo, operations, and values for :foo.is.between and :foo.between when used with a list of args, array, and range" do
93
-
94
- resulting_conditions = [:all, {:conditions => ["(foo between ? and ?)", 1, 2]}]
95
-
96
- ActiveRecord::MockObject.where{
97
- :foo.is.between 1,2
98
- }.should == resulting_conditions
99
-
100
- ActiveRecord::MockObject.where{
101
- :foo.is.between [1,2]
102
- }.should == resulting_conditions
103
-
104
- ActiveRecord::MockObject.where{
105
- :foo.is.between 1..2
106
- }.should == resulting_conditions
107
-
108
- ActiveRecord::MockObject.where{
109
- :foo.between 1,2
110
- }.should == resulting_conditions
111
-
112
- ActiveRecord::MockObject.where{
113
- :foo.between [1,2]
114
- }.should == resulting_conditions
115
-
116
- ActiveRecord::MockObject.where{
117
- :foo.between 1..2
118
- }.should == resulting_conditions
119
-
120
- end
121
-
122
- it "should return sql with foo, operations, and values for :foo.is.from when used with a list of args, array, and range" do
123
-
124
- resulting_conditions = [:all, {:conditions => ["(foo between ? and ?)", 1, 2]}]
125
-
126
- ActiveRecord::MockObject.where{
127
- :foo.is.from 1,2
128
- }.should == resulting_conditions
129
-
130
- ActiveRecord::MockObject.where{
131
- :foo.is.from [1,2]
132
- }.should == resulting_conditions
133
-
134
- ActiveRecord::MockObject.where{
135
- :foo.is.from 1..2
136
- }.should == resulting_conditions
137
-
138
- ActiveRecord::MockObject.where{
139
- :foo.from 1,2
140
- }.should == resulting_conditions
141
-
142
- ActiveRecord::MockObject.where{
143
- :foo.from [1,2]
144
- }.should == resulting_conditions
145
-
146
- ActiveRecord::MockObject.where{
147
- :foo.from 1..2
148
- }.should == resulting_conditions
149
-
150
-
151
- end
152
-
153
- it "should return sql with foo, operations, and values for :foo.contains when used with a range, array, and list" do
154
-
155
- resulting_conditions = [:all, {:conditions => ["(foo like '%' || ? || '%')", "bar"]}]
156
-
157
- ActiveRecord::MockObject.where{
158
- :foo.contains "bar"
159
- }.should == resulting_conditions
160
-
161
- end
162
-
163
-
164
- it "should return return the correct group of joined sql after multiple operations" do
165
-
166
- ActiveRecord::MockObject.where{
167
- :foo.is == "bar"
168
- :foo.is_not.in 1,2,3,4,5
169
- }.should == [:all, {:conditions => ["(foo = ? and foo not in (?))", "bar", [1,2,3,4,5]]}]
170
-
171
- end
172
-
173
- it "should return return the correct limit value passed" do
174
-
175
- ActiveRecord::MockObject.where(:first){
176
- :foo.is == "bar"
177
- :foo.is_not.in 1,2,3,4,5
178
- }.should == [:first, {:conditions => ["(foo = ? and foo not in (?))", "bar", [1,2,3,4,5]]}]
179
-
180
- end
181
-
182
- it "should have the correct 'not' keywords in alternating operations" do
183
-
184
- ActiveRecord::MockObject.where(:first){
185
- :foo.is == "bar"
186
- :foo.is_not.in 1,2,3,4,5
187
- :foo.is > 3
188
- }.should == [:first, {:conditions => ["(foo = ? and foo not in (?) and foo > ?)", "bar", [1,2,3,4,5], 3]}]
189
-
190
- end
191
-
192
- it "should return return strings as arguments when passed to between, in, and from (used for date strings)" do
193
-
194
- ActiveRecord::MockObject.where{
195
- :foo.is.between "some string", "2007-01-01"
196
- }.should == [:all, {:conditions => ["(foo between ? and ?)", "some string", "2007-01-01"]}]
197
-
198
- ActiveRecord::MockObject.where{
199
- :foo.is_not.between "some string", "2007-01-01"
200
- }.should == [:all, {:conditions => ["(foo not between ? and ?)", "some string", "2007-01-01"]}]
201
-
202
- ActiveRecord::MockObject.where{
203
- :foo.is.from "some string", "2007-01-01"
204
- }.should == [:all, {:conditions => ["(foo between ? and ?)", "some string", "2007-01-01"]}]
205
-
206
- ActiveRecord::MockObject.where{
207
- :foo.in "some string", "2007-01-01"
208
- }.should == [:all, {:conditions => ["(foo in (?))", ["some string", "2007-01-01"]]}]
209
-
210
- end
211
-
212
-
213
-
214
- end