remarkable_mongo 0.1.2 → 0.1.3
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/.gitignore +2 -1
- data/Rakefile +6 -4
- data/VERSION +1 -1
- data/lib/remarkable/mongo_mapper/matchers/have_key_matcher.rb +6 -6
- data/lib/remarkable/mongo_mapper/matchers/validate_length_of_matcher.rb +3 -4
- data/remarkable_mongo.gemspec +80 -0
- data/spec/matchers/validate_length_of_matcher_spec.rb +3 -3
- data/spec/models.rb +14 -5
- metadata +30 -16
data/.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
.DS_Store
|
1
|
+
.DS_Store
|
2
|
+
pkg/*
|
data/Rakefile
CHANGED
@@ -10,10 +10,12 @@ begin
|
|
10
10
|
gem.email = "nicolas.merouze@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/nmerouze/remarkable_mongo"
|
12
12
|
gem.authors = ["Nicolas Mérouze"]
|
13
|
-
|
14
|
-
gem.add_dependency('remarkable'
|
15
|
-
gem.add_dependency('mongo_mapper', '~>
|
13
|
+
|
14
|
+
gem.add_dependency('remarkable')
|
15
|
+
gem.add_dependency('mongo_mapper', '~>0.7.6')
|
16
16
|
end
|
17
|
+
|
18
|
+
Jeweler::GemcutterTasks.new
|
17
19
|
rescue LoadError
|
18
20
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
21
|
end
|
@@ -25,4 +27,4 @@ desc 'Run all the specs for the machinist plugin.'
|
|
25
27
|
Spec::Rake::SpecTask.new do |t|
|
26
28
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
27
29
|
t.rcov = false
|
28
|
-
end
|
30
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -2,11 +2,11 @@ module Remarkable
|
|
2
2
|
module MongoMapper
|
3
3
|
module Matchers
|
4
4
|
class HaveKeyMatcher < Remarkable::MongoMapper::Base
|
5
|
-
|
5
|
+
|
6
6
|
arguments :type, :collection => :attributes, :as => :attribute
|
7
|
-
|
7
|
+
|
8
8
|
collection_assertions :has_key?
|
9
|
-
|
9
|
+
|
10
10
|
# before_assert do
|
11
11
|
# @type = @options[:type]
|
12
12
|
# end
|
@@ -14,11 +14,11 @@ module Remarkable
|
|
14
14
|
protected
|
15
15
|
|
16
16
|
def has_key?
|
17
|
-
@subject.respond_to?(@attribute) && @subject.class.keys[@attribute] == ::MongoMapper::Key.new(@attribute, @type)
|
17
|
+
@subject.respond_to?(@attribute) && @subject.class.keys[@attribute] == ::MongoMapper::Plugins::Keys::Key.new(@attribute, @type)
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
# Ensures that a key of the database actually exists.
|
23
23
|
#
|
24
24
|
# == Examples
|
@@ -35,4 +35,4 @@ module Remarkable
|
|
35
35
|
|
36
36
|
end
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
@@ -7,12 +7,11 @@ module Remarkable
|
|
7
7
|
optional :within, :minimum, :maximum, :is
|
8
8
|
optional :allow_nil, :allow_blank, :default => true
|
9
9
|
optional :message
|
10
|
-
|
10
|
+
|
11
11
|
default_options :message => "is invalid"
|
12
12
|
|
13
|
-
collection_assertions :less_than_min_length?, :exactly_min_length?,
|
14
|
-
:more_than_max_length?, :exactly_max_length
|
15
|
-
:allow_nil?, :allow_blank?
|
13
|
+
collection_assertions :allow_nil?, :allow_blank?, :less_than_min_length?, :exactly_min_length?,
|
14
|
+
:more_than_max_length?, :exactly_max_length?
|
16
15
|
|
17
16
|
before_assert do
|
18
17
|
if @options[:is]
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{remarkable_mongo}
|
8
|
+
s.version = "0.1.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Nicolas M\303\251rouze"]
|
12
|
+
s.date = %q{2010-06-04}
|
13
|
+
s.email = %q{nicolas.merouze@gmail.com}
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"LICENSE",
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"LICENSE",
|
21
|
+
"README.md",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"lib/remarkable/mongo_mapper.rb",
|
25
|
+
"lib/remarkable/mongo_mapper/base.rb",
|
26
|
+
"lib/remarkable/mongo_mapper/describe.rb",
|
27
|
+
"lib/remarkable/mongo_mapper/human_names.rb",
|
28
|
+
"lib/remarkable/mongo_mapper/matchers/allow_values_for_matcher.rb",
|
29
|
+
"lib/remarkable/mongo_mapper/matchers/association_matcher.rb",
|
30
|
+
"lib/remarkable/mongo_mapper/matchers/have_key_matcher.rb",
|
31
|
+
"lib/remarkable/mongo_mapper/matchers/validate_confirmation_of_matcher.rb",
|
32
|
+
"lib/remarkable/mongo_mapper/matchers/validate_length_of_matcher.rb",
|
33
|
+
"lib/remarkable/mongo_mapper/matchers/validate_presence_of_matcher.rb",
|
34
|
+
"locales/en.yml",
|
35
|
+
"remarkable_mongo.gemspec",
|
36
|
+
"spec/matchers/allow_values_for_matcher_spec.rb",
|
37
|
+
"spec/matchers/association_matcher_spec.rb",
|
38
|
+
"spec/matchers/have_key_matcher_spec.rb",
|
39
|
+
"spec/matchers/validate_confirmation_of_matcher_spec.rb",
|
40
|
+
"spec/matchers/validate_length_of_matcher_spec.rb",
|
41
|
+
"spec/matchers/validate_presence_of_matcher_spec.rb",
|
42
|
+
"spec/model_builder.rb",
|
43
|
+
"spec/models.rb",
|
44
|
+
"spec/spec.opts",
|
45
|
+
"spec/spec_helper.rb"
|
46
|
+
]
|
47
|
+
s.homepage = %q{http://github.com/nmerouze/remarkable_mongo}
|
48
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
49
|
+
s.require_paths = ["lib"]
|
50
|
+
s.rubygems_version = %q{1.3.6}
|
51
|
+
s.summary = %q{Remarkable Matchers for MongoDB ORMs}
|
52
|
+
s.test_files = [
|
53
|
+
"spec/matchers/allow_values_for_matcher_spec.rb",
|
54
|
+
"spec/matchers/association_matcher_spec.rb",
|
55
|
+
"spec/matchers/have_key_matcher_spec.rb",
|
56
|
+
"spec/matchers/validate_confirmation_of_matcher_spec.rb",
|
57
|
+
"spec/matchers/validate_length_of_matcher_spec.rb",
|
58
|
+
"spec/matchers/validate_presence_of_matcher_spec.rb",
|
59
|
+
"spec/model_builder.rb",
|
60
|
+
"spec/models.rb",
|
61
|
+
"spec/spec_helper.rb"
|
62
|
+
]
|
63
|
+
|
64
|
+
if s.respond_to? :specification_version then
|
65
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
66
|
+
s.specification_version = 3
|
67
|
+
|
68
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
69
|
+
s.add_runtime_dependency(%q<remarkable>, [">= 0"])
|
70
|
+
s.add_runtime_dependency(%q<mongo_mapper>, ["~> 0.7.6"])
|
71
|
+
else
|
72
|
+
s.add_dependency(%q<remarkable>, [">= 0"])
|
73
|
+
s.add_dependency(%q<mongo_mapper>, ["~> 0.7.6"])
|
74
|
+
end
|
75
|
+
else
|
76
|
+
s.add_dependency(%q<remarkable>, [">= 0"])
|
77
|
+
s.add_dependency(%q<mongo_mapper>, ["~> 0.7.6"])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
@@ -9,10 +9,10 @@ describe 'validate_length_of' do
|
|
9
9
|
|
10
10
|
@model = define_model :product do
|
11
11
|
include MongoMapper::Document
|
12
|
-
|
12
|
+
|
13
13
|
key :size, String
|
14
14
|
key :category, String
|
15
|
-
|
15
|
+
|
16
16
|
validates_length_of :size, options
|
17
17
|
end
|
18
18
|
|
@@ -21,7 +21,7 @@ describe 'validate_length_of' do
|
|
21
21
|
|
22
22
|
describe 'messages' do
|
23
23
|
before(:each){ @matcher = define_and_validate }
|
24
|
-
|
24
|
+
|
25
25
|
it 'should contain a description' do
|
26
26
|
@matcher.within(3..5)
|
27
27
|
@matcher.description.should == 'ensure length of size is within 3..5 characters'
|
data/spec/models.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
class Article
|
2
2
|
include MongoMapper::Document
|
3
|
-
|
3
|
+
|
4
4
|
key :title, String, :required => true
|
5
5
|
key :body, String
|
6
|
-
|
6
|
+
|
7
7
|
many :comments
|
8
8
|
many :unknowns
|
9
9
|
many :ratings, :class_name => "Rate"
|
10
10
|
many :assets
|
11
|
+
|
11
12
|
belongs_to :user
|
12
13
|
belongs_to :unknown
|
13
14
|
belongs_to :site, :class_name => 'Site'
|
@@ -15,13 +16,13 @@ end
|
|
15
16
|
|
16
17
|
class Comment
|
17
18
|
include MongoMapper::EmbeddedDocument
|
18
|
-
|
19
|
+
|
19
20
|
key :body, String
|
20
21
|
end
|
21
22
|
|
22
23
|
class User
|
23
24
|
include MongoMapper::Document
|
24
|
-
|
25
|
+
|
25
26
|
key :login, String
|
26
27
|
end
|
27
28
|
|
@@ -39,4 +40,12 @@ end
|
|
39
40
|
|
40
41
|
class Webiste
|
41
42
|
include MongoMapper::EmbeddedDocument
|
42
|
-
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Unknown
|
46
|
+
include MongoMapper::Document
|
47
|
+
end
|
48
|
+
|
49
|
+
class Asset
|
50
|
+
include MongoMapper::Document
|
51
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remarkable_mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
version: 0.1.3
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- "Nicolas M\xC3\xA9rouze"
|
@@ -9,29 +14,35 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-06-04 00:00:00 +02:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: remarkable
|
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
|
23
|
-
|
24
|
-
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
25
32
|
- !ruby/object:Gem::Dependency
|
26
33
|
name: mongo_mapper
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - ~>
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
|
39
|
+
segments:
|
40
|
+
- 0
|
41
|
+
- 7
|
42
|
+
- 6
|
43
|
+
version: 0.7.6
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
35
46
|
description:
|
36
47
|
email: nicolas.merouze@gmail.com
|
37
48
|
executables: []
|
@@ -58,6 +69,7 @@ files:
|
|
58
69
|
- lib/remarkable/mongo_mapper/matchers/validate_length_of_matcher.rb
|
59
70
|
- lib/remarkable/mongo_mapper/matchers/validate_presence_of_matcher.rb
|
60
71
|
- locales/en.yml
|
72
|
+
- remarkable_mongo.gemspec
|
61
73
|
- spec/matchers/allow_values_for_matcher_spec.rb
|
62
74
|
- spec/matchers/association_matcher_spec.rb
|
63
75
|
- spec/matchers/have_key_matcher_spec.rb
|
@@ -81,18 +93,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
93
|
requirements:
|
82
94
|
- - ">="
|
83
95
|
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
84
98
|
version: "0"
|
85
|
-
version:
|
86
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
100
|
requirements:
|
88
101
|
- - ">="
|
89
102
|
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 0
|
90
105
|
version: "0"
|
91
|
-
version:
|
92
106
|
requirements: []
|
93
107
|
|
94
108
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.3.
|
109
|
+
rubygems_version: 1.3.6
|
96
110
|
signing_key:
|
97
111
|
specification_version: 3
|
98
112
|
summary: Remarkable Matchers for MongoDB ORMs
|