chaingang 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,11 +8,7 @@ module ChainGang
8
8
 
9
9
  module ClassMethods
10
10
  def find_with_chaingang(id=nil)
11
- if id
12
- find_without_chaingang id
13
- else
14
- Proxy.new self
15
- end
11
+ Proxy.new(self).tap {|p| p.single id if id}
16
12
  end
17
13
  end
18
14
  end
@@ -17,10 +17,16 @@ describe ChainGang do
17
17
  end
18
18
 
19
19
  context "when called with an argument" do
20
- it "should return the result" do
21
- Dupe.create :client, :name => 'test 1'
22
- @result = Client.find 1
23
- @result.name.should == 'test 1'
20
+ it "should return a ChainGang::Proxy" do
21
+ Client.find(1).class.should == ChainGang::Proxy
22
+ end
23
+
24
+ it "should set the @client to the calling class" do
25
+ Client.find(1).send(:value, :client).should == Client
26
+ end
27
+
28
+ it "should set @find_scope to the argument" do
29
+ Client.find(1).send(:value, :find_scope).should == 1
24
30
  end
25
31
  end
26
32
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chaingang
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Parker
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-08 00:00:00 -05:00
18
+ date: 2011-01-09 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency