scottmotte-dm-validations 0.9.10

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.
Files changed (4) hide show
  1. data/LICENSE +20 -0
  2. data/Rakefile +62 -0
  3. data/spec/spec_helper.rb +103 -0
  4. metadata +135 -0
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Scott Motte
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,62 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/gempackagetask'
4
+ require 'spec/rake/spectask'
5
+ require 'merb-core'
6
+ require 'merb-core/tasks/merb'
7
+ require 'merb-core/test/tasks/spectasks'
8
+
9
+
10
+ begin
11
+ require 'jeweler'
12
+ Jeweler::Tasks.new do |gem|
13
+ gem.name = "merb_auth_slice_multisite"
14
+ gem.summary = %Q{add multisite/subdomain functionality to your merb app on top of merb-auth}
15
+ gem.email = "scott@scottmotte.com"
16
+ gem.homepage = "http://github.com/scottmotte/merb_auth_slice_multisite"
17
+ gem.authors = ["scottmotte"]
18
+
19
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
+ end
21
+ rescue LoadError
22
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
23
+ end
24
+
25
+ require 'rake/testtask'
26
+ Rake::TestTask.new(:test) do |test|
27
+ test.libs << 'lib' << 'test'
28
+ test.pattern = 'test/**/*_test.rb'
29
+ test.verbose = false
30
+ end
31
+
32
+ begin
33
+ require 'rcov/rcovtask'
34
+ Rcov::RcovTask.new do |test|
35
+ test.libs << 'test'
36
+ test.pattern = 'test/**/*_test.rb'
37
+ test.verbose = true
38
+ end
39
+ rescue LoadError
40
+ task :rcov do
41
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
42
+ end
43
+ end
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ if File.exist?('VERSION.yml')
48
+ config = YAML.load(File.read('VERSION.yml'))
49
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
50
+ else
51
+ version = ""
52
+ end
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "merb_auth_slice_multisite #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
59
+
60
+
61
+ desc 'Default: run spec examples'
62
+ task :default => 'spec'
@@ -0,0 +1,103 @@
1
+ require 'rubygems'
2
+ require 'merb-core'
3
+ require 'merb-slices'
4
+ require 'spec'
5
+ require 'dm-core'
6
+ require 'dm-validations'
7
+
8
+ # Add merb_auth_slice_multisite.rb to the search path
9
+ Merb::Plugins.config[:merb_slices][:auto_register] = true
10
+ Merb::Plugins.config[:merb_slices][:search_path] = File.join(File.dirname(__FILE__), '..', 'lib', 'merb_auth_slice_multisite.rb')
11
+
12
+ # Require merb_auth_slice_multisite.rb explicitly so any dependencies are loaded
13
+ require Merb::Plugins.config[:merb_slices][:search_path]
14
+
15
+ # Using Merb.root below makes sure that the correct root is set for
16
+ # - testing standalone, without being installed as a gem and no host application
17
+ # - testing from within the host application; its root will be used
18
+ Merb.start_environment(
19
+ :testing => true,
20
+ :adapter => 'runner',
21
+ :environment => ENV['MERB_ENV'] || 'test',
22
+ :session_store => 'memory'
23
+ )
24
+
25
+ module Merb
26
+ module Test
27
+ module SliceHelper
28
+
29
+ # The absolute path to the current slice
30
+ def current_slice_root
31
+ @current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
32
+ end
33
+
34
+ # Whether the specs are being run from a host application or standalone
35
+ def standalone?
36
+ Merb.root == ::MerbAuthSliceMultisite.root
37
+ end
38
+
39
+ end
40
+ end
41
+ end
42
+
43
+ Spec::Runner.configure do |config|
44
+ config.include(Merb::Test::ViewHelper)
45
+ config.include(Merb::Test::RouteHelper)
46
+ config.include(Merb::Test::ControllerHelper)
47
+ config.include(Merb::Test::SliceHelper)
48
+
49
+ config.before(:all) do
50
+ DataMapper.auto_migrate! if Merb.orm == :datamapper
51
+ end
52
+ end
53
+
54
+ # You can add your own helpers here
55
+ #
56
+ Merb::Test.add_helpers do
57
+ def mount_slice
58
+ Merb::Router.prepare { add_slice(:MerbAuthSliceMultisite, "merb_auth_slice_multisite") } if standalone?
59
+ end
60
+
61
+ def dismount_slice
62
+ Merb::Router.reset! if standalone?
63
+ end
64
+ end
65
+
66
+ # =============================================================================
67
+ # SITE STUFF
68
+ # =============================================================================
69
+ def valid_site_attributes(options = {})
70
+ {
71
+ :domain => 'http://www.example.org',
72
+ :subdomain => 'example',
73
+ :id => 1
74
+ }.merge(options)
75
+ end
76
+
77
+ def valid_second_site_attributes(options = {})
78
+ {
79
+ :domain => 'http://www.example2.org',
80
+ :subdomain => 'example2',
81
+ :active => true,
82
+ :id => 2
83
+ }.merge(options)
84
+ end
85
+
86
+ def valid_third_site_attributes(options = {})
87
+ {
88
+ :domain => 'http://www.example3.org',
89
+ :subdomain => 'example3',
90
+ :active => true,
91
+ :id => 3
92
+ }.merge(options)
93
+ end
94
+
95
+ # =============================================================================
96
+ # USER STUFF - see init.rb for where this gets spoofed
97
+ # =============================================================================
98
+ def valid_user_attributes(options = {})
99
+ { :login => 'fred',
100
+ :email => 'fred@example.com',
101
+ :site_id => 1
102
+ }.merge(options)
103
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scottmotte-dm-validations
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.10
5
+ platform: ruby
6
+ authors:
7
+ - Guy van den Berg
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-19 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: dm-core
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.10
24
+ version:
25
+ description: DataMapper plugin for performing validations on data models
26
+ email:
27
+ - vandenberg.guy [a] gmail [d] com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - README.txt
34
+ - LICENSE
35
+ - TODO
36
+ - History.txt
37
+ files:
38
+ - History.txt
39
+ - LICENSE
40
+ - Manifest.txt
41
+ - README.txt
42
+ - Rakefile
43
+ - TODO
44
+ - lib/dm-validations.rb
45
+ - lib/dm-validations/absent_field_validator.rb
46
+ - lib/dm-validations/acceptance_validator.rb
47
+ - lib/dm-validations/auto_validate.rb
48
+ - lib/dm-validations/block_validator.rb
49
+ - lib/dm-validations/confirmation_validator.rb
50
+ - lib/dm-validations/contextual_validators.rb
51
+ - lib/dm-validations/custom_validator.rb
52
+ - lib/dm-validations/format_validator.rb
53
+ - lib/dm-validations/formats/email.rb
54
+ - lib/dm-validations/formats/url.rb
55
+ - lib/dm-validations/generic_validator.rb
56
+ - lib/dm-validations/length_validator.rb
57
+ - lib/dm-validations/method_validator.rb
58
+ - lib/dm-validations/numeric_validator.rb
59
+ - lib/dm-validations/primitive_validator.rb
60
+ - lib/dm-validations/required_field_validator.rb
61
+ - lib/dm-validations/support/object.rb
62
+ - lib/dm-validations/uniqueness_validator.rb
63
+ - lib/dm-validations/validation_errors.rb
64
+ - lib/dm-validations/version.rb
65
+ - lib/dm-validations/within_validator.rb
66
+ - spec/integration/absent_field_validator_spec.rb
67
+ - spec/integration/acceptance_validator_spec.rb
68
+ - spec/integration/auto_validate_spec.rb
69
+ - spec/integration/block_validator_spec.rb
70
+ - spec/integration/confirmation_validator_spec.rb
71
+ - spec/integration/contextual_validators_spec.rb
72
+ - spec/integration/custom_validator_spec.rb
73
+ - spec/integration/format_validator_spec.rb
74
+ - spec/integration/generic_validator_spec.rb
75
+ - spec/integration/length_validator/error_message_spec.rb
76
+ - spec/integration/length_validator/maximum_spec.rb
77
+ - spec/integration/length_validator/minimum_spec.rb
78
+ - spec/integration/length_validator/range_spec.rb
79
+ - spec/integration/length_validator/spec_helper.rb
80
+ - spec/integration/length_validator/valid_objects_spec.rb
81
+ - spec/integration/method_validator_spec.rb
82
+ - spec/integration/numeric_validator/float_type_spec.rb
83
+ - spec/integration/numeric_validator/integer_only_true_spec.rb
84
+ - spec/integration/numeric_validator/integer_type_spec.rb
85
+ - spec/integration/numeric_validator/spec_helper.rb
86
+ - spec/integration/numeric_validator_spec.rb
87
+ - spec/integration/primitive_validator_spec.rb
88
+ - spec/integration/required_field_validator/association_spec.rb
89
+ - spec/integration/required_field_validator/boolean_type_value_spec.rb
90
+ - spec/integration/required_field_validator/date_type_value_spec.rb
91
+ - spec/integration/required_field_validator/datetime_type_value_spec.rb
92
+ - spec/integration/required_field_validator/float_type_value_spec.rb
93
+ - spec/integration/required_field_validator/integer_type_value_spec.rb
94
+ - spec/integration/required_field_validator/plain_old_ruby_object_spec.rb
95
+ - spec/integration/required_field_validator/shared_examples.rb
96
+ - spec/integration/required_field_validator/spec_helper.rb
97
+ - spec/integration/required_field_validator/string_type_value_spec.rb
98
+ - spec/integration/required_field_validator/text_type_value_spec.rb
99
+ - spec/integration/uniqueness_validator_spec.rb
100
+ - spec/integration/validation_errors_spec.rb
101
+ - spec/integration/validation_spec.rb
102
+ - spec/integration/within_validator_spec.rb
103
+ - spec/spec.opts
104
+ - spec/spec_helper.rb
105
+ - tasks/install.rb
106
+ - tasks/spec.rb
107
+ has_rdoc: true
108
+ homepage: http://github.com/sam/dm-more/tree/master/dm-validations
109
+ post_install_message:
110
+ rdoc_options:
111
+ - --main
112
+ - README.txt
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: "0"
120
+ version:
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: "0"
126
+ version:
127
+ requirements: []
128
+
129
+ rubyforge_project: datamapper
130
+ rubygems_version: 1.2.0
131
+ signing_key:
132
+ specification_version: 2
133
+ summary: DataMapper plugin for performing validations on data models
134
+ test_files: []
135
+