validates_im 1.0.0 → 1.1.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/LICENSE +1 -1
- data/README.textile +1 -1
- data/lib/account_name_validator.rb +2 -2
- data/validates_im.gemspec +34 -34
- metadata +90 -62
- data/.document +0 -5
- data/.gitignore +0 -25
- data/.rspec +0 -1
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -50
- data/Rakefile +0 -35
- data/VERSION +0 -1
- data/spec/account_name_validator_spec.rb +0 -115
- data/spec/spec_helper.rb +0 -10
    
        data/LICENSE
    CHANGED
    
    
    
        data/README.textile
    CHANGED
    
    
| @@ -55,7 +55,7 @@ | |
| 55 55 | 
             
            #   validations.
         | 
| 56 56 |  | 
| 57 57 | 
             
            class AccountNameValidator < ActiveModel::EachValidator
         | 
| 58 | 
            -
               | 
| 58 | 
            +
              class_attribute :validations
         | 
| 59 59 | 
             
              self.validations = Array.new
         | 
| 60 60 |  | 
| 61 61 | 
             
              # @private
         | 
| @@ -94,7 +94,7 @@ class AccountNameValidator < ActiveModel::EachValidator | |
| 94 94 |  | 
| 95 95 | 
             
              def self.add_validation(key, &block)
         | 
| 96 96 | 
             
                return unless block_given?
         | 
| 97 | 
            -
                self.validations  | 
| 97 | 
            +
                self.validations += [[ block, key ]]
         | 
| 98 98 | 
             
              end
         | 
| 99 99 |  | 
| 100 100 | 
             
              # Enforces a minimum length on account names. Uses the "too_short" error
         | 
    
        data/validates_im.gemspec
    CHANGED
    
    | @@ -1,62 +1,62 @@ | |
| 1 1 | 
             
            # Generated by jeweler
         | 
| 2 2 | 
             
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            -
            # Instead, edit Jeweler::Tasks in Rakefile, and run  | 
| 3 | 
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{validates_im}
         | 
| 8 | 
            -
              s.version = "1. | 
| 8 | 
            +
              s.version = "1.1.0"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            -
              s.authors = [ | 
| 12 | 
            -
              s.date = %q{ | 
| 13 | 
            -
              s.description = %q{Adds ActiveModel validators for common instant  | 
| 11 | 
            +
              s.authors = [%q{Tim Morgan}]
         | 
| 12 | 
            +
              s.date = %q{2011-08-31}
         | 
| 13 | 
            +
              s.description = %q{Adds ActiveModel validators for common instant messaging services like Skype and AIM.}
         | 
| 14 14 | 
             
              s.email = %q{git@timothymorgan.info}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| 16 16 | 
             
                "LICENSE",
         | 
| 17 | 
            -
             | 
| 17 | 
            +
                "README.textile"
         | 
| 18 18 | 
             
              ]
         | 
| 19 19 | 
             
              s.files = [
         | 
| 20 | 
            -
                " | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
                 "lib/aim_validator.rb",
         | 
| 31 | 
            -
                 "lib/skype_validator.rb",
         | 
| 32 | 
            -
                 "lib/steam_validator.rb",
         | 
| 33 | 
            -
                 "lib/validates_im.rb",
         | 
| 34 | 
            -
                 "lib/xbox_live_validator.rb",
         | 
| 35 | 
            -
                 "lib/yahoo_im_validator.rb",
         | 
| 36 | 
            -
                 "spec/account_name_validator_spec.rb",
         | 
| 37 | 
            -
                 "spec/spec_helper.rb",
         | 
| 38 | 
            -
                 "validates_im.gemspec"
         | 
| 20 | 
            +
                "LICENSE",
         | 
| 21 | 
            +
                "README.textile",
         | 
| 22 | 
            +
                "lib/account_name_validator.rb",
         | 
| 23 | 
            +
                "lib/aim_validator.rb",
         | 
| 24 | 
            +
                "lib/skype_validator.rb",
         | 
| 25 | 
            +
                "lib/steam_validator.rb",
         | 
| 26 | 
            +
                "lib/validates_im.rb",
         | 
| 27 | 
            +
                "lib/xbox_live_validator.rb",
         | 
| 28 | 
            +
                "lib/yahoo_im_validator.rb",
         | 
| 29 | 
            +
                "validates_im.gemspec"
         | 
| 39 30 | 
             
              ]
         | 
| 40 31 | 
             
              s.homepage = %q{http://github.com/riscfuture/validates_im}
         | 
| 41 | 
            -
              s. | 
| 42 | 
            -
              s. | 
| 43 | 
            -
              s. | 
| 44 | 
            -
              s.summary = %q{A set of Rails validators for common instant messenging services}
         | 
| 45 | 
            -
              s.test_files = [
         | 
| 46 | 
            -
                "spec/account_name_validator_spec.rb",
         | 
| 47 | 
            -
                 "spec/spec_helper.rb"
         | 
| 48 | 
            -
              ]
         | 
| 32 | 
            +
              s.require_paths = [%q{lib}]
         | 
| 33 | 
            +
              s.rubygems_version = %q{1.8.9}
         | 
| 34 | 
            +
              s.summary = %q{A set of Rails validators for common instant messaging services}
         | 
| 49 35 |  | 
| 50 36 | 
             
              if s.respond_to? :specification_version then
         | 
| 51 | 
            -
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 52 37 | 
             
                s.specification_version = 3
         | 
| 53 38 |  | 
| 54 39 | 
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 40 | 
            +
                  s.add_runtime_dependency(%q<activerecord>, [">= 3.1"])
         | 
| 41 | 
            +
                  s.add_development_dependency(%q<jeweler>, [">= 0"])
         | 
| 42 | 
            +
                  s.add_development_dependency(%q<yard>, [">= 0"])
         | 
| 43 | 
            +
                  s.add_development_dependency(%q<RedCloth>, [">= 0"])
         | 
| 44 | 
            +
                  s.add_development_dependency(%q<rspec>, [">= 0"])
         | 
| 55 45 | 
             
                  s.add_runtime_dependency(%q<activerecord>, [">= 3.0"])
         | 
| 56 46 | 
             
                else
         | 
| 47 | 
            +
                  s.add_dependency(%q<activerecord>, [">= 3.1"])
         | 
| 48 | 
            +
                  s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 49 | 
            +
                  s.add_dependency(%q<yard>, [">= 0"])
         | 
| 50 | 
            +
                  s.add_dependency(%q<RedCloth>, [">= 0"])
         | 
| 51 | 
            +
                  s.add_dependency(%q<rspec>, [">= 0"])
         | 
| 57 52 | 
             
                  s.add_dependency(%q<activerecord>, [">= 3.0"])
         | 
| 58 53 | 
             
                end
         | 
| 59 54 | 
             
              else
         | 
| 55 | 
            +
                s.add_dependency(%q<activerecord>, [">= 3.1"])
         | 
| 56 | 
            +
                s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 57 | 
            +
                s.add_dependency(%q<yard>, [">= 0"])
         | 
| 58 | 
            +
                s.add_dependency(%q<RedCloth>, [">= 0"])
         | 
| 59 | 
            +
                s.add_dependency(%q<rspec>, [">= 0"])
         | 
| 60 60 | 
             
                s.add_dependency(%q<activerecord>, [">= 3.0"])
         | 
| 61 61 | 
             
              end
         | 
| 62 62 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,55 +1,93 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: validates_im
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version | 
| 4 | 
            -
               | 
| 5 | 
            -
               | 
| 6 | 
            -
              - 1
         | 
| 7 | 
            -
              - 0
         | 
| 8 | 
            -
              - 0
         | 
| 9 | 
            -
              version: 1.0.0
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 | 
            +
              prerelease: 
         | 
| 10 6 | 
             
            platform: ruby
         | 
| 11 | 
            -
            authors: | 
| 7 | 
            +
            authors:
         | 
| 12 8 | 
             
            - Tim Morgan
         | 
| 13 9 | 
             
            autorequire: 
         | 
| 14 10 | 
             
            bindir: bin
         | 
| 15 11 | 
             
            cert_chain: []
         | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 12 | 
            +
            date: 2011-08-31 00:00:00.000000000Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: activerecord
         | 
| 16 | 
            +
              requirement: &2167709520 !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                none: false
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - ! '>='
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: '3.1'
         | 
| 22 | 
            +
              type: :runtime
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: *2167709520
         | 
| 25 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 26 | 
            +
              name: jeweler
         | 
| 27 | 
            +
              requirement: &2167708860 !ruby/object:Gem::Requirement
         | 
| 28 | 
            +
                none: false
         | 
| 29 | 
            +
                requirements:
         | 
| 30 | 
            +
                - - ! '>='
         | 
| 31 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            +
                    version: '0'
         | 
| 33 | 
            +
              type: :development
         | 
| 34 | 
            +
              prerelease: false
         | 
| 35 | 
            +
              version_requirements: *2167708860
         | 
| 36 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 37 | 
            +
              name: yard
         | 
| 38 | 
            +
              requirement: &2167708280 !ruby/object:Gem::Requirement
         | 
| 39 | 
            +
                none: false
         | 
| 40 | 
            +
                requirements:
         | 
| 41 | 
            +
                - - ! '>='
         | 
| 42 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 43 | 
            +
                    version: '0'
         | 
| 44 | 
            +
              type: :development
         | 
| 45 | 
            +
              prerelease: false
         | 
| 46 | 
            +
              version_requirements: *2167708280
         | 
| 47 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 48 | 
            +
              name: RedCloth
         | 
| 49 | 
            +
              requirement: &2167707660 !ruby/object:Gem::Requirement
         | 
| 50 | 
            +
                none: false
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - ! '>='
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 55 | 
            +
              type: :development
         | 
| 56 | 
            +
              prerelease: false
         | 
| 57 | 
            +
              version_requirements: *2167707660
         | 
| 58 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 59 | 
            +
              name: rspec
         | 
| 60 | 
            +
              requirement: &2167707060 !ruby/object:Gem::Requirement
         | 
| 61 | 
            +
                none: false
         | 
| 62 | 
            +
                requirements:
         | 
| 63 | 
            +
                - - ! '>='
         | 
| 64 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 65 | 
            +
                    version: '0'
         | 
| 66 | 
            +
              type: :development
         | 
| 67 | 
            +
              prerelease: false
         | 
| 68 | 
            +
              version_requirements: *2167707060
         | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 21 70 | 
             
              name: activerecord
         | 
| 22 | 
            -
              requirement: & | 
| 71 | 
            +
              requirement: &2167706460 !ruby/object:Gem::Requirement
         | 
| 23 72 | 
             
                none: false
         | 
| 24 | 
            -
                requirements: | 
| 25 | 
            -
                - -  | 
| 26 | 
            -
                  - !ruby/object:Gem::Version | 
| 27 | 
            -
                     | 
| 28 | 
            -
                    - 3
         | 
| 29 | 
            -
                    - 0
         | 
| 30 | 
            -
                    version: "3.0"
         | 
| 73 | 
            +
                requirements:
         | 
| 74 | 
            +
                - - ! '>='
         | 
| 75 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 76 | 
            +
                    version: '3.0'
         | 
| 31 77 | 
             
              type: :runtime
         | 
| 32 78 | 
             
              prerelease: false
         | 
| 33 | 
            -
              version_requirements: * | 
| 34 | 
            -
            description: Adds ActiveModel validators for common instant  | 
| 79 | 
            +
              version_requirements: *2167706460
         | 
| 80 | 
            +
            description: Adds ActiveModel validators for common instant messaging services like
         | 
| 81 | 
            +
              Skype and AIM.
         | 
| 35 82 | 
             
            email: git@timothymorgan.info
         | 
| 36 83 | 
             
            executables: []
         | 
| 37 | 
            -
             | 
| 38 84 | 
             
            extensions: []
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            extra_rdoc_files: 
         | 
| 85 | 
            +
            extra_rdoc_files:
         | 
| 41 86 | 
             
            - LICENSE
         | 
| 42 87 | 
             
            - README.textile
         | 
| 43 | 
            -
            files: | 
| 44 | 
            -
            - .document
         | 
| 45 | 
            -
            - .gitignore
         | 
| 46 | 
            -
            - .rspec
         | 
| 47 | 
            -
            - Gemfile
         | 
| 48 | 
            -
            - Gemfile.lock
         | 
| 88 | 
            +
            files:
         | 
| 49 89 | 
             
            - LICENSE
         | 
| 50 90 | 
             
            - README.textile
         | 
| 51 | 
            -
            - Rakefile
         | 
| 52 | 
            -
            - VERSION
         | 
| 53 91 | 
             
            - lib/account_name_validator.rb
         | 
| 54 92 | 
             
            - lib/aim_validator.rb
         | 
| 55 93 | 
             
            - lib/skype_validator.rb
         | 
| @@ -57,42 +95,32 @@ files: | |
| 57 95 | 
             
            - lib/validates_im.rb
         | 
| 58 96 | 
             
            - lib/xbox_live_validator.rb
         | 
| 59 97 | 
             
            - lib/yahoo_im_validator.rb
         | 
| 60 | 
            -
            - spec/account_name_validator_spec.rb
         | 
| 61 | 
            -
            - spec/spec_helper.rb
         | 
| 62 98 | 
             
            - validates_im.gemspec
         | 
| 63 | 
            -
            has_rdoc: true
         | 
| 64 99 | 
             
            homepage: http://github.com/riscfuture/validates_im
         | 
| 65 100 | 
             
            licenses: []
         | 
| 66 | 
            -
             | 
| 67 101 | 
             
            post_install_message: 
         | 
| 68 | 
            -
            rdoc_options: 
         | 
| 69 | 
            -
             | 
| 70 | 
            -
            require_paths: 
         | 
| 102 | 
            +
            rdoc_options: []
         | 
| 103 | 
            +
            require_paths:
         | 
| 71 104 | 
             
            - lib
         | 
| 72 | 
            -
            required_ruby_version: !ruby/object:Gem::Requirement | 
| 105 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 73 106 | 
             
              none: false
         | 
| 74 | 
            -
              requirements: | 
| 75 | 
            -
              - -  | 
| 76 | 
            -
                - !ruby/object:Gem::Version | 
| 77 | 
            -
                   | 
| 78 | 
            -
                  segments: | 
| 107 | 
            +
              requirements:
         | 
| 108 | 
            +
              - - ! '>='
         | 
| 109 | 
            +
                - !ruby/object:Gem::Version
         | 
| 110 | 
            +
                  version: '0'
         | 
| 111 | 
            +
                  segments:
         | 
| 79 112 | 
             
                  - 0
         | 
| 80 | 
            -
                   | 
| 81 | 
            -
            required_rubygems_version: !ruby/object:Gem::Requirement | 
| 113 | 
            +
                  hash: 221433530893937633
         | 
| 114 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 82 115 | 
             
              none: false
         | 
| 83 | 
            -
              requirements: | 
| 84 | 
            -
              - -  | 
| 85 | 
            -
                - !ruby/object:Gem::Version | 
| 86 | 
            -
                   | 
| 87 | 
            -
                  - 0
         | 
| 88 | 
            -
                  version: "0"
         | 
| 116 | 
            +
              requirements:
         | 
| 117 | 
            +
              - - ! '>='
         | 
| 118 | 
            +
                - !ruby/object:Gem::Version
         | 
| 119 | 
            +
                  version: '0'
         | 
| 89 120 | 
             
            requirements: []
         | 
| 90 | 
            -
             | 
| 91 121 | 
             
            rubyforge_project: 
         | 
| 92 | 
            -
            rubygems_version: 1. | 
| 122 | 
            +
            rubygems_version: 1.8.9
         | 
| 93 123 | 
             
            signing_key: 
         | 
| 94 124 | 
             
            specification_version: 3
         | 
| 95 | 
            -
            summary: A set of Rails validators for common instant  | 
| 96 | 
            -
            test_files: 
         | 
| 97 | 
            -
            - spec/account_name_validator_spec.rb
         | 
| 98 | 
            -
            - spec/spec_helper.rb
         | 
| 125 | 
            +
            summary: A set of Rails validators for common instant messaging services
         | 
| 126 | 
            +
            test_files: []
         | 
    
        data/.document
    DELETED
    
    
    
        data/.gitignore
    DELETED
    
    | @@ -1,25 +0,0 @@ | |
| 1 | 
            -
            ## MAC OS
         | 
| 2 | 
            -
            .DS_Store
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            ## TEXTMATE
         | 
| 5 | 
            -
            *.tmproj
         | 
| 6 | 
            -
            tmtags
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            ## EMACS
         | 
| 9 | 
            -
            *~
         | 
| 10 | 
            -
            \#*
         | 
| 11 | 
            -
            .\#*
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            ## VIM
         | 
| 14 | 
            -
            *.swp
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            ## PROJECT::GENERAL
         | 
| 17 | 
            -
            coverage
         | 
| 18 | 
            -
            rdoc
         | 
| 19 | 
            -
            pkg
         | 
| 20 | 
            -
            .rvmrc
         | 
| 21 | 
            -
            .bundle
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            ## PROJECT::DOCUMENTATION
         | 
| 24 | 
            -
            .yardoc
         | 
| 25 | 
            -
            doc
         | 
    
        data/.rspec
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            -cfs
         | 
    
        data/Gemfile
    DELETED
    
    
    
        data/Gemfile.lock
    DELETED
    
    | @@ -1,50 +0,0 @@ | |
| 1 | 
            -
            GEM
         | 
| 2 | 
            -
              remote: http://rubygems.org/
         | 
| 3 | 
            -
              specs:
         | 
| 4 | 
            -
                RedCloth (4.2.3)
         | 
| 5 | 
            -
                activemodel (3.0.1)
         | 
| 6 | 
            -
                  activesupport (= 3.0.1)
         | 
| 7 | 
            -
                  builder (~> 2.1.2)
         | 
| 8 | 
            -
                  i18n (~> 0.4.1)
         | 
| 9 | 
            -
                activerecord (3.0.1)
         | 
| 10 | 
            -
                  activemodel (= 3.0.1)
         | 
| 11 | 
            -
                  activesupport (= 3.0.1)
         | 
| 12 | 
            -
                  arel (~> 1.0.0)
         | 
| 13 | 
            -
                  tzinfo (~> 0.3.23)
         | 
| 14 | 
            -
                activesupport (3.0.1)
         | 
| 15 | 
            -
                arel (1.0.1)
         | 
| 16 | 
            -
                  activesupport (~> 3.0.0)
         | 
| 17 | 
            -
                builder (2.1.2)
         | 
| 18 | 
            -
                diff-lcs (1.1.2)
         | 
| 19 | 
            -
                gemcutter (0.6.1)
         | 
| 20 | 
            -
                git (1.2.5)
         | 
| 21 | 
            -
                i18n (0.4.2)
         | 
| 22 | 
            -
                jeweler (1.4.0)
         | 
| 23 | 
            -
                  gemcutter (>= 0.1.0)
         | 
| 24 | 
            -
                  git (>= 1.2.5)
         | 
| 25 | 
            -
                  rubyforge (>= 2.0.0)
         | 
| 26 | 
            -
                json_pure (1.4.6)
         | 
| 27 | 
            -
                rspec (2.0.1)
         | 
| 28 | 
            -
                  rspec-core (~> 2.0.1)
         | 
| 29 | 
            -
                  rspec-expectations (~> 2.0.1)
         | 
| 30 | 
            -
                  rspec-mocks (~> 2.0.1)
         | 
| 31 | 
            -
                rspec-core (2.0.1)
         | 
| 32 | 
            -
                rspec-expectations (2.0.1)
         | 
| 33 | 
            -
                  diff-lcs (>= 1.1.2)
         | 
| 34 | 
            -
                rspec-mocks (2.0.1)
         | 
| 35 | 
            -
                  rspec-core (~> 2.0.1)
         | 
| 36 | 
            -
                  rspec-expectations (~> 2.0.1)
         | 
| 37 | 
            -
                rubyforge (2.0.4)
         | 
| 38 | 
            -
                  json_pure (>= 1.1.7)
         | 
| 39 | 
            -
                tzinfo (0.3.23)
         | 
| 40 | 
            -
                yard (0.6.1)
         | 
| 41 | 
            -
             | 
| 42 | 
            -
            PLATFORMS
         | 
| 43 | 
            -
              ruby
         | 
| 44 | 
            -
             | 
| 45 | 
            -
            DEPENDENCIES
         | 
| 46 | 
            -
              RedCloth
         | 
| 47 | 
            -
              activerecord
         | 
| 48 | 
            -
              jeweler
         | 
| 49 | 
            -
              rspec
         | 
| 50 | 
            -
              yard
         | 
    
        data/Rakefile
    DELETED
    
    | @@ -1,35 +0,0 @@ | |
| 1 | 
            -
            require 'rake'
         | 
| 2 | 
            -
            begin
         | 
| 3 | 
            -
              require 'bundler'
         | 
| 4 | 
            -
            rescue LoadError
         | 
| 5 | 
            -
              puts "Bundler is not installed; install with `gem install bundler`."
         | 
| 6 | 
            -
              exit 1
         | 
| 7 | 
            -
            end
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            Bundler.require :default
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            Jeweler::Tasks.new do |gem|
         | 
| 12 | 
            -
              gem.name = "validates_im"
         | 
| 13 | 
            -
              gem.summary = %Q{A set of Rails validators for common instant messenging services}
         | 
| 14 | 
            -
              gem.description = %Q{Adds ActiveModel validators for common instant messenging services like Skype and AIM.}
         | 
| 15 | 
            -
              gem.email = "git@timothymorgan.info"
         | 
| 16 | 
            -
              gem.homepage = "http://github.com/riscfuture/validates_im"
         | 
| 17 | 
            -
              gem.authors = [ "Tim Morgan" ]
         | 
| 18 | 
            -
              gem.add_dependency 'activerecord', '>= 3.0'
         | 
| 19 | 
            -
            end
         | 
| 20 | 
            -
            Jeweler::GemcutterTasks.new
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            require 'rspec/core/rake_task'
         | 
| 23 | 
            -
            RSpec::Core::RakeTask.new
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            YARD::Rake::YardocTask.new('doc') do |doc|
         | 
| 26 | 
            -
              doc.options << "-m" << "textile"
         | 
| 27 | 
            -
              doc.options << "--protected"
         | 
| 28 | 
            -
              doc.options << "-r" << "README.textile"
         | 
| 29 | 
            -
              doc.options << "-o" << "doc"
         | 
| 30 | 
            -
              doc.options << "--title" << "validates_im Documentation".inspect
         | 
| 31 | 
            -
              
         | 
| 32 | 
            -
              doc.files = [ 'lib/*_validator.rb', 'README.textile' ]
         | 
| 33 | 
            -
            end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            task(default: :spec)
         | 
    
        data/VERSION
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            1.0.0
         | 
| @@ -1,115 +0,0 @@ | |
| 1 | 
            -
            require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module SpecSupport
         | 
| 4 | 
            -
              class TestAccountNameValidator < AccountNameValidator; end
         | 
| 5 | 
            -
              class FakeModel
         | 
| 6 | 
            -
                extend ActiveModel::Translation
         | 
| 7 | 
            -
                def errors() @errors ||= ActiveModel::Errors.new(self) end
         | 
| 8 | 
            -
                def self.lookup_ancestors() [ self ] end
         | 
| 9 | 
            -
                def read_attribute_for_validation(_) "mock" end
         | 
| 10 | 
            -
              end
         | 
| 11 | 
            -
            end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            describe AccountNameValidator do
         | 
| 14 | 
            -
              before :each do
         | 
| 15 | 
            -
                SpecSupport::TestAccountNameValidator.validations.clear
         | 
| 16 | 
            -
                @model = SpecSupport::FakeModel.new
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
              describe ".error_key_prefix" do
         | 
| 20 | 
            -
                it "should be the downcased name of the validator by default" do
         | 
| 21 | 
            -
                  SpecSupport::TestAccountNameValidator.error_key_prefix.should eql(:test_account_name)
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                it "should be able to be set" do
         | 
| 25 | 
            -
                  SpecSupport::TestAccountNameValidator.error_key_prefix(:foo)
         | 
| 26 | 
            -
                  SpecSupport::TestAccountNameValidator.error_key_prefix.should eql(:foo)
         | 
| 27 | 
            -
                  SpecSupport::TestAccountNameValidator.instance_variable_set :@error_key_prefix, nil
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
              describe "#validate_each" do
         | 
| 32 | 
            -
                it "should do nothing if given nil and :allow_nil is set" do
         | 
| 33 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field, allow_nil: true).validate_each(@model, :field, nil)
         | 
| 34 | 
            -
                  @model.errors.should be_empty
         | 
| 35 | 
            -
                end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                it "should do nothing if given a blank value and :allow_blank is set" do
         | 
| 38 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field, allow_blank: true).validate_each(@model, :field, "")
         | 
| 39 | 
            -
                  @model.errors.should be_empty
         | 
| 40 | 
            -
                end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                it "should add an error to the record if any validation fails" do
         | 
| 43 | 
            -
                  SpecSupport::TestAccountNameValidator.add_validation(:not_foo) { |value| value == 'foo' }
         | 
| 44 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, 'bar')
         | 
| 45 | 
            -
                  @model.errors[:field].should_not be_empty
         | 
| 46 | 
            -
                  @model.errors[:field].first.should include('test_account_name_not_foo')
         | 
| 47 | 
            -
                end
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                it "should use a :message option for the message" do
         | 
| 50 | 
            -
                  SpecSupport::TestAccountNameValidator.add_validation(:not_foo) { |value| value == 'foo' }
         | 
| 51 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field, message: 'bar').validate_each(@model, :field, 'bar')
         | 
| 52 | 
            -
                  @model.errors[:field].should eql([ 'bar' ])
         | 
| 53 | 
            -
                end
         | 
| 54 | 
            -
                
         | 
| 55 | 
            -
                it "should typecast the value to a string" do
         | 
| 56 | 
            -
                  SpecSupport::TestAccountNameValidator.add_validation(:not_foo) { |value| value == 'foo' }
         | 
| 57 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, :foo)
         | 
| 58 | 
            -
                  @model.errors.should be_empty
         | 
| 59 | 
            -
                end
         | 
| 60 | 
            -
              end
         | 
| 61 | 
            -
             | 
| 62 | 
            -
              describe ".add_validation" do
         | 
| 63 | 
            -
                before :each do
         | 
| 64 | 
            -
                  @validator = SpecSupport::TestAccountNameValidator.new(attributes: :field)
         | 
| 65 | 
            -
                end
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                it "should add a validation block" do
         | 
| 68 | 
            -
                  SpecSupport::TestAccountNameValidator.add_validation(:not_foo) { |value| value == 'foo' }
         | 
| 69 | 
            -
                  @validator.validate_each(@model, :field, 'bar')
         | 
| 70 | 
            -
                  @model.errors[:field].should_not be_empty
         | 
| 71 | 
            -
                end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                it "should do nothing if no block is given" do
         | 
| 74 | 
            -
                  SpecSupport::TestAccountNameValidator.add_validation(:not_foo)
         | 
| 75 | 
            -
                  @validator.validate_each(@model, :field, 'bar')
         | 
| 76 | 
            -
                  @model.errors[:field].should be_empty
         | 
| 77 | 
            -
                end
         | 
| 78 | 
            -
              end
         | 
| 79 | 
            -
             | 
| 80 | 
            -
              describe ".min_length" do
         | 
| 81 | 
            -
                it "should ensure a minimum length" do
         | 
| 82 | 
            -
                  SpecSupport::TestAccountNameValidator.min_length 5
         | 
| 83 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, '1234')
         | 
| 84 | 
            -
                  @model.errors[:field].should_not be_empty
         | 
| 85 | 
            -
                  @model.errors[:field].first.should include('too_short')
         | 
| 86 | 
            -
                end
         | 
| 87 | 
            -
              end
         | 
| 88 | 
            -
             | 
| 89 | 
            -
              describe ".max_length" do
         | 
| 90 | 
            -
                it "should ensure a maximum length" do
         | 
| 91 | 
            -
                  SpecSupport::TestAccountNameValidator.max_length 5
         | 
| 92 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, '123456')
         | 
| 93 | 
            -
                  @model.errors[:field].should_not be_empty
         | 
| 94 | 
            -
                  @model.errors[:field].first.should include('too_long')
         | 
| 95 | 
            -
                end
         | 
| 96 | 
            -
              end
         | 
| 97 | 
            -
             | 
| 98 | 
            -
              describe ".valid_chars" do
         | 
| 99 | 
            -
                it "should check for invalid chars" do
         | 
| 100 | 
            -
                  SpecSupport::TestAccountNameValidator.valid_chars '[A-Z]'
         | 
| 101 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, 'A!Z')
         | 
| 102 | 
            -
                  @model.errors[:field].should_not be_empty
         | 
| 103 | 
            -
                  @model.errors[:field].first.should include('invalid_chars')
         | 
| 104 | 
            -
                end
         | 
| 105 | 
            -
              end
         | 
| 106 | 
            -
             | 
| 107 | 
            -
              describe ".first_char" do
         | 
| 108 | 
            -
                it "should check for an invalid first character" do
         | 
| 109 | 
            -
                  SpecSupport::TestAccountNameValidator.first_char '[A-Z]'
         | 
| 110 | 
            -
                  SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, 'abc')
         | 
| 111 | 
            -
                  @model.errors[:field].should_not be_empty
         | 
| 112 | 
            -
                  @model.errors[:field].first.should include('invalid_first_char')
         | 
| 113 | 
            -
                end
         | 
| 114 | 
            -
              end
         | 
| 115 | 
            -
            end
         |