Permalink
Browse files

No need for output_buffer.concat(form) any more now that we're only s…

…upporting the Rails 3 block styles.
  • Loading branch information...
justinfrench committed Jan 14, 2011
1 parent dc5857b commit 39470eeaad84d2c5af919d2c940da7de74808422
View
@@ -13,31 +13,27 @@
describe 'with a block' do
describe 'when no options are provided' do
before do
- @form = semantic_form_for(@new_post) do |builder|
+ concat(semantic_form_for(@new_post) do |builder|
buttons = builder.buttons do
concat('hello')
end
concat(buttons)
- end
+ end)
end
it 'should render a fieldset inside the form, with a class of "inputs"' do
- output_buffer.concat(@form)
output_buffer.should have_tag("form fieldset.buttons")
end
it 'should render an ol inside the fieldset' do
- output_buffer.concat(@form)
output_buffer.should have_tag("form fieldset.buttons ol")
end
it 'should render the contents of the block inside the ol' do
- output_buffer.concat(@form)
output_buffer.should have_tag("form fieldset.buttons ol", /hello/)
end
it 'should not render a legend inside the fieldset' do
- output_buffer.concat(@form)
output_buffer.should_not have_tag("form fieldset.buttons legend")
end
end
@@ -46,13 +42,12 @@
before do
@legend_text = "Advanced options"
- @form = semantic_form_for(@new_post) do |builder|
+ concat(semantic_form_for(@new_post) do |builder|
builder.buttons :name => @legend_text do
end
- end
+ end)
end
it 'should render a fieldset inside the form' do
- output_buffer.concat(@form)
output_buffer.should have_tag("form fieldset legend", /#{@legend_text}/)
end
end
@@ -62,13 +57,12 @@
@id_option = 'advanced'
@class_option = 'wide'
- @form = semantic_form_for(@new_post) do |builder|
+ concat(semantic_form_for(@new_post) do |builder|
builder.buttons :id => @id_option, :class => @class_option do
end
- end
+ end)
end
it 'should pass the options into the fieldset tag as attributes' do
- output_buffer.concat(@form)
output_buffer.should have_tag("form fieldset##{@id_option}")
output_buffer.should have_tag("form fieldset.#{@class_option}")
end
@@ -81,38 +75,32 @@
describe 'with no args (default buttons)' do
before do
- @form = semantic_form_for(@new_post) do |builder|
+ concat(semantic_form_for(@new_post) do |builder|
concat(builder.buttons)
- end
+ end)
end
it 'should render a form' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form')
end
it 'should render a buttons fieldset inside the form' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form fieldset.buttons')
end
it 'should not render a legend in the fieldset' do
- output_buffer.concat(@form)
output_buffer.should_not have_tag('form fieldset.buttons legend')
end
it 'should render an ol in the fieldset' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form fieldset.buttons ol')
end
it 'should render a list item in the ol for each default button' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form fieldset.buttons ol li', :count => 1)
end
it 'should render a commit list item for the commit button' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form fieldset.buttons ol li.commit')
end
@@ -121,13 +109,12 @@
describe 'with button names as args' do
before do
- @form = semantic_form_for(@new_post) do |builder|
+ concat(semantic_form_for(@new_post) do |builder|
concat(builder.buttons(:commit))
- end
+ end)
end
it 'should render a form with a fieldset containing a list item for each button arg' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form > fieldset.buttons > ol > li', :count => 1)
output_buffer.should have_tag('form > fieldset.buttons > ol > li.commit')
end
@@ -137,24 +124,21 @@
describe 'with button names as args and an options hash' do
before do
- @form = semantic_form_for(@new_post) do |builder|
+ concat(semantic_form_for(@new_post) do |builder|
concat(builder.buttons(:commit, :name => "Now click a button", :id => "my-id"))
- end
+ end)
end
it 'should render a form with a fieldset containing a list item for each button arg' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form > fieldset.buttons > ol > li', :count => 1)
output_buffer.should have_tag('form > fieldset.buttons > ol > li.commit', :count => 1)
end
it 'should pass the options down to the fieldset' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form > fieldset#my-id.buttons')
end
it 'should use the special :name option as a text for the legend tag' do
- output_buffer.concat(@form)
output_buffer.should have_tag('form > fieldset#my-id.buttons > legend', /Now click a button/)
end
Oops, something went wrong.

0 comments on commit 39470ee

Please sign in to comment.