fake_arel 1.3.2 → 1.3.3
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/VERSION +1 -1
- data/fake_arel.gemspec +2 -2
- data/lib/fake_arel/extensions.rb +1 -0
- data/lib/fake_arel/with_scope_replacement.rb +2 -0
- data/spec/fake_arel_spec.rb +6 -1
- metadata +4 -4
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.
|
|
1
|
+
1.3.3
|
data/fake_arel.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{fake_arel}
|
|
8
|
-
s.version = "1.3.
|
|
8
|
+
s.version = "1.3.3"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Grant Ammons"]
|
|
12
|
-
s.date = %q{2013-
|
|
12
|
+
s.date = %q{2013-09-11}
|
|
13
13
|
s.description = %q{fake_arel will simulate rails 3 arel syntax for Rails 2.}
|
|
14
14
|
s.email = %q{grant@pipelinedealsco.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/fake_arel/extensions.rb
CHANGED
|
@@ -52,6 +52,7 @@ module ActiveRecord
|
|
|
52
52
|
ret[:joins] = merge_joins((ret[:joins] || []), (local_scope.proxy_options[:joins] || []))
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
|
+
|
|
55
56
|
local_proxy_order_options = local_scope.proxy_options[:order].split(',') unless local_scope.proxy_options[:order].nil?
|
|
56
57
|
ret_order_options = ret[:order].split(',') unless ret[:order].nil?
|
|
57
58
|
ret[:order] = [local_proxy_order_options, ret_order_options].flatten.uniq.select{|o| !o.blank?}.join(',') if ret[:order] || local_scope.proxy_options[:order]
|
|
@@ -55,6 +55,8 @@ module WithScopeReplacement
|
|
|
55
55
|
end
|
|
56
56
|
elsif key == :select && merge
|
|
57
57
|
hash[method][key] = merge_includes(hash[method][key], params[key]).uniq.join(', ')
|
|
58
|
+
elsif key == :readonly
|
|
59
|
+
hash[method][key] = params[key] unless params[:readonly].nil?
|
|
58
60
|
elsif key == :include && merge
|
|
59
61
|
hash[method][key] = merge_includes(hash[method][key], params[key]).uniq
|
|
60
62
|
elsif key == :joins && merge
|
data/spec/fake_arel_spec.rb
CHANGED
|
@@ -52,7 +52,6 @@ describe "Fake Arel" do
|
|
|
52
52
|
|
|
53
53
|
it "should includes includes when including included includes" do
|
|
54
54
|
sql = Topic.includes(:replies).includes(:author).where("replies.id = 1").to_sql
|
|
55
|
-
p sql
|
|
56
55
|
sql.should =~ /JOIN "replies"/i
|
|
57
56
|
sql.should =~ /JOIN "authors"/i
|
|
58
57
|
end
|
|
@@ -294,3 +293,9 @@ describe "using select with include" do
|
|
|
294
293
|
end
|
|
295
294
|
end
|
|
296
295
|
|
|
296
|
+
describe "#readonly" do
|
|
297
|
+
it "should ensure records do not come back as readonly" do
|
|
298
|
+
Topic.joins(:replies).readonly(false).first.readonly?.should be_false
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
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: 29
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
8
|
- 3
|
|
9
|
-
-
|
|
10
|
-
version: 1.3.
|
|
9
|
+
- 3
|
|
10
|
+
version: 1.3.3
|
|
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: 2013-
|
|
18
|
+
date: 2013-09-11 00:00:00 -04:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|