Skip to content

Commit

Permalink
spec to expose that :multiple => true doesn't work when there's no as…
Browse files Browse the repository at this point in the history
…sociation ref #690
  • Loading branch information
justinfrench committed Sep 26, 2011
1 parent f0995e4 commit 4f6e4b9
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions spec/inputs/select_input_spec.rb
Expand Up @@ -452,17 +452,15 @@
end

describe 'when no association exists' do
before(:each) do

it 'should still generate a valid name attribute' do
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
concat(builder.input(:author_name, :as => :select, :collection => ::Author.all))
end)
end

it 'should still generate a valid name attribute' do
output_buffer.should have_tag("form li select[@name='project[author_name]']")
end

describe 'and :multiple is set to true' do
describe 'and :multiple is set to true through :input_html' do
it "should make the select a multi-select" do
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
concat(builder.input(:author_name, :as => :select, :input_html => {:multiple => true} ))
Expand All @@ -471,6 +469,15 @@
end
end

describe 'and :multiple is set to true' do
it "should make the select a multi-select" do
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
concat(builder.input(:author_name, :as => :select, :multiple => true, :collection => ["Fred", "Bob"]))
end)
output_buffer.should have_tag("form li select[@multiple]")
end
end

end

describe 'when a grouped collection collection is given' do
Expand Down

0 comments on commit 4f6e4b9

Please sign in to comment.