fake_arel 0.9 → 0.9.1
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/fake_arel.gemspec +1 -1
- data/lib/fake_arel/with_scope_replacement.rb +1 -1
- data/lib/fake_arel.rb +1 -1
- data/spec/fake_arel_spec.rb +13 -1
- data/spec/test.db +0 -0
- metadata +4 -3
data/fake_arel.gemspec
CHANGED
data/lib/fake_arel.rb
CHANGED
data/spec/fake_arel_spec.rb
CHANGED
|
@@ -38,7 +38,19 @@ describe "Fake Arel" do
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it "should be able to output sql" do
|
|
41
|
-
Topic.joins(:replies).limit(1).to_sql
|
|
41
|
+
sql = Topic.select('content').joins(:replies).limit(1).order('id desc').where(:author_id => 1).to_sql
|
|
42
|
+
sql.should =~ /SELECT content/i
|
|
43
|
+
sql.should =~ /JOIN "replies"/i
|
|
44
|
+
sql.should =~ /"author_id" = 1/
|
|
45
|
+
sql.should =~ /LIMIT 1/i
|
|
46
|
+
sql.should =~ /ORDER BY id desc/i
|
|
47
|
+
sql = Reply.topic_4_id_desc.to_sql
|
|
48
|
+
sql.should =~ /"topic_id" = 4/
|
|
49
|
+
sql.should =~ /ORDER BY id desc/i
|
|
50
|
+
end
|
|
51
|
+
it "should not dublication conditions" do
|
|
52
|
+
sql = Topic.select('content').joins(:replies).limit(1).order('id desc').where(:author_id => 1).to_sql
|
|
53
|
+
sql.should_not =~ /"author_id" = 1.+"author_id" = 1/
|
|
42
54
|
end
|
|
43
55
|
|
|
44
56
|
it "should be able to chain named scopes within a named_scope" do
|
data/spec/test.db
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fake_arel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 57
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 9
|
|
9
|
-
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.9.1
|
|
10
11
|
platform: ruby
|
|
11
12
|
authors:
|
|
12
13
|
- Grant Ammons
|
|
@@ -14,7 +15,7 @@ autorequire:
|
|
|
14
15
|
bindir: bin
|
|
15
16
|
cert_chain: []
|
|
16
17
|
|
|
17
|
-
date: 2010-
|
|
18
|
+
date: 2010-11-17 00:00:00 -05:00
|
|
18
19
|
default_executable:
|
|
19
20
|
dependencies:
|
|
20
21
|
- !ruby/object:Gem::Dependency
|