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 CHANGED
@@ -6,7 +6,7 @@ require 'bundler/version'
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "fake_arel"
9
- s.version = "0.9"
9
+ s.version = "0.9.1"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.author = "Grant Ammons"
12
12
  s.email = ["grant@pipelinedealsco.com"]
@@ -3,7 +3,7 @@ module WithScopeReplacement
3
3
  base.class_eval do
4
4
  class << self
5
5
  def to_sql
6
- construct_finder_sql self.current_scoped_methods[:find]
6
+ construct_finder_sql({})
7
7
  end
8
8
 
9
9
  def with_scope(method_scoping = {}, action = :merge, &block)
data/lib/fake_arel.rb CHANGED
@@ -8,7 +8,7 @@ require 'fake_arel/with_scope_replacement'
8
8
  require 'fake_arel/rails_3_finders'
9
9
 
10
10
  module FakeArel
11
- VERSION = '0.9'
11
+ VERSION = '0.9.1'
12
12
  ActiveRecord::Base.send :include, Rails3Finders
13
13
  ActiveRecord::Base.send :include, WithScopeReplacement
14
14
  end
@@ -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: 25
4
+ hash: 57
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- version: "0.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-10-26 00:00:00 -04:00
18
+ date: 2010-11-17 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency