Permalink
Browse files

spec for mongoid references fix

  • Loading branch information...
1 parent a9889c5 commit fb643c7442339c675c7cf1439bc1149d35f3a97a smix committed with Feb 1, 2011
Showing with 16 additions and 0 deletions.
  1. +14 −0 spec/inputs/select_input_spec.rb
  2. +2 −0 spec/spec_helper.rb
@@ -30,6 +30,20 @@
end
end
end
+
+ describe "using a related model without reflection's options(Mongoid Document)" do
+ before do
+ @form = semantic_form_for(@new_post) do |builder|
+ concat(builder.input(:mongoid_reviewer, :as => :select))
+ end
+ end
+
+ it 'should draw select options' do
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
+ output_buffer.should have_tag('form li select')
+ output_buffer.should have_tag('form li select#post_reviewer_id')
+ end
+ end
describe 'using a range' do
before do
View
@@ -212,6 +212,8 @@ def new_author_path; "/authors/new"; end
mock('reflection', :options => {}, :klass => ::Post, :macro => :has_many)
when :main_post
mock('reflection', :options => {}, :klass => ::Post, :macro => :belongs_to)
+ when :mongoid_reviewer
+ mock('reflection', :options => {}, :klass => ::Author, :macro => :referenced_in, :foreign_key => "reviewer_id")
end
end

0 comments on commit fb643c7

Please sign in to comment.