twilson63-sinatra-formhelpers 0.1.1 → 0.2.0
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/VERSION.yml +2 -2
- data/lib/sinatra/formhelpers.rb +3 -2
- data/sinatra-formhelpers.gemspec +2 -2
- data/test/formhelpers_test.rb +16 -0
- metadata +2 -2
    
        data/VERSION.yml
    CHANGED
    
    
    
        data/lib/sinatra/formhelpers.rb
    CHANGED
    
    | @@ -24,9 +24,10 @@ module Sinatra | |
| 24 24 | 
             
                  tag :label, field.to_s.titleize, options.merge(:for => "#{obj}_#{field}")
         | 
| 25 25 | 
             
                end
         | 
| 26 26 |  | 
| 27 | 
            -
                def text(obj, field, options={})
         | 
| 27 | 
            +
                def text(obj, field="", options={})
         | 
| 28 28 | 
             
                  content = @params[obj] ? @params[obj][field.to_s] : ""       
         | 
| 29 | 
            -
                   | 
| 29 | 
            +
                  id = 
         | 
| 30 | 
            +
                  single_tag :input, options.merge(:type => "text", :id => field == "" ? obj : "#{obj}_#{field}", :name => field == "" ? obj : "#{obj}[#{field}]", :value => content)
         | 
| 30 31 | 
             
                end
         | 
| 31 32 |  | 
| 32 33 | 
             
                def area(obj, field, options={})
         | 
    
        data/sinatra-formhelpers.gemspec
    CHANGED
    
    | @@ -2,11 +2,11 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Gem::Specification.new do |s|
         | 
| 4 4 | 
             
              s.name = %q{sinatra-formhelpers}
         | 
| 5 | 
            -
              s.version = "0. | 
| 5 | 
            +
              s.version = "0.2.0"
         | 
| 6 6 |  | 
| 7 7 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 8 8 | 
             
              s.authors = ["twilson63"]
         | 
| 9 | 
            -
              s.date = %q{2009-06- | 
| 9 | 
            +
              s.date = %q{2009-06-16}
         | 
| 10 10 | 
             
              s.email = %q{tom@jackrussellsoftware.com}
         | 
| 11 11 | 
             
              s.extra_rdoc_files = [
         | 
| 12 12 | 
             
                "LICENSE",
         | 
    
        data/test/formhelpers_test.rb
    CHANGED
    
    | @@ -57,6 +57,22 @@ class FormHelpersTest < Test::Unit::TestCase | |
| 57 57 | 
             
                end            
         | 
| 58 58 | 
             
              end
         | 
| 59 59 |  | 
| 60 | 
            +
              describe 'formhelpers text with single arg' do
         | 
| 61 | 
            +
                setup do
         | 
| 62 | 
            +
                  mock_app {
         | 
| 63 | 
            +
                    helpers Sinatra::FormHelpers
         | 
| 64 | 
            +
                    get '/' do
         | 
| 65 | 
            +
                      haml "= text :q"
         | 
| 66 | 
            +
                    end
         | 
| 67 | 
            +
                  }
         | 
| 68 | 
            +
                end
         | 
| 69 | 
            +
                
         | 
| 70 | 
            +
                it 'renders an input tag type text with single arg' do
         | 
| 71 | 
            +
                  get '/'
         | 
| 72 | 
            +
                  assert_equal "<input name='q' id='q' value='' type='text' />\n", body
         | 
| 73 | 
            +
                end            
         | 
| 74 | 
            +
              end
         | 
| 75 | 
            +
              
         | 
| 60 76 | 
             
              describe 'formhelpers text with @params' do
         | 
| 61 77 | 
             
                setup do
         | 
| 62 78 | 
             
                  mock_app {
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: twilson63-sinatra-formhelpers
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - twilson63
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2009-06- | 
| 12 | 
            +
            date: 2009-06-16 00:00:00 -07:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         |