file_validators 1.0.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.
@@ -0,0 +1,13 @@
1
+ RSpec::Matchers.define :allow_file_content_type do |content_type, validator, message|
2
+ match do |model|
3
+ value = double('file', content_type: content_type)
4
+ model.any_instance.stub(:read_attribute_for_validation).and_return(value)
5
+ dummy = model.new
6
+ validator.validate(dummy)
7
+ if message.present?
8
+ dummy.errors.full_messages.exclude?(message[:message])
9
+ else
10
+ dummy.errors.empty?
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ RSpec::Matchers.define :allow_file_size do |size, validator, message|
2
+ match do |model|
3
+ value = double('file', size: size)
4
+ model.any_instance.stub(:read_attribute_for_validation).and_return(value)
5
+ dummy = model.new
6
+ validator.validate(dummy)
7
+ if message.present?
8
+ dummy.errors.full_messages.exclude?(message[:message])
9
+ else
10
+ dummy.errors.empty?
11
+ end
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: file_validators
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ahmad Musaffa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack-test
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Adds file validators to ActiveModel
84
+ email:
85
+ - musaffa_csemm@yahoo.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
+ - Appraisals
93
+ - Gemfile
94
+ - MIT-LICENSE
95
+ - README.md
96
+ - README.rdoc
97
+ - Rakefile
98
+ - file_validators.gemspec
99
+ - gemfiles/activemodel_3.0.gemfile
100
+ - gemfiles/activemodel_3.1.gemfile
101
+ - gemfiles/activemodel_3.2.gemfile
102
+ - gemfiles/activemodel_4.0.gemfile
103
+ - gemfiles/activemodel_4.1.gemfile
104
+ - lib/file_validators.rb
105
+ - lib/file_validators/validators/file_content_type_validator.rb
106
+ - lib/file_validators/validators/file_size_validator.rb
107
+ - lib/file_validators/version.rb
108
+ - spec/fixtures/chubby_bubble.jpg
109
+ - spec/fixtures/chubby_cute.png
110
+ - spec/fixtures/cute.jpg
111
+ - spec/fixtures/sample.txt
112
+ - spec/integration/combined_validators_integration_spec.rb
113
+ - spec/integration/file_content_type_validation_integration_spec.rb
114
+ - spec/integration/file_size_validator_integration_spec.rb
115
+ - spec/lib/file_validators/validators/file_content_type_validator_spec.rb
116
+ - spec/lib/file_validators/validators/file_size_validator_spec.rb
117
+ - spec/locale/en.yml
118
+ - spec/spec_helper.rb
119
+ - spec/support/matchers/allow_content_type.rb
120
+ - spec/support/matchers/allow_file_size.rb
121
+ homepage: https://github.com/musaffa/file_validators
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.2.2
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: ActiveModel file validators
145
+ test_files:
146
+ - spec/fixtures/chubby_bubble.jpg
147
+ - spec/fixtures/chubby_cute.png
148
+ - spec/fixtures/cute.jpg
149
+ - spec/fixtures/sample.txt
150
+ - spec/integration/combined_validators_integration_spec.rb
151
+ - spec/integration/file_content_type_validation_integration_spec.rb
152
+ - spec/integration/file_size_validator_integration_spec.rb
153
+ - spec/lib/file_validators/validators/file_content_type_validator_spec.rb
154
+ - spec/lib/file_validators/validators/file_size_validator_spec.rb
155
+ - spec/locale/en.yml
156
+ - spec/spec_helper.rb
157
+ - spec/support/matchers/allow_content_type.rb
158
+ - spec/support/matchers/allow_file_size.rb
159
+ has_rdoc: