Skip to content
This repository has been archived by the owner on Oct 12, 2019. It is now read-only.

Commit

Permalink
Whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Jul 18, 2013
1 parent 4405263 commit af17687
Show file tree
Hide file tree
Showing 32 changed files with 741 additions and 741 deletions.
22 changes: 11 additions & 11 deletions spec/actions/button_action_spec.rb
Expand Up @@ -8,12 +8,12 @@
before do
@output_buffer = ''
mock_everything

concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:submit, :as => :button))
end)
end

it 'should render a submit type of button' do
output_buffer.should have_tag('button[@type="submit"].btn')
end
Expand All @@ -23,41 +23,41 @@
describe 'ButtonAction', 'when resetting' do

include FormtasticSpecHelper

before do
@output_buffer = ''
mock_everything

concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:reset, :as => :button))
end)
end

it 'should render a reset type of button' do
output_buffer.should have_tag('button[@type="reset"].btn', :text => "Reset Post")
end

it 'should not render a value attribute' do
output_buffer.should_not have_tag('button[@value].btn')
end

end

describe 'InputAction', 'when cancelling' do

include FormtasticSpecHelper

before do
@output_buffer = ''
mock_everything
end

it 'should raise an error' do
lambda {
lambda {
concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:cancel, :as => :button))
end)
}.should raise_error(Formtastic::UnsupportedMethodForAction)
end
end

end
22 changes: 11 additions & 11 deletions spec/actions/input_action_spec.rb
Expand Up @@ -8,12 +8,12 @@
before do
@output_buffer = ''
mock_everything

concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:submit, :as => :input))
end)
end

it 'should render a submit type of input' do
output_buffer.should have_tag('input[@type="submit"].btn')
end
Expand All @@ -23,37 +23,37 @@
describe 'InputAction', 'when resetting' do

include FormtasticSpecHelper

before do
@output_buffer = ''
mock_everything

concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:reset, :as => :input))
end)
end

it 'should render a reset type of input' do
output_buffer.should have_tag('input[@type="reset"].btn')
end

end

describe 'InputAction', 'when cancelling' do

include FormtasticSpecHelper

before do
@output_buffer = ''
mock_everything
end

it 'should raise an error' do
lambda {
lambda {
concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:cancel, :as => :input))
end)
}.should raise_error(Formtastic::UnsupportedMethodForAction)
end
end

end
38 changes: 19 additions & 19 deletions spec/actions/link_action_spec.rb
Expand Up @@ -9,84 +9,84 @@
@output_buffer = ''
mock_everything
end

context 'without a :url' do
before do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:cancel, :as => :link))
end)
end

it 'should render a submit type of input' do
output_buffer.should have_tag('a[@href="javascript:history.back()"].btn')
end

end

context 'with a :url as String' do

before do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:cancel, :as => :link, :url => "http://foo.bah/baz"))
end)
end

it 'should render a submit type of input' do
output_buffer.should have_tag('a[@href="http://foo.bah/baz"].btn')
end

end

context 'with a :url as Hash' do

before do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:cancel, :as => :link, :url => { :action => "foo" }))
end)
end

it 'should render a submit type of input' do
output_buffer.should have_tag('a[@href="/mock/path"].btn')
end

end

end

describe 'LinkAction', 'when submitting' do

include FormtasticSpecHelper

before do
@output_buffer = ''
mock_everything
end

it 'should raise an error' do
lambda {
lambda {
concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:submit, :as => :link))
end)
}.should raise_error(Formtastic::UnsupportedMethodForAction)
end

end

describe 'LinkAction', 'when submitting' do

include FormtasticSpecHelper

before do
@output_buffer = ''
mock_everything
end

it 'should raise an error' do
lambda {
lambda {
concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:reset, :as => :link))
end)
}.should raise_error(Formtastic::UnsupportedMethodForAction)
end
end

end
24 changes: 12 additions & 12 deletions spec/builder/semantic_fields_for_spec.rb
Expand Up @@ -27,7 +27,7 @@
nested_builder.class.should == Formtastic::Helpers::FormHelper.builder
end
end

it 'should respond to input' do
semantic_fields_for(@new_post) do |nested_builder|
nested_builder.respond_to?(:input).should be_true
Expand All @@ -43,7 +43,7 @@
end
end
end

context 'within a form_for block' do
it 'yields an instance of FormHelper.builder' do
semantic_form_for(@new_post) do |builder|
Expand All @@ -52,31 +52,31 @@
end
end
end

it 'yields an instance of FormHelper.builder with hash-like model' do
semantic_form_for(:user) do |builder|
builder.semantic_fields_for(:author, @hash_backed_author) do |nested_builder|
nested_builder.class.should == Formtastic::Helpers::FormHelper.builder
end
end
end

it 'nests the object name' do
semantic_form_for(@new_post) do |builder|
builder.semantic_fields_for(@bob) do |nested_builder|
nested_builder.object_name.should == 'post[author]'
end
end
end

it 'supports passing collection as second parameter' do
semantic_form_for(@new_post) do |builder|
builder.semantic_fields_for(:author, [@fred,@bob]) do |nested_builder|
nested_builder.object_name.should =~ /post\[author_attributes\]\[\d+\]/
end
end
end

it 'should sanitize html id for li tag' do
@bob.stub!(:column_for_attribute).and_return(mock('column', :type => :string, :limit => 255))
concat(semantic_form_for(@new_post) do |builder|
Expand All @@ -89,7 +89,7 @@
output_buffer.should_not =~ /id="post\[author\]_1_login_input"/
# <=> output_buffer.should_not have_tag('form fieldset.inputs #post[author]_1_login_input')
end

it 'should use namespace provided in nested fields' do
@bob.stub!(:column_for_attribute).and_return(mock('column', :type => :string, :limit => 255))
concat(semantic_form_for(@new_post, :namespace => 'context2') do |builder|
Expand All @@ -100,12 +100,12 @@
output_buffer.should have_tag('form fieldset.inputs #context2_post_author_1_login_input')
end
end
context "when I rendered my own hidden id input" do

context "when I rendered my own hidden id input" do

before do
output_buffer.replace ''

@fred.posts.size.should == 1
@fred.posts.first.stub!(:persisted?).and_return(true)
@fred.stub!(:posts_attributes=)
Expand All @@ -117,7 +117,7 @@
end)
end)
end

it "should only render one hidden input (my one)" do
output_buffer.should have_tag 'input#author_posts_attributes_0_id', :count => 1
end
Expand Down

0 comments on commit af17687

Please sign in to comment.