formtastic 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +69 -12
- data/Rakefile +1 -1
- data/generators/form/templates/view__form.html.erb +2 -2
- data/generators/form/templates/view__form.html.haml +2 -2
- data/generators/formtastic/templates/formtastic.css +58 -50
- data/generators/formtastic/templates/formtastic.rb +3 -0
- data/generators/formtastic/templates/formtastic_changes.css +5 -1
- data/lib/formtastic.rb +108 -37
- data/lib/formtastic/layout_helper.rb +10 -0
- data/rails/init.rb +2 -0
- data/spec/commit_button_spec.rb +26 -4
- data/spec/custom_macros.rb +0 -101
- data/spec/form_helper_spec.rb +6 -0
- data/spec/input_spec.rb +34 -0
- data/spec/inputs/boolean_input_spec.rb +9 -5
- data/spec/inputs/check_boxes_input_spec.rb +33 -10
- data/spec/inputs/date_input_spec.rb +137 -25
- data/spec/inputs/datetime_input_spec.rb +177 -54
- data/spec/inputs/hidden_input_spec.rb +9 -0
- data/spec/inputs/radio_input_spec.rb +15 -9
- data/spec/inputs/select_input_spec.rb +113 -83
- data/spec/inputs/time_input_spec.rb +151 -25
- data/spec/inputs/time_zone_input_spec.rb +4 -2
- data/spec/layout_helper_spec.rb +29 -0
- data/spec/semantic_errors_spec.rb +98 -0
- data/spec/spec_helper.rb +26 -18
- metadata +50 -22
| @@ -8,37 +8,163 @@ describe 'time input' do | |
| 8 8 | 
             
              before do
         | 
| 9 9 | 
             
                @output_buffer = ''
         | 
| 10 10 | 
             
                mock_everything
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
              
         | 
| 13 | 
            +
              describe "general" do
         | 
| 14 | 
            +
                before do
         | 
| 15 | 
            +
                  output_buffer.replace ''
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                describe "without seconds" do
         | 
| 19 | 
            +
                  before do
         | 
| 20 | 
            +
                    semantic_form_for(@new_post) do |builder|
         | 
| 21 | 
            +
                      concat(builder.input(:publish_at, :as => :time))
         | 
| 22 | 
            +
                    end
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
                 
         | 
| 25 | 
            +
                  it_should_have_input_wrapper_with_class("time")
         | 
| 26 | 
            +
                  it_should_have_input_wrapper_with_id("post_publish_at_input")
         | 
| 27 | 
            +
                  it_should_have_a_nested_fieldset
         | 
| 28 | 
            +
                  it_should_apply_error_logic_for_input_type(:time)
         | 
| 29 | 
            +
                
         | 
| 30 | 
            +
                  it 'should have a legend and label with the label text inside the fieldset' do
         | 
| 31 | 
            +
                    output_buffer.should have_tag('form li.time fieldset legend.label label', /Publish at/)
         | 
| 32 | 
            +
                  end
         | 
| 33 | 
            +
                
         | 
| 34 | 
            +
                  it 'should associate the legend label with the first select' do
         | 
| 35 | 
            +
                    output_buffer.should have_tag('form li.time fieldset legend.label label[@for="post_publish_at_1i"]')
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
                
         | 
| 38 | 
            +
                  it 'should have an ordered list of two items inside the fieldset' do
         | 
| 39 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol')
         | 
| 40 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li', :count => 2)
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  it 'should have five labels for hour and minute' do
         | 
| 44 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', :count => 2)
         | 
| 45 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', /hour/i)
         | 
| 46 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', /minute/i)
         | 
| 47 | 
            +
                  end
         | 
| 11 48 |  | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 49 | 
            +
                  it 'should have two selects for hour and minute' do
         | 
| 50 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li', :count => 2)
         | 
| 51 | 
            +
                  end
         | 
| 14 52 | 
             
                end
         | 
| 15 | 
            -
              end
         | 
| 16 | 
            -
               
         | 
| 17 | 
            -
              it_should_have_input_wrapper_with_class("time")
         | 
| 18 | 
            -
              it_should_have_input_wrapper_with_id("post_publish_at_input")
         | 
| 19 | 
            -
              it_should_have_a_nested_fieldset
         | 
| 20 | 
            -
              it_should_apply_error_logic_for_input_type(:time)
         | 
| 21 53 |  | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 54 | 
            +
                describe "with seconds" do
         | 
| 55 | 
            +
                  before do
         | 
| 56 | 
            +
                    semantic_form_for(@new_post) do |builder|
         | 
| 57 | 
            +
                      concat(builder.input(:publish_at, :as => :time, :include_seconds => true))
         | 
| 58 | 
            +
                    end
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
                
         | 
| 61 | 
            +
                  it 'should have five labels for hour and minute' do
         | 
| 62 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', :count => 3)
         | 
| 63 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', /hour/i)
         | 
| 64 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', /minute/i)
         | 
| 65 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', /second/i)
         | 
| 66 | 
            +
                  end
         | 
| 25 67 |  | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
              end
         | 
| 68 | 
            +
                  it 'should have three selects for hour, minute and seconds' do
         | 
| 69 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li', :count => 3)
         | 
| 70 | 
            +
                  end
         | 
| 30 71 |  | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 72 | 
            +
                  it 'should generate a sanitized label and matching ids for attribute' do
         | 
| 73 | 
            +
                    4.upto(6) do |i|
         | 
| 74 | 
            +
                      output_buffer.should have_tag("form li fieldset ol li label[@for='post_publish_at_#{i}i']")
         | 
| 75 | 
            +
                      output_buffer.should have_tag("form li fieldset ol li #post_publish_at_#{i}i")
         | 
| 76 | 
            +
                    end
         | 
| 77 | 
            +
                  end
         | 
| 78 | 
            +
                end
         | 
| 35 79 | 
             
              end
         | 
| 36 80 |  | 
| 37 | 
            -
               | 
| 38 | 
            -
                 | 
| 81 | 
            +
              describe ':selected option' do
         | 
| 82 | 
            +
                
         | 
| 83 | 
            +
                describe "when the object has a value" do
         | 
| 84 | 
            +
                  it "should select the object value (ignoring :selected)" do
         | 
| 85 | 
            +
                    output_buffer.replace ''
         | 
| 86 | 
            +
                    @new_post.stub!(:created_at => Time.mktime(2012, 11, 30, 21, 45))
         | 
| 87 | 
            +
                    with_deprecation_silenced do 
         | 
| 88 | 
            +
                      semantic_form_for(@new_post) do |builder|
         | 
| 89 | 
            +
                        concat(builder.input(:created_at, :as => :time, :selected => Time.mktime(1999, 12, 31, 22, 59)))
         | 
| 90 | 
            +
                      end
         | 
| 91 | 
            +
                    end
         | 
| 92 | 
            +
                    output_buffer.should have_tag("form li ol li select#post_created_at_4i option[@selected]", :count => 1)
         | 
| 93 | 
            +
                    output_buffer.should have_tag("form li ol li select#post_created_at_4i option[@value='21'][@selected]", :count => 1)
         | 
| 94 | 
            +
                  end
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
                
         | 
| 97 | 
            +
                describe 'when the object has no value' do
         | 
| 98 | 
            +
                  it "should select the :selected if provided as a Time" do
         | 
| 99 | 
            +
                    output_buffer.replace ''
         | 
| 100 | 
            +
                    @new_post.stub!(:created_at => nil)
         | 
| 101 | 
            +
                    with_deprecation_silenced do
         | 
| 102 | 
            +
                      semantic_form_for(@new_post) do |builder|
         | 
| 103 | 
            +
                        concat(builder.input(:created_at, :as => :time, :selected => Time.mktime(1999, 12, 31, 22, 59)))
         | 
| 104 | 
            +
                      end
         | 
| 105 | 
            +
                    end
         | 
| 106 | 
            +
                    output_buffer.should have_tag("form li ol li select#post_created_at_4i option[@selected]", :count => 1)
         | 
| 107 | 
            +
                    output_buffer.should have_tag("form li ol li select#post_created_at_4i option[@value='22'][@selected]", :count => 1)
         | 
| 108 | 
            +
                  end
         | 
| 109 | 
            +
                  
         | 
| 110 | 
            +
                  it "should not select an option if the :selected is provided as nil" do
         | 
| 111 | 
            +
                    output_buffer.replace ''
         | 
| 112 | 
            +
                    @new_post.stub!(:created_at => nil)
         | 
| 113 | 
            +
                    with_deprecation_silenced do 
         | 
| 114 | 
            +
                      semantic_form_for(@new_post) do |builder|
         | 
| 115 | 
            +
                        concat(builder.input(:created_at, :as => :time, :selected => nil))
         | 
| 116 | 
            +
                      end
         | 
| 117 | 
            +
                    end
         | 
| 118 | 
            +
                    output_buffer.should_not have_tag("form li ol li select#post_created_at_4i option[@selected]")
         | 
| 119 | 
            +
                  end
         | 
| 120 | 
            +
                  
         | 
| 121 | 
            +
                  it "should select Time.now if a :selected is not provided" do
         | 
| 122 | 
            +
                    output_buffer.replace ''
         | 
| 123 | 
            +
                    @new_post.stub!(:created_at => nil)
         | 
| 124 | 
            +
                    semantic_form_for(@new_post) do |builder|
         | 
| 125 | 
            +
                      concat(builder.input(:created_at, :as => :time))
         | 
| 126 | 
            +
                    end
         | 
| 127 | 
            +
                    output_buffer.should have_tag("form li ol li select#post_created_at_4i option[@selected]", :count => 1)
         | 
| 128 | 
            +
                    output_buffer.should have_tag("form li ol li select#post_created_at_4i option[@value='#{Time.now.hour.to_s.rjust(2,'0')}'][@selected]", :count => 1)
         | 
| 129 | 
            +
                  end
         | 
| 130 | 
            +
                end
         | 
| 131 | 
            +
                
         | 
| 39 132 | 
             
              end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
               | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 133 | 
            +
              
         | 
| 134 | 
            +
              describe ':labels option' do
         | 
| 135 | 
            +
                fields = [:hour, :minute, :second]
         | 
| 136 | 
            +
                fields.each do |field|
         | 
| 137 | 
            +
                  it "should replace the #{field} label with the specified text if :labels[:#{field}] is set" do
         | 
| 138 | 
            +
                    output_buffer.replace ''
         | 
| 139 | 
            +
                    semantic_form_for(@new_post) do |builder|
         | 
| 140 | 
            +
                      concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => "another #{field} label" }))
         | 
| 141 | 
            +
                    end
         | 
| 142 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', :count => fields.length)
         | 
| 143 | 
            +
                    fields.each do |f|
         | 
| 144 | 
            +
                      output_buffer.should have_tag('form li.time fieldset ol li label', f == field ? /another #{f} label/i : /#{f}/i)
         | 
| 145 | 
            +
                    end
         | 
| 146 | 
            +
                  end
         | 
| 147 | 
            +
              
         | 
| 148 | 
            +
                  it "should not display the label for the #{field} field when :labels[:#{field}] is blank" do
         | 
| 149 | 
            +
                    output_buffer.replace ''
         | 
| 150 | 
            +
                    semantic_form_for(@new_post) do |builder|
         | 
| 151 | 
            +
                      concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => "" }))
         | 
| 152 | 
            +
                    end
         | 
| 153 | 
            +
                    output_buffer.should have_tag('form li.time fieldset ol li label', :count => fields.length-1)
         | 
| 154 | 
            +
                    fields.each do |f|
         | 
| 155 | 
            +
                      output_buffer.should have_tag('form li.time fieldset ol li label', /#{f}/i) unless field == f
         | 
| 156 | 
            +
                    end
         | 
| 157 | 
            +
                  end
         | 
| 158 | 
            +
                end
         | 
| 159 | 
            +
              end
         | 
| 160 | 
            +
              
         | 
| 161 | 
            +
              it 'should warn about :selected deprecation' do
         | 
| 162 | 
            +
                with_deprecation_silenced do
         | 
| 163 | 
            +
                  ::ActiveSupport::Deprecation.should_receive(:warn).any_number_of_times
         | 
| 164 | 
            +
                  semantic_form_for(@new_post) do |builder|
         | 
| 165 | 
            +
                    concat(builder.input(:created_at, :as => :time, :selected => Time.mktime(1999)))
         | 
| 166 | 
            +
                  end
         | 
| 167 | 
            +
                end
         | 
| 168 | 
            +
              end
         | 
| 169 | 
            +
              
         | 
| 44 170 | 
             
            end
         | 
| @@ -85,8 +85,10 @@ describe 'time_zone input' do | |
| 85 85 | 
             
                    # @new_post.stub!(:time_zone).and_return('Stockholm')
         | 
| 86 86 | 
             
                    @new_post.stub!(:time_zone).and_return(nil)
         | 
| 87 87 |  | 
| 88 | 
            -
                     | 
| 89 | 
            -
                       | 
| 88 | 
            +
                    with_deprecation_silenced do
         | 
| 89 | 
            +
                      semantic_form_for(@new_post) do |builder|
         | 
| 90 | 
            +
                        concat(builder.input(:time_zone, :as => :time_zone, :selected => 'Melbourne'))
         | 
| 91 | 
            +
                      end
         | 
| 90 92 | 
             
                    end
         | 
| 91 93 | 
             
                  end
         | 
| 92 94 |  | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            require File.dirname(__FILE__) + '/spec_helper'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe 'LayoutHelper' do
         | 
| 5 | 
            +
              
         | 
| 6 | 
            +
              include FormtasticSpecHelper
         | 
| 7 | 
            +
              include Formtastic::LayoutHelper
         | 
| 8 | 
            +
              
         | 
| 9 | 
            +
              before do
         | 
| 10 | 
            +
                @output_buffer = ''
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
              
         | 
| 13 | 
            +
              describe '#formtastic_stylesheet_link_tag' do
         | 
| 14 | 
            +
                
         | 
| 15 | 
            +
                before do
         | 
| 16 | 
            +
                  concat(formtastic_stylesheet_link_tag())
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
                
         | 
| 19 | 
            +
                it 'should render a link to formtastic.css' do
         | 
| 20 | 
            +
                  output_buffer.should have_tag("link[@href='/stylesheets/formtastic.css']")
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
                
         | 
| 23 | 
            +
                it 'should render a link to formtastic_changes.css' do
         | 
| 24 | 
            +
                  output_buffer.should have_tag("link[@href='/stylesheets/formtastic_changes.css']")
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
                
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| @@ -0,0 +1,98 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            require File.dirname(__FILE__) + '/spec_helper'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe 'SemanticFormBuilder#semantic_errors' do
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              include FormtasticSpecHelper
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              before do
         | 
| 9 | 
            +
                @output_buffer = ''
         | 
| 10 | 
            +
                mock_everything
         | 
| 11 | 
            +
                @title_errors = ['must not be blank', 'must be awesome']
         | 
| 12 | 
            +
                @base_errors = ['base error message', 'nasty error']
         | 
| 13 | 
            +
                @base_error = 'one base error'
         | 
| 14 | 
            +
                @errors = mock('errors')
         | 
| 15 | 
            +
                @new_post.stub!(:errors).and_return(@errors)
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              describe 'when there is only one error on base' do
         | 
| 19 | 
            +
                before do
         | 
| 20 | 
            +
                  @errors.stub!(:on_base).and_return(@base_error)
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                it 'should render an unordered list' do
         | 
| 24 | 
            +
                  semantic_form_for(@new_post) do |builder|
         | 
| 25 | 
            +
                    builder.semantic_errors.should have_tag('ul.errors li', @base_error)
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              describe 'when there is more than one error on base' do
         | 
| 31 | 
            +
                before do
         | 
| 32 | 
            +
                  @errors.stub!(:on_base).and_return(@base_errors)
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                it 'should render an unordered list' do
         | 
| 36 | 
            +
                  semantic_form_for(@new_post) do |builder|
         | 
| 37 | 
            +
                    builder.semantic_errors.should have_tag('ul.errors')
         | 
| 38 | 
            +
                    @base_errors.each do |error|
         | 
| 39 | 
            +
                      builder.semantic_errors.should have_tag('ul.errors li', error)
         | 
| 40 | 
            +
                    end
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
              describe 'when there are errors on title' do
         | 
| 46 | 
            +
                before do
         | 
| 47 | 
            +
                  @errors.stub!(:[]).with(:title).and_return(@title_errors)
         | 
| 48 | 
            +
                  @errors.stub!(:on_base).and_return([])
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                it 'should render an unordered list' do
         | 
| 52 | 
            +
                  semantic_form_for(@new_post) do |builder|
         | 
| 53 | 
            +
                    title_name = builder.send(:localized_string, :title, :title, :label) || builder.send(:humanized_attribute_name, :title)
         | 
| 54 | 
            +
                    builder.semantic_errors(:title).should have_tag('ul.errors li', title_name << " " << @title_errors.to_sentence)
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
              end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
              describe 'when there are errors on title and base' do
         | 
| 60 | 
            +
                before do
         | 
| 61 | 
            +
                  @errors.stub!(:[]).with(:title).and_return(@title_errors)
         | 
| 62 | 
            +
                  @errors.stub!(:on_base).and_return(@base_error)
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                it 'should render an unordered list' do
         | 
| 66 | 
            +
                  semantic_form_for(@new_post) do |builder|
         | 
| 67 | 
            +
                    title_name = builder.send(:localized_string, :title, :title, :label) || builder.send(:humanized_attribute_name, :title)
         | 
| 68 | 
            +
                    builder.semantic_errors(:title).should have_tag('ul.errors li', title_name << " " << @title_errors.to_sentence)
         | 
| 69 | 
            +
                    builder.semantic_errors(:title).should have_tag('ul.errors li', @base_error)
         | 
| 70 | 
            +
                  end
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
              end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
              describe 'when there are no errors' do
         | 
| 75 | 
            +
                before do
         | 
| 76 | 
            +
                  @errors.stub!(:[]).with(:title).and_return(nil)
         | 
| 77 | 
            +
                  @errors.stub!(:on_base).and_return(nil)
         | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                it 'should return nil' do
         | 
| 81 | 
            +
                  semantic_form_for(@new_post) do |builder|
         | 
| 82 | 
            +
                    builder.semantic_errors(:title).should be_nil
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
                end
         | 
| 85 | 
            +
              end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
              describe 'when there is one error on base and options with class is passed' do
         | 
| 88 | 
            +
                before do
         | 
| 89 | 
            +
                  @errors.stub!(:on_base).and_return(@base_error)
         | 
| 90 | 
            +
                end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                it 'should render an unordered list with given class' do
         | 
| 93 | 
            +
                  semantic_form_for(@new_post) do |builder|
         | 
| 94 | 
            +
                    builder.semantic_errors(:class => "awesome").should have_tag('ul.awesome li', @base_error)
         | 
| 95 | 
            +
                  end
         | 
| 96 | 
            +
                end
         | 
| 97 | 
            +
              end
         | 
| 98 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,24 +1,18 @@ | |
| 1 1 | 
             
            # coding: utf-8
         | 
| 2 2 | 
             
            require 'rubygems'
         | 
| 3 3 |  | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
            smart_require false, 'rspec-rails', '>= 1.2.6'
         | 
| 17 | 
            -
            smart_require 'hpricot', 'hpricot', '>= 0.6.1'
         | 
| 18 | 
            -
            smart_require 'rspec_tag_matchers', 'rspec_tag_matchers', '>= 1.0.0'
         | 
| 19 | 
            -
            smart_require 'active_support', 'activesupport', '>= 2.3.4'
         | 
| 20 | 
            -
            smart_require 'action_controller', 'actionpack', '>= 2.3.4'
         | 
| 21 | 
            -
            smart_require 'action_view', 'actionpack', '>= 2.3.4'
         | 
| 4 | 
            +
            gem 'activesupport', '2.3.5'
         | 
| 5 | 
            +
            gem 'actionpack', '2.3.5'
         | 
| 6 | 
            +
            require 'active_support'
         | 
| 7 | 
            +
            require 'action_pack'
         | 
| 8 | 
            +
            require 'action_view'
         | 
| 9 | 
            +
            require 'action_controller'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            gem 'rspec', '>= 1.2.6'
         | 
| 12 | 
            +
            gem 'rspec-rails', '>= 1.2.6'
         | 
| 13 | 
            +
            gem 'hpricot', '>= 0.6.1'
         | 
| 14 | 
            +
            gem 'rspec_tag_matchers', '>= 1.0.0'
         | 
| 15 | 
            +
            require 'rspec_tag_matchers'
         | 
| 22 16 |  | 
| 23 17 | 
             
            require 'custom_macros'
         | 
| 24 18 |  | 
| @@ -28,6 +22,7 @@ Spec::Runner.configure do |config| | |
| 28 22 | 
             
            end
         | 
| 29 23 |  | 
| 30 24 | 
             
            require File.expand_path(File.join(File.dirname(__FILE__), '../lib/formtastic'))
         | 
| 25 | 
            +
            require File.expand_path(File.join(File.dirname(__FILE__), '../lib/formtastic/layout_helper'))
         | 
| 31 26 |  | 
| 32 27 |  | 
| 33 28 | 
             
            module FormtasticSpecHelper
         | 
| @@ -41,6 +36,7 @@ module FormtasticSpecHelper | |
| 41 36 | 
             
              include ActionView::Helpers::RecordIdentificationHelper
         | 
| 42 37 | 
             
              include ActionView::Helpers::DateHelper
         | 
| 43 38 | 
             
              include ActionView::Helpers::CaptureHelper
         | 
| 39 | 
            +
              include ActionView::Helpers::AssetTagHelper
         | 
| 44 40 | 
             
              include ActiveSupport
         | 
| 45 41 | 
             
              include ActionController::PolymorphicRoutes
         | 
| 46 42 |  | 
| @@ -61,6 +57,12 @@ module FormtasticSpecHelper | |
| 61 57 | 
             
                def id
         | 
| 62 58 | 
             
                end
         | 
| 63 59 | 
             
              end
         | 
| 60 | 
            +
              module ::Namespaced
         | 
| 61 | 
            +
                class Post
         | 
| 62 | 
            +
                  def id
         | 
| 63 | 
            +
                  end
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
              end
         | 
| 64 66 | 
             
              class ::Author
         | 
| 65 67 | 
             
                def to_label
         | 
| 66 68 | 
             
                end
         | 
| @@ -207,6 +209,12 @@ module FormtasticSpecHelper | |
| 207 209 | 
             
                ::Formtastic::SemanticFormBuilder.send(:"#{config_method_name}=", old_value)
         | 
| 208 210 | 
             
              end
         | 
| 209 211 |  | 
| 212 | 
            +
              def with_deprecation_silenced(&block)
         | 
| 213 | 
            +
                ::ActiveSupport::Deprecation.silenced = true
         | 
| 214 | 
            +
                yield
         | 
| 215 | 
            +
                ::ActiveSupport::Deprecation.silenced = false
         | 
| 216 | 
            +
              end
         | 
| 217 | 
            +
              
         | 
| 210 218 | 
             
            end
         | 
| 211 219 |  | 
| 212 220 | 
             
            ::ActiveSupport::Deprecation.silenced = false
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,12 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: formtastic
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
               | 
| 4 | 
            +
              prerelease: false
         | 
| 5 | 
            +
              segments: 
         | 
| 6 | 
            +
              - 0
         | 
| 7 | 
            +
              - 9
         | 
| 8 | 
            +
              - 8
         | 
| 9 | 
            +
              version: 0.9.8
         | 
| 5 10 | 
             
            platform: ruby
         | 
| 6 11 | 
             
            authors: 
         | 
| 7 12 | 
             
            - Justin French
         | 
| @@ -9,49 +14,65 @@ autorequire: | |
| 9 14 | 
             
            bindir: bin
         | 
| 10 15 | 
             
            cert_chain: []
         | 
| 11 16 |  | 
| 12 | 
            -
            date:  | 
| 17 | 
            +
            date: 2010-03-31 00:00:00 +11:00
         | 
| 13 18 | 
             
            default_executable: 
         | 
| 14 19 | 
             
            dependencies: 
         | 
| 15 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 16 21 | 
             
              name: activesupport
         | 
| 17 | 
            -
               | 
| 18 | 
            -
               | 
| 19 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 22 | 
            +
              prerelease: false
         | 
| 23 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 20 24 | 
             
                requirements: 
         | 
| 21 25 | 
             
                - - ">="
         | 
| 22 26 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 27 | 
            +
                    segments: 
         | 
| 28 | 
            +
                    - 2
         | 
| 29 | 
            +
                    - 3
         | 
| 30 | 
            +
                    - 0
         | 
| 23 31 | 
             
                    version: 2.3.0
         | 
| 24 | 
            -
             | 
| 32 | 
            +
              type: :runtime
         | 
| 33 | 
            +
              version_requirements: *id001
         | 
| 25 34 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 26 35 | 
             
              name: actionpack
         | 
| 27 | 
            -
               | 
| 28 | 
            -
               | 
| 29 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 36 | 
            +
              prerelease: false
         | 
| 37 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 30 38 | 
             
                requirements: 
         | 
| 31 39 | 
             
                - - ">="
         | 
| 32 40 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 41 | 
            +
                    segments: 
         | 
| 42 | 
            +
                    - 2
         | 
| 43 | 
            +
                    - 3
         | 
| 44 | 
            +
                    - 0
         | 
| 33 45 | 
             
                    version: 2.3.0
         | 
| 34 | 
            -
             | 
| 46 | 
            +
              type: :runtime
         | 
| 47 | 
            +
              version_requirements: *id002
         | 
| 35 48 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 36 49 | 
             
              name: rspec-rails
         | 
| 37 | 
            -
               | 
| 38 | 
            -
               | 
| 39 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 50 | 
            +
              prerelease: false
         | 
| 51 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 40 52 | 
             
                requirements: 
         | 
| 41 53 | 
             
                - - ">="
         | 
| 42 54 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 55 | 
            +
                    segments: 
         | 
| 56 | 
            +
                    - 1
         | 
| 57 | 
            +
                    - 2
         | 
| 58 | 
            +
                    - 6
         | 
| 43 59 | 
             
                    version: 1.2.6
         | 
| 44 | 
            -
             | 
| 60 | 
            +
              type: :development
         | 
| 61 | 
            +
              version_requirements: *id003
         | 
| 45 62 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 46 63 | 
             
              name: rspec_tag_matchers
         | 
| 47 | 
            -
               | 
| 48 | 
            -
               | 
| 49 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 64 | 
            +
              prerelease: false
         | 
| 65 | 
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 50 66 | 
             
                requirements: 
         | 
| 51 67 | 
             
                - - ">="
         | 
| 52 68 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 69 | 
            +
                    segments: 
         | 
| 70 | 
            +
                    - 1
         | 
| 71 | 
            +
                    - 0
         | 
| 72 | 
            +
                    - 0
         | 
| 53 73 | 
             
                    version: 1.0.0
         | 
| 54 | 
            -
             | 
| 74 | 
            +
              type: :development
         | 
| 75 | 
            +
              version_requirements: *id004
         | 
| 55 76 | 
             
            description: A Rails form builder plugin/gem with semantically rich and accessible markup
         | 
| 56 77 | 
             
            email: justin@indent.com.au
         | 
| 57 78 | 
             
            executables: []
         | 
| @@ -75,6 +96,7 @@ files: | |
| 75 96 | 
             
            - generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb
         | 
| 76 97 | 
             
            - lib/formtastic.rb
         | 
| 77 98 | 
             
            - lib/formtastic/i18n.rb
         | 
| 99 | 
            +
            - lib/formtastic/layout_helper.rb
         | 
| 78 100 | 
             
            - lib/locale/en.yml
         | 
| 79 101 | 
             
            - rails/init.rb
         | 
| 80 102 | 
             
            - spec/buttons_spec.rb
         | 
| @@ -105,6 +127,8 @@ files: | |
| 105 127 | 
             
            - spec/inputs/time_zone_input_spec.rb
         | 
| 106 128 | 
             
            - spec/inputs_spec.rb
         | 
| 107 129 | 
             
            - spec/label_spec.rb
         | 
| 130 | 
            +
            - spec/layout_helper_spec.rb
         | 
| 131 | 
            +
            - spec/semantic_errors_spec.rb
         | 
| 108 132 | 
             
            - spec/semantic_fields_for_spec.rb
         | 
| 109 133 | 
             
            - spec/spec.opts
         | 
| 110 134 | 
             
            - spec/spec_helper.rb
         | 
| @@ -112,7 +136,7 @@ has_rdoc: true | |
| 112 136 | 
             
            homepage: http://github.com/justinfrench/formtastic/tree/master
         | 
| 113 137 | 
             
            licenses: []
         | 
| 114 138 |  | 
| 115 | 
            -
            post_install_message: "\n  ========================================================================\n  Thanks for installing Formtastic!\n  ------------------------------------------------------------------------\n  You can now (optionally) run the generator to copy some stylesheets and\n  a config initializer into your application:\n    ./script/generate formtastic\n\n  To generate some semantic form markup for your  | 
| 139 | 
            +
            post_install_message: "\n  ========================================================================\n  Thanks for installing Formtastic!\n  ------------------------------------------------------------------------\n  You can now (optionally) run the generator to copy some stylesheets and\n  a config initializer into your application:\n    ./script/generate formtastic\n\n  To generate some semantic form markup for your existing models, just run:\n    ./script/generate form MODEL_NAME\n\n  Find out more and get involved:\n    http://github.com/justinfrench/formtastic\n    http://groups.google.com.au/group/formtastic\n  ========================================================================\n  "
         | 
| 116 140 | 
             
            rdoc_options: 
         | 
| 117 141 | 
             
            - --charset=UTF-8
         | 
| 118 142 | 
             
            require_paths: 
         | 
| @@ -121,18 +145,20 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 121 145 | 
             
              requirements: 
         | 
| 122 146 | 
             
              - - ">="
         | 
| 123 147 | 
             
                - !ruby/object:Gem::Version 
         | 
| 148 | 
            +
                  segments: 
         | 
| 149 | 
            +
                  - 0
         | 
| 124 150 | 
             
                  version: "0"
         | 
| 125 | 
            -
              version: 
         | 
| 126 151 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 127 152 | 
             
              requirements: 
         | 
| 128 153 | 
             
              - - ">="
         | 
| 129 154 | 
             
                - !ruby/object:Gem::Version 
         | 
| 155 | 
            +
                  segments: 
         | 
| 156 | 
            +
                  - 0
         | 
| 130 157 | 
             
                  version: "0"
         | 
| 131 | 
            -
              version: 
         | 
| 132 158 | 
             
            requirements: []
         | 
| 133 159 |  | 
| 134 160 | 
             
            rubyforge_project: 
         | 
| 135 | 
            -
            rubygems_version: 1.3. | 
| 161 | 
            +
            rubygems_version: 1.3.6
         | 
| 136 162 | 
             
            signing_key: 
         | 
| 137 163 | 
             
            specification_version: 3
         | 
| 138 164 | 
             
            summary: A Rails form builder plugin/gem with semantically rich and accessible markup
         | 
| @@ -165,5 +191,7 @@ test_files: | |
| 165 191 | 
             
            - spec/inputs/time_zone_input_spec.rb
         | 
| 166 192 | 
             
            - spec/inputs_spec.rb
         | 
| 167 193 | 
             
            - spec/label_spec.rb
         | 
| 194 | 
            +
            - spec/layout_helper_spec.rb
         | 
| 195 | 
            +
            - spec/semantic_errors_spec.rb
         | 
| 168 196 | 
             
            - spec/semantic_fields_for_spec.rb
         | 
| 169 197 | 
             
            - spec/spec_helper.rb
         |