fake_arel 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/fake_arel.gemspec +1 -1
- data/lib/fake_arel.rb +1 -1
- data/lib/fake_arel/rails_3_finders.rb +2 -1
- data/spec/fake_arel_spec.rb +6 -0
- data/spec/test.db +0 -0
- metadata +4 -4
data/fake_arel.gemspec
CHANGED
data/lib/fake_arel.rb
CHANGED
@@ -45,7 +45,8 @@ module Rails3Finders
|
|
45
45
|
begin
|
46
46
|
where << merge_conditions(s[:conditions])
|
47
47
|
rescue NoMethodError
|
48
|
-
|
48
|
+
# I am ActiveRecord::Base. Only my subclasses define merge_conditions:
|
49
|
+
where << subclasses.first.merge_conditions(s[:conditions])
|
49
50
|
end
|
50
51
|
#where << merge_conditions(s[:conditions])
|
51
52
|
joins << s[:joins] unless s[:joins].nil?
|
data/spec/fake_arel_spec.rb
CHANGED
@@ -174,6 +174,12 @@ describe "Fake Arel" do
|
|
174
174
|
# an example using joins, as well as a query that returns nothing
|
175
175
|
Reply.or(Reply.recent_joins_topic, Reply.topic_title_is("Nothin")).all.map(&:id).should == [5]
|
176
176
|
end
|
177
|
+
|
178
|
+
it 'should be able to combine with "or", an empty named scope with another non-empty one' do
|
179
|
+
q1 = Reply.where(:id => 0)
|
180
|
+
q2 = Reply.where(:id => 2)
|
181
|
+
Reply.or(q1,q2).all.map(&:id).should == [2]
|
182
|
+
end
|
177
183
|
|
178
184
|
it "should use select like rails 3 uses select" do
|
179
185
|
lambda { Reply.all.select {|r| r.id == 1 }}.should_not raise_error
|
data/spec/test.db
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_arel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 4
|
10
|
+
version: 0.9.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Grant Ammons
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-03-21 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|