fauxsql 0.2.1 → 0.2.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/fauxsql.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fauxsql}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Collin Miller"]
data/lib/fauxsql.rb CHANGED
@@ -100,4 +100,8 @@ module Fauxsql
100
100
  value
101
101
  end
102
102
 
103
+ def fauxsql_nested_classes(attribute_name)
104
+ # Find a list of the nested classes that an attribute has and return them as a list
105
+ self.class.fauxsql_options[attribute_name][:nest] # provides a list of classes
106
+ end
103
107
  end
data/lib/fauxsql/dsl.rb CHANGED
@@ -108,6 +108,7 @@ EORUBY
108
108
 
109
109
  def normalize_options!(options)
110
110
  options[:nest] = [options[:nest]] if options[:nest] unless options[:nest].is_a?(Array)
111
+ options[:nest] ||= []
111
112
  options.freeze
112
113
  end
113
114
 
data/test/test_fauxsql.rb CHANGED
@@ -217,6 +217,15 @@ class TestFauxsql < Test::Unit::TestCase
217
217
  end
218
218
 
219
219
  context "with :nested => *" do
220
+
221
+ should "allow reflection on nested classes" do
222
+ assert_equal [FauxObject], @faux.fauxsql_nested_classes(:things)
223
+ end
224
+
225
+ should "allow reflection on nested classes when there are none" do
226
+ assert_equal [], @faux.fauxsql_nested_classes(:number)
227
+ end
228
+
220
229
  context "on a map" do
221
230
  should "accept nested attributes" do
222
231
  other = FauxObject.create
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Collin Miller