Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

quick spec for has_one coverage in select input

  • Loading branch information...
commit 9c20e67fec9edb96e6e1d50119cc43ee9c4525ae 1 parent 7bfdb01
@justinfrench authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 spec/inputs/select_input_spec.rb
View
19 spec/inputs/select_input_spec.rb
@@ -316,7 +316,26 @@
end
end
end
+
+ describe 'for a has_one association' do
+ before do
+ ::Post.stub!(:reflect_on_association).with(:author).and_return do
+ mock = mock('reflection', :options => {}, :klass => ::Author, :macro => :has_one)
+ mock
+ end
+ end
+ it "should render some Authors as options" do
+ concat(semantic_form_for(@new_post) do |builder|
+ concat(builder.input(:author, :as => :select))
+ end)
+ output_buffer.should have_tag("li#post_author_input")
+ output_buffer.should have_tag("label", /Author/)
+ output_buffer.should have_tag("select[name='post[author_id]']")
+ output_buffer.should have_tag("select option", "Fred Smith")
+ end
+ end
+
describe 'for a has_many association' do
before do
concat(semantic_form_for(@fred) do |builder|
Please sign in to comment.
Something went wrong with that request. Please try again.