remarkable_activerecord 3.1.13 → 4.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -3
- data/lib/remarkable_activerecord.rb +1 -3
- data/lib/remarkable_activerecord/base.rb +1 -247
- data/lib/remarkable_activerecord/matchers/have_default_scope_matcher.rb +1 -2
- data/lib/remarkable_activerecord/matchers/have_scope_matcher.rb +35 -19
- data/lib/remarkable_activerecord/matchers/validate_associated_matcher.rb +4 -7
- data/lib/remarkable_activerecord/matchers/validate_uniqueness_of_matcher.rb +1 -1
- data/remarkable_activerecord.gemspec +44 -14
- metadata +60 -33
- data/lib/remarkable_activerecord/describe.rb +0 -198
- data/lib/remarkable_activerecord/human_names.rb +0 -37
- data/lib/remarkable_activerecord/matchers/allow_values_for_matcher.rb +0 -88
- data/lib/remarkable_activerecord/matchers/validate_acceptance_of_matcher.rb +0 -50
- data/lib/remarkable_activerecord/matchers/validate_confirmation_of_matcher.rb +0 -44
- data/lib/remarkable_activerecord/matchers/validate_exclusion_of_matcher.rb +0 -57
- data/lib/remarkable_activerecord/matchers/validate_inclusion_of_matcher.rb +0 -57
- data/lib/remarkable_activerecord/matchers/validate_length_of_matcher.rb +0 -150
- data/lib/remarkable_activerecord/matchers/validate_numericality_of_matcher.rb +0 -188
- data/lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb +0 -91
@@ -1,20 +1,46 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{remarkable_activerecord}
|
5
|
-
s.version = "
|
8
|
+
s.version = "4.0.0.alpha1"
|
6
9
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
8
|
-
s.authors = ["Carlos Brando", "Jos\303\251 Valim", "Diego Carrion"]
|
9
|
-
s.date = %q{2010-
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Ho-Sheng Hsiao", "Carlos Brando", "Jos\303\251 Valim", "Diego Carrion"]
|
12
|
+
s.date = %q{2010-04-22}
|
10
13
|
s.description = %q{Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord}
|
11
|
-
s.email = ["eduardobrando@gmail.com", "jose.valim@gmail.com", "dc.rec1@gmail.com"]
|
12
|
-
s.extra_rdoc_files = [
|
13
|
-
|
14
|
+
s.email = ["hosh@sparkfly.com", "eduardobrando@gmail.com", "jose.valim@gmail.com", "dc.rec1@gmail.com"]
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"CHANGELOG",
|
17
|
+
"LICENSE",
|
18
|
+
"README"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
"CHANGELOG",
|
22
|
+
"LICENSE",
|
23
|
+
"README",
|
24
|
+
"lib/remarkable_activerecord.rb",
|
25
|
+
"lib/remarkable_activerecord/base.rb",
|
26
|
+
"lib/remarkable_activerecord/matchers/accept_nested_attributes_for_matcher.rb",
|
27
|
+
"lib/remarkable_activerecord/matchers/allow_mass_assignment_of_matcher.rb",
|
28
|
+
"lib/remarkable_activerecord/matchers/association_matcher.rb",
|
29
|
+
"lib/remarkable_activerecord/matchers/have_column_matcher.rb",
|
30
|
+
"lib/remarkable_activerecord/matchers/have_default_scope_matcher.rb",
|
31
|
+
"lib/remarkable_activerecord/matchers/have_index_matcher.rb",
|
32
|
+
"lib/remarkable_activerecord/matchers/have_readonly_attributes_matcher.rb",
|
33
|
+
"lib/remarkable_activerecord/matchers/have_scope_matcher.rb",
|
34
|
+
"lib/remarkable_activerecord/matchers/validate_associated_matcher.rb",
|
35
|
+
"lib/remarkable_activerecord/matchers/validate_uniqueness_of_matcher.rb",
|
36
|
+
"locale/en.yml",
|
37
|
+
"remarkable_activerecord.gemspec"
|
38
|
+
]
|
14
39
|
s.homepage = %q{http://github.com/carlosbrando/remarkable}
|
40
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
15
41
|
s.require_paths = ["lib"]
|
16
42
|
s.rubyforge_project = %q{remarkable}
|
17
|
-
s.rubygems_version = %q{1.3.
|
43
|
+
s.rubygems_version = %q{1.3.6}
|
18
44
|
s.summary = %q{Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord}
|
19
45
|
|
20
46
|
if s.respond_to? :specification_version then
|
@@ -22,14 +48,18 @@ Gem::Specification.new do |s|
|
|
22
48
|
s.specification_version = 3
|
23
49
|
|
24
50
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
|
-
s.add_runtime_dependency(%q<rspec>, [">=
|
26
|
-
s.add_runtime_dependency(%q<remarkable>, ["~>
|
51
|
+
s.add_runtime_dependency(%q<rspec>, [">= 2.0.0.alpha7"])
|
52
|
+
s.add_runtime_dependency(%q<remarkable>, ["~> 4.0.0.alpha1"])
|
53
|
+
s.add_runtime_dependency(%q<remarkable_activemodel>, ["~> 4.0.0.alpha1"])
|
27
54
|
else
|
28
|
-
s.add_dependency(%q<rspec>, [">=
|
29
|
-
s.add_dependency(%q<remarkable>, ["~>
|
55
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0.alpha7"])
|
56
|
+
s.add_dependency(%q<remarkable>, ["~> 4.0.0.alpha1"])
|
57
|
+
s.add_dependency(%q<remarkable_activemodel>, ["~> 4.0.0.alpha1"])
|
30
58
|
end
|
31
59
|
else
|
32
|
-
s.add_dependency(%q<rspec>, [">=
|
33
|
-
s.add_dependency(%q<remarkable>, ["~>
|
60
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0.alpha7"])
|
61
|
+
s.add_dependency(%q<remarkable>, ["~> 4.0.0.alpha1"])
|
62
|
+
s.add_dependency(%q<remarkable_activemodel>, ["~> 4.0.0.alpha1"])
|
34
63
|
end
|
35
64
|
end
|
65
|
+
|
metadata
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remarkable_activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 4
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- alpha1
|
10
|
+
version: 4.0.0.alpha1
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
13
|
+
- Ho-Sheng Hsiao
|
7
14
|
- Carlos Brando
|
8
15
|
- "Jos\xC3\xA9 Valim"
|
9
16
|
- Diego Carrion
|
@@ -11,31 +18,57 @@ autorequire:
|
|
11
18
|
bindir: bin
|
12
19
|
cert_chain: []
|
13
20
|
|
14
|
-
date: 2010-
|
21
|
+
date: 2010-04-22 00:00:00 -04:00
|
15
22
|
default_executable:
|
16
23
|
dependencies:
|
17
24
|
- !ruby/object:Gem::Dependency
|
18
25
|
name: rspec
|
19
|
-
|
20
|
-
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
28
|
requirements:
|
23
29
|
- - ">="
|
24
30
|
- !ruby/object:Gem::Version
|
25
|
-
|
26
|
-
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 0
|
34
|
+
- 0
|
35
|
+
- alpha7
|
36
|
+
version: 2.0.0.alpha7
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id001
|
27
39
|
- !ruby/object:Gem::Dependency
|
28
40
|
name: remarkable
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
segments:
|
47
|
+
- 4
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
- alpha1
|
51
|
+
version: 4.0.0.alpha1
|
29
52
|
type: :runtime
|
30
|
-
|
31
|
-
|
53
|
+
version_requirements: *id002
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: remarkable_activemodel
|
56
|
+
prerelease: false
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
32
58
|
requirements:
|
33
59
|
- - ~>
|
34
60
|
- !ruby/object:Gem::Version
|
35
|
-
|
36
|
-
|
61
|
+
segments:
|
62
|
+
- 4
|
63
|
+
- 0
|
64
|
+
- 0
|
65
|
+
- alpha1
|
66
|
+
version: 4.0.0.alpha1
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
37
69
|
description: "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
|
38
70
|
email:
|
71
|
+
- hosh@sparkfly.com
|
39
72
|
- eduardobrando@gmail.com
|
40
73
|
- jose.valim@gmail.com
|
41
74
|
- dc.rec1@gmail.com
|
@@ -44,35 +77,25 @@ executables: []
|
|
44
77
|
extensions: []
|
45
78
|
|
46
79
|
extra_rdoc_files:
|
47
|
-
- README
|
48
|
-
- LICENSE
|
49
80
|
- CHANGELOG
|
50
|
-
files:
|
51
|
-
- README
|
52
81
|
- LICENSE
|
82
|
+
- README
|
83
|
+
files:
|
53
84
|
- CHANGELOG
|
85
|
+
- LICENSE
|
86
|
+
- README
|
87
|
+
- lib/remarkable_activerecord.rb
|
54
88
|
- lib/remarkable_activerecord/base.rb
|
55
|
-
- lib/remarkable_activerecord/describe.rb
|
56
|
-
- lib/remarkable_activerecord/human_names.rb
|
57
89
|
- lib/remarkable_activerecord/matchers/accept_nested_attributes_for_matcher.rb
|
58
90
|
- lib/remarkable_activerecord/matchers/allow_mass_assignment_of_matcher.rb
|
59
|
-
- lib/remarkable_activerecord/matchers/allow_values_for_matcher.rb
|
60
91
|
- lib/remarkable_activerecord/matchers/association_matcher.rb
|
61
92
|
- lib/remarkable_activerecord/matchers/have_column_matcher.rb
|
62
93
|
- lib/remarkable_activerecord/matchers/have_default_scope_matcher.rb
|
63
94
|
- lib/remarkable_activerecord/matchers/have_index_matcher.rb
|
64
95
|
- lib/remarkable_activerecord/matchers/have_readonly_attributes_matcher.rb
|
65
96
|
- lib/remarkable_activerecord/matchers/have_scope_matcher.rb
|
66
|
-
- lib/remarkable_activerecord/matchers/validate_acceptance_of_matcher.rb
|
67
97
|
- lib/remarkable_activerecord/matchers/validate_associated_matcher.rb
|
68
|
-
- lib/remarkable_activerecord/matchers/validate_confirmation_of_matcher.rb
|
69
|
-
- lib/remarkable_activerecord/matchers/validate_exclusion_of_matcher.rb
|
70
|
-
- lib/remarkable_activerecord/matchers/validate_inclusion_of_matcher.rb
|
71
|
-
- lib/remarkable_activerecord/matchers/validate_length_of_matcher.rb
|
72
|
-
- lib/remarkable_activerecord/matchers/validate_numericality_of_matcher.rb
|
73
|
-
- lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb
|
74
98
|
- lib/remarkable_activerecord/matchers/validate_uniqueness_of_matcher.rb
|
75
|
-
- lib/remarkable_activerecord.rb
|
76
99
|
- locale/en.yml
|
77
100
|
- remarkable_activerecord.gemspec
|
78
101
|
has_rdoc: true
|
@@ -80,26 +103,30 @@ homepage: http://github.com/carlosbrando/remarkable
|
|
80
103
|
licenses: []
|
81
104
|
|
82
105
|
post_install_message:
|
83
|
-
rdoc_options:
|
84
|
-
|
106
|
+
rdoc_options:
|
107
|
+
- --charset=UTF-8
|
85
108
|
require_paths:
|
86
109
|
- lib
|
87
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
111
|
requirements:
|
89
112
|
- - ">="
|
90
113
|
- !ruby/object:Gem::Version
|
114
|
+
segments:
|
115
|
+
- 0
|
91
116
|
version: "0"
|
92
|
-
version:
|
93
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
118
|
requirements:
|
95
|
-
- - "
|
119
|
+
- - ">"
|
96
120
|
- !ruby/object:Gem::Version
|
97
|
-
|
98
|
-
|
121
|
+
segments:
|
122
|
+
- 1
|
123
|
+
- 3
|
124
|
+
- 1
|
125
|
+
version: 1.3.1
|
99
126
|
requirements: []
|
100
127
|
|
101
128
|
rubyforge_project: remarkable
|
102
|
-
rubygems_version: 1.3.
|
129
|
+
rubygems_version: 1.3.6
|
103
130
|
signing_key:
|
104
131
|
specification_version: 3
|
105
132
|
summary: "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
|
@@ -1,198 +0,0 @@
|
|
1
|
-
module Remarkable
|
2
|
-
module ActiveRecord
|
3
|
-
|
4
|
-
def self.after_include(target) #:nodoc:
|
5
|
-
target.class_inheritable_reader :describe_subject_attributes, :default_subject_attributes
|
6
|
-
target.send :include, Describe
|
7
|
-
end
|
8
|
-
|
9
|
-
# Overwrites describe to provide quick way to configure your subject:
|
10
|
-
#
|
11
|
-
# describe Post
|
12
|
-
# should_validate_presente_of :title
|
13
|
-
#
|
14
|
-
# describe :published => true do
|
15
|
-
# should_validate_presence_of :published_at
|
16
|
-
# end
|
17
|
-
# end
|
18
|
-
#
|
19
|
-
# This is the same as:
|
20
|
-
#
|
21
|
-
# describe Post
|
22
|
-
# should_validate_presente_of :title
|
23
|
-
#
|
24
|
-
# describe "when published is true" do
|
25
|
-
# subject { Post.new(:published => true) }
|
26
|
-
# should_validate_presence_of :published_at
|
27
|
-
# end
|
28
|
-
# end
|
29
|
-
#
|
30
|
-
# The string can be localized using I18n. An example yml file is:
|
31
|
-
#
|
32
|
-
# locale:
|
33
|
-
# remarkable:
|
34
|
-
# active_record:
|
35
|
-
# describe:
|
36
|
-
# each: "{{key}} is {{value}}"
|
37
|
-
# prepend: "when "
|
38
|
-
# connector: " and "
|
39
|
-
#
|
40
|
-
# You can also call subject attributes to set the default attributes for a
|
41
|
-
# subject. You can even mix with a fixture replacement tool:
|
42
|
-
#
|
43
|
-
# describe Post
|
44
|
-
# # Fixjour example
|
45
|
-
# subject_attributes { valid_post_attributes }
|
46
|
-
#
|
47
|
-
# describe :published => true do
|
48
|
-
# should_validate_presence_of :published_at
|
49
|
-
# end
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# You can retrieve the merged result of all attributes given using the
|
53
|
-
# subject_attributes instance method:
|
54
|
-
#
|
55
|
-
# describe Post
|
56
|
-
# # Fixjour example
|
57
|
-
# subject_attributes { valid_post_attributes }
|
58
|
-
#
|
59
|
-
# describe :published => true do
|
60
|
-
# it "should have default subject attributes" do
|
61
|
-
# subject_attributes.should == { :title => 'My title', :published => true }
|
62
|
-
# end
|
63
|
-
# end
|
64
|
-
# end
|
65
|
-
#
|
66
|
-
module Describe
|
67
|
-
|
68
|
-
def self.included(base) #:nodoc:
|
69
|
-
base.extend ClassMethods
|
70
|
-
end
|
71
|
-
|
72
|
-
module ClassMethods
|
73
|
-
|
74
|
-
# Overwrites describe to provide quick way to configure your subject:
|
75
|
-
#
|
76
|
-
# describe Post
|
77
|
-
# should_validate_presente_of :title
|
78
|
-
#
|
79
|
-
# describe :published => true do
|
80
|
-
# should_validate_presence_of :published_at
|
81
|
-
# end
|
82
|
-
# end
|
83
|
-
#
|
84
|
-
# This is the same as:
|
85
|
-
#
|
86
|
-
# describe Post
|
87
|
-
# should_validate_presente_of :title
|
88
|
-
#
|
89
|
-
# describe "when published is true" do
|
90
|
-
# subject { Post.new(:published => true) }
|
91
|
-
# should_validate_presence_of :published_at
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
#
|
95
|
-
# The string can be localized using I18n. An example yml file is:
|
96
|
-
#
|
97
|
-
# locale:
|
98
|
-
# remarkable:
|
99
|
-
# active_record:
|
100
|
-
# describe:
|
101
|
-
# each: "{{key}} is {{value}}"
|
102
|
-
# prepend: "when "
|
103
|
-
# connector: " and "
|
104
|
-
#
|
105
|
-
# See also subject_attributes instance and class methods for more
|
106
|
-
# information.
|
107
|
-
#
|
108
|
-
def describe(*args, &block)
|
109
|
-
if described_class && args.first.is_a?(Hash)
|
110
|
-
attributes = args.shift
|
111
|
-
connector = Remarkable.t "remarkable.active_record.describe.connector", :default => " and "
|
112
|
-
|
113
|
-
description = if self.describe_subject_attributes.blank?
|
114
|
-
Remarkable.t("remarkable.active_record.describe.prepend", :default => "when ")
|
115
|
-
else
|
116
|
-
connector.lstrip
|
117
|
-
end
|
118
|
-
|
119
|
-
pieces = []
|
120
|
-
attributes.each do |key, value|
|
121
|
-
translated_key = if described_class.respond_to?(:human_attribute_name)
|
122
|
-
described_class.human_attribute_name(key.to_s, :locale => Remarkable.locale)
|
123
|
-
else
|
124
|
-
key.to_s.humanize
|
125
|
-
end
|
126
|
-
|
127
|
-
pieces << Remarkable.t("remarkable.active_record.describe.each",
|
128
|
-
:default => "{{key}} is {{value}}",
|
129
|
-
:key => translated_key.downcase, :value => value.inspect)
|
130
|
-
end
|
131
|
-
|
132
|
-
description += pieces.join(connector)
|
133
|
-
args.unshift(description)
|
134
|
-
|
135
|
-
# Creates an example group, set the subject and eval the given block.
|
136
|
-
#
|
137
|
-
example_group = super(*args) do
|
138
|
-
write_inheritable_hash(:describe_subject_attributes, attributes)
|
139
|
-
set_described_subject!
|
140
|
-
instance_eval(&block)
|
141
|
-
end
|
142
|
-
else
|
143
|
-
super(*args, &block)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
# Sets default attributes for the subject. You can use this to set up
|
148
|
-
# your subject with valid attributes. You can even mix with a fixture
|
149
|
-
# replacement tool and still use quick subjects:
|
150
|
-
#
|
151
|
-
# describe Post
|
152
|
-
# # Fixjour example
|
153
|
-
# subject_attributes { valid_post_attributes }
|
154
|
-
#
|
155
|
-
# describe :published => true do
|
156
|
-
# should_validate_presence_of :published_at
|
157
|
-
# end
|
158
|
-
# end
|
159
|
-
#
|
160
|
-
def subject_attributes(options=nil, &block)
|
161
|
-
write_inheritable_attribute(:default_subject_attributes, options || block)
|
162
|
-
set_described_subject!
|
163
|
-
end
|
164
|
-
|
165
|
-
def set_described_subject!
|
166
|
-
subject {
|
167
|
-
record = self.class.described_class.new
|
168
|
-
record.send(:attributes=, subject_attributes, false)
|
169
|
-
record
|
170
|
-
}
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
# Returns a hash with the subject attributes declared using the
|
175
|
-
# subject_attributes class method and the attributes given using the
|
176
|
-
# describe method.
|
177
|
-
#
|
178
|
-
# describe Post
|
179
|
-
# subject_attributes { valid_post_attributes }
|
180
|
-
#
|
181
|
-
# describe :published => true do
|
182
|
-
# it "should have default subject attributes" do
|
183
|
-
# subject_attributes.should == { :title => 'My title', :published => true }
|
184
|
-
# end
|
185
|
-
# end
|
186
|
-
# end
|
187
|
-
#
|
188
|
-
def subject_attributes
|
189
|
-
default = self.class.default_subject_attributes
|
190
|
-
default = self.instance_eval(&default) if default.is_a?(Proc)
|
191
|
-
default ||= {}
|
192
|
-
|
193
|
-
default.merge(self.class.describe_subject_attributes || {})
|
194
|
-
end
|
195
|
-
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
if defined?(Spec)
|
2
|
-
module Spec #:nodoc:
|
3
|
-
module Example #:nodoc:
|
4
|
-
module ExampleGroupMethods #:nodoc:
|
5
|
-
|
6
|
-
# This allows "describe User" to use the I18n human name of User.
|
7
|
-
#
|
8
|
-
def self.build_description_with_i18n(*args)
|
9
|
-
args.inject("") do |description, arg|
|
10
|
-
arg = if arg.respond_to?(:human_name)
|
11
|
-
arg.human_name(:locale => Remarkable.locale)
|
12
|
-
else
|
13
|
-
arg.to_s
|
14
|
-
end
|
15
|
-
|
16
|
-
description << " " unless (description == "" || arg =~ /^(\s|\.|#)/)
|
17
|
-
description << arg
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# This is for rspec <= 1.1.12.
|
22
|
-
#
|
23
|
-
def self.description_text(*args)
|
24
|
-
self.build_description_with_i18n(*args)
|
25
|
-
end
|
26
|
-
|
27
|
-
# This is for rspec >= 1.2.0.
|
28
|
-
#
|
29
|
-
def self.build_description_from(*args)
|
30
|
-
text = ExampleGroupMethods.build_description_with_i18n(*args)
|
31
|
-
text == "" ? nil : text
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|