Skip to content
Browse files

Rearrange Child and Parent definitions so Child is in scope when we d…

…elegate to it from Parent
  • Loading branch information...
1 parent 868124a commit 920f486935afeb28f0ce364997746a0891c2848a @simeonwillbanks simeonwillbanks committed May 2, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 spec/delegate_all_for/delegate_all_for_spec.rb
View
17 spec/delegate_all_for/delegate_all_for_spec.rb
@@ -1,7 +1,15 @@
require File.expand_path('../../spec_helper', __FILE__)
+require File.expand_path('../../support/active_record', __FILE__)
+
+class Child < ActiveRecord::Base
+ belongs_to :parent
+ #def self.column_names; %w(two three four) end
+ def two; 'child' end
+ def extra; true end
+end
class Parent < ActiveRecord::Base
- def self.column_names; %w(one two) end
+ #def self.column_names; %w(one two) end
has_one :child
delegate_all_for :child, except: [:three], also_include: [:extra]
@@ -10,13 +18,6 @@ def initialize; end
def two; 'parent' end
end
-class Child < ActiveRecord::Base
- belongs_to :parent
- def self.column_names; %w(two three four) end
- def two; 'child' end
- def extra; true end
-end
-
describe DelegateAllFor do
describe 'delegate_all_for' do
subject { Parent.new }

0 comments on commit 920f486

Please sign in to comment.
Something went wrong with that request. Please try again.