ianwhite-pickle 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.1.9 - 29 Jan 2009
2
+
3
+ * 1 minor enhancement
4
+ * Pickle::Adapter.model_classes excludes those without tables
5
+
6
+
1
7
  == 0.1.8 - 29 Jan 2009
2
8
 
3
9
  * API change
@@ -23,9 +23,9 @@ module Pickle
23
23
  self.model_classes = nil
24
24
 
25
25
  def self.model_classes
26
- # remove abstract and framework classes
26
+ # remove abstract, framework, and non-table classes
27
27
  @@model_classes ||= ::ActiveRecord::Base.send(:subclasses).reject do |klass|
28
- klass.abstract_class? ||
28
+ klass.abstract_class? || !klass.table_exists? ||
29
29
  (defined?(CGI::Session::ActiveRecordStore::Session) && klass == CGI::Session::ActiveRecordStore::Session) ||
30
30
  (defined?(::ActiveRecord::SessionStore::Session) && klass == ::ActiveRecord::SessionStore::Session)
31
31
  end
@@ -2,7 +2,7 @@ module Pickle
2
2
  module Version
3
3
  Major = 0
4
4
  Minor = 1
5
- Tiny = 8
5
+ Tiny = 9
6
6
 
7
7
  String = [Major, Minor, Tiny].join('.')
8
8
  end
@@ -9,15 +9,32 @@ describe Pickle::Adapter do
9
9
  lambda{ Pickle::Adapter.new.create }.should raise_error(NotImplementedError)
10
10
  end
11
11
 
12
- if defined?(CGI::Session::ActiveRecordStore::Session)
13
- it ".model_classes should not include CGI::Session::ActiveRecordStore::Session" do
14
- Pickle::Adapter.model_classes.should_not include(CGI::Session::ActiveRecordStore)
12
+ describe ".model_classes" do
13
+ before do
14
+ Pickle::Adapter.model_classes = nil
15
+ end
16
+
17
+ if defined?(CGI::Session::ActiveRecordStore::Session)
18
+ it "should not include CGI::Session::ActiveRecordStore::Session" do
19
+ Pickle::Adapter.model_classes.should_not include(CGI::Session::ActiveRecordStore)
20
+ end
15
21
  end
16
- end
17
22
 
18
- if defined?(ActiveRecord::SessionStore::Session)
19
- it ".model_classes should not include ActiveRecord::SessionStore::Session" do
20
- Pickle::Adapter.model_classes.should_not include(ActiveRecord::SessionStore::Session)
23
+ if defined?(ActiveRecord::SessionStore::Session)
24
+ it "should not include ActiveRecord::SessionStore::Session" do
25
+ Pickle::Adapter.model_classes.should_not include(ActiveRecord::SessionStore::Session)
26
+ end
27
+ end
28
+
29
+ it "should not include classes without a table" do
30
+ klass = Class.new(ActiveRecord::Base)
31
+ Pickle::Adapter.model_classes.should_not include(klass)
32
+ end
33
+
34
+ it "should not include abstract classes without a table" do
35
+ klass = Class.new(ActiveRecord::Base)
36
+ klass.abstract_class = true
37
+ Pickle::Adapter.model_classes.should_not include(klass)
21
38
  end
22
39
  end
23
40
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ianwhite-pickle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian White