has_finder 0.1.2 → 0.1.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.
@@ -2,11 +2,19 @@ socrates:
2
2
  id: 1
3
3
  country: greece
4
4
  race: mortal
5
+ type:
5
6
  xerxes:
6
7
  id: 2
7
8
  country: persia
8
9
  race: mortal
10
+ type:
9
11
  zeus:
10
12
  id: 3
11
13
  country: greece
12
- race: divine
14
+ race: divine
15
+ type:
16
+ monkey:
17
+ id: 4
18
+ country: africa
19
+ race:
20
+ type: BeingSubclass
@@ -24,6 +24,9 @@ class Being < ActiveRecord::Base
24
24
  end
25
25
  end
26
26
 
27
+ class BeingSubclass < Being
28
+ end
29
+
27
30
  class Property < ActiveRecord::Base
28
31
  has_finder :starts_with, lambda {|l| { :conditions => "name LIKE '#{l}%'" } }
29
32
  end
@@ -51,12 +54,18 @@ describe Being, 'method missing' do
51
54
  end
52
55
  end
53
56
 
57
+ describe BeingSubclass do
58
+ it "should inherit has_finders from superclass" do
59
+ BeingSubclass.all.find(:all).should == BeingSubclass.find(:all)
60
+ end
61
+ end
62
+
54
63
  describe Being, 'has_finder with options' do
55
64
  it "should scope basic finding to active record messages to the supplied options" do
56
65
  Being.greeks.should == [beings(:socrates), beings(:zeus)]
57
66
  Being.mortals.should == [beings(:socrates), beings(:xerxes)]
58
67
  end
59
-
68
+
60
69
  it "should scope all active record messages" do
61
70
  Being.greeks.find(:first).should == beings(:socrates)
62
71
  end
@@ -68,7 +77,7 @@ end
68
77
 
69
78
  describe Being, 'has_finder with procedural options' do
70
79
  it "should use evaluated procedure as the scope options" do
71
- Being.located_in('greece').should == [beings(:socrates), beings(:zeus)]
80
+ Being.located_in('greece').should == [beings(:socrates), beings(:zeus)]
72
81
  Being.located_in('greece').find(:first).should == beings(:socrates)
73
82
  end
74
83
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: has_finder
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.2
7
- date: 2007-09-02 00:00:00 -07:00
6
+ version: 0.1.3
7
+ date: 2007-09-10 00:00:00 -07:00
8
8
  summary: description of gem
9
9
  require_paths:
10
10
  - lib