Permalink
Browse files

added test case for model that has 2 belongs_to fields pointing to sa…

…me class one specifiying class_name in options
  • Loading branch information...
1 parent a745de3 commit 74eaf337ac63b32d59bb24a1a6486fd893e60724 @gpetrica gpetrica committed Apr 26, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 spec/spec_helper.rb
View
@@ -149,9 +149,13 @@ def new_author_path; "/authors/new"; end
::Post.stub!(:reflect_on_validations_for).and_return([])
::Post.stub!(:reflect_on_association).and_return do |column_name|
case column_name
- when :author, :author_status, :reviewer
+ when :author, :author_status
mock = mock('reflection', :options => {}, :klass => ::Author, :macro => :belongs_to)
mock.stub!(:[]).with(:class_name).and_return("Author")
+ mock
+ when :reviewer
+ mock = mock('reflection', :options => {:class_name => 'Author'}, :klass => ::Author, :macro => :belongs_to)
+ mock.stub!(:[]).with(:class_name).and_return("Author")
mock
when :authors
mock('reflection', :options => {}, :klass => ::Author, :macro => :has_and_belongs_to_many)

0 comments on commit 74eaf33

Please sign in to comment.