fake_arel 0.9.2 → 0.9.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/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # A sample Gemfile
2
+ source "http://rubygems.org"
3
+
4
+ gem "activerecord", "2.3.5"
5
+
6
+ group :development do
7
+ gem 'rspec', '1.3.1'
8
+ gem "sqlite3-ruby"
9
+ gem 'newgem'
10
+ gem 'rake'
11
+ gem 'hoe'
12
+ gem 'ruby-debug'
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ RedCloth (4.2.3)
5
+ activerecord (2.3.5)
6
+ activesupport (= 2.3.5)
7
+ activesupport (2.3.5)
8
+ columnize (0.3.1)
9
+ hoe (2.6.2)
10
+ rake (>= 0.8.7)
11
+ rubyforge (>= 2.0.4)
12
+ json_pure (1.4.6)
13
+ linecache (0.43)
14
+ newgem (1.5.3)
15
+ RedCloth (>= 4.1.1)
16
+ activesupport (~> 2.3.4)
17
+ hoe (>= 2.4.0)
18
+ rubigen (>= 1.5.3)
19
+ syntax (>= 1.0.0)
20
+ rake (0.8.7)
21
+ rspec (1.3.1)
22
+ rubigen (1.5.5)
23
+ activesupport (~> 2.3.5)
24
+ ruby-debug (0.10.3)
25
+ columnize (>= 0.1)
26
+ ruby-debug-base (~> 0.10.3.0)
27
+ ruby-debug-base (0.10.3)
28
+ linecache (>= 0.3)
29
+ rubyforge (2.0.4)
30
+ json_pure (>= 1.1.7)
31
+ sqlite3-ruby (1.3.1)
32
+ syntax (1.0.0)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ activerecord (= 2.3.5)
39
+ hoe
40
+ newgem
41
+ rake
42
+ rspec (= 1.3.1)
43
+ ruby-debug
44
+ sqlite3-ruby
data/Manifest.txt CHANGED
@@ -1,9 +1,12 @@
1
+ Gemfile
2
+ Gemfile.lock
1
3
  History.txt
2
4
  Manifest.txt
3
5
  README.rdoc
4
6
  Rakefile
5
7
  fake_arel.gemspec
6
8
  lib/fake_arel.rb
9
+ lib/fake_arel/calculations.rb
7
10
  lib/fake_arel/extensions.rb
8
11
  lib/fake_arel/rails_3_finders.rb
9
12
  lib/fake_arel/singleton_class.rb
@@ -12,6 +15,8 @@ script/console
12
15
  script/destroy
13
16
  script/generate
14
17
  spec/fake_arel_spec.rb
18
+ spec/fixtures/author.rb
19
+ spec/fixtures/authors.yml
15
20
  spec/fixtures/replies.yml
16
21
  spec/fixtures/reply.rb
17
22
  spec/fixtures/schema.rb
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.2"
9
+ s.version = "0.9.3"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.author = "Grant Ammons"
12
12
  s.email = ["grant@pipelinedealsco.com"]
@@ -0,0 +1,16 @@
1
+ module ActiveRecord
2
+ module Calculations #:nodoc:
3
+ module ClassMethods
4
+ #fix calculations to consider scoped :group
5
+ def calculate_with_fakearel(operation, column_name, options = {})
6
+ cur_scope = scope(:find)
7
+ if !options[:group] && cur_scope && cur_scope[:group]
8
+ options = options.reverse_merge(cur_scope.slice(:group, :having))
9
+ end
10
+ calculate_without_fakearel(operation, column_name, options)
11
+ end
12
+
13
+ alias_method_chain :calculate, :fakearel
14
+ end
15
+ end
16
+ end
data/lib/fake_arel.rb CHANGED
@@ -9,7 +9,7 @@ require 'fake_arel/rails_3_finders'
9
9
  require 'fake_arel/calculations'
10
10
 
11
11
  module FakeArel
12
- VERSION = '0.9.2'
12
+ VERSION = '0.9.3'
13
13
  ActiveRecord::Base.send :include, Rails3Finders
14
14
  ActiveRecord::Base.send :include, WithScopeReplacement
15
15
  end
@@ -0,0 +1,9 @@
1
+ class Author < ActiveRecord::Base
2
+ has_many :topics
3
+
4
+ named_scope :mentions_activerecord, :conditions => ['topics.title LIKE ?', '%ActiveRecord%']
5
+
6
+ named_scope :with_replies_starting_with, lambda { |text|
7
+ { :conditions => "replies.content LIKE '#{text}%' ", :include => :replies }
8
+ }
9
+ end
@@ -0,0 +1,5 @@
1
+ john:
2
+ id: 1
3
+ name: John
4
+ created_at: <%= 1.day.ago.to_s(:db) %>
5
+ updated_at:
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: 63
4
+ hash: 61
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 2
10
- version: 0.9.2
9
+ - 3
10
+ version: 0.9.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Grant Ammons
@@ -82,12 +82,15 @@ extra_rdoc_files:
82
82
  - History.txt
83
83
  - Manifest.txt
84
84
  files:
85
+ - Gemfile
86
+ - Gemfile.lock
85
87
  - History.txt
86
88
  - Manifest.txt
87
89
  - README.rdoc
88
90
  - Rakefile
89
91
  - fake_arel.gemspec
90
92
  - lib/fake_arel.rb
93
+ - lib/fake_arel/calculations.rb
91
94
  - lib/fake_arel/extensions.rb
92
95
  - lib/fake_arel/rails_3_finders.rb
93
96
  - lib/fake_arel/singleton_class.rb
@@ -96,6 +99,8 @@ files:
96
99
  - script/destroy
97
100
  - script/generate
98
101
  - spec/fake_arel_spec.rb
102
+ - spec/fixtures/author.rb
103
+ - spec/fixtures/authors.yml
99
104
  - spec/fixtures/replies.yml
100
105
  - spec/fixtures/reply.rb
101
106
  - spec/fixtures/schema.rb