carlosbrando-remarkable 2.2.7 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt
CHANGED
@@ -48,6 +48,7 @@ lib/remarkable/controller/macros/set_the_flash_to_matcher.rb
|
|
48
48
|
lib/remarkable/dsl.rb
|
49
49
|
lib/remarkable/example/example_methods.rb
|
50
50
|
lib/remarkable/helpers.rb
|
51
|
+
lib/remarkable/inflections.rb
|
51
52
|
lib/remarkable/matcher_base.rb
|
52
53
|
lib/remarkable/private_helpers.rb
|
53
54
|
lib/remarkable/rails.rb
|
data/lib/remarkable.rb
CHANGED
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
module Remarkable
|
5
|
-
VERSION = '2.2.
|
5
|
+
VERSION = '2.2.8'
|
6
6
|
end
|
7
7
|
|
8
8
|
if ENV['RAILS_ENV'] == 'test'
|
@@ -19,3 +19,4 @@ require 'remarkable/example/example_methods'
|
|
19
19
|
require 'remarkable/active_record/active_record' if defined?(ActiveRecord::Base)
|
20
20
|
require 'remarkable/controller/controller' if defined?(ActionController::Base)
|
21
21
|
require 'remarkable/rails' if defined?(RAILS_ROOT)
|
22
|
+
require 'remarkable/inflections'
|
@@ -50,10 +50,10 @@ h3. have_db_column
|
|
50
50
|
|
51
51
|
Ensure that the given column is defined on the models backing SQL table. The options are the same as the instance variables defined on the column definition: :precision, :limit, :default, :null, :primary, :type, :scale, and :sql_type.
|
52
52
|
|
53
|
-
<pre><code> should_have_db_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255,
|
53
|
+
<pre><code> should_have_db_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255,
|
54
54
|
:null => true, :primary => false, :scale => nil, :sql_type => 'varchar(255)'
|
55
55
|
|
56
|
-
it { should have_db_column(:email, :type => "string", :default => nil, :precision => nil, :limit => 255,
|
56
|
+
it { should have_db_column(:email, :type => "string", :default => nil, :precision => nil, :limit => 255,
|
57
57
|
:null => true, :primary => false, :scale => nil, :sql_type => 'varchar(255)') }</code></pre>
|
58
58
|
|
59
59
|
h3. have_db_columns
|
@@ -229,20 +229,21 @@ Ensures that given values are not valid for the attribute. If a range is given,
|
|
229
229
|
Note: this matcher accepts at once just one attribute to test.
|
230
230
|
|
231
231
|
Options:
|
232
|
+
* :in - values to ensure exclusion
|
232
233
|
* :allow_nil - when supplied, validates if it allows nil or not.
|
233
234
|
* :allow_blank - when supplied, validates if it allows blank or not.
|
234
235
|
* :message - value the test expects to find in errors.on(:attribute).
|
235
236
|
Regexp, string or symbol. Default = I18n.translate('activerecord.errors.messages.exclusion')
|
236
237
|
|
237
|
-
<pre><code> should_validate_exclusion_of :age, 30..60
|
238
|
-
should_validate_exclusion_of :username, "admin", "user"
|
239
|
-
should_not validate_exclusion_of :username, "clark_kent", "peter_park"
|
238
|
+
<pre><code> should_validate_exclusion_of :age, :in => 30..60
|
239
|
+
should_validate_exclusion_of :username, :in => ["admin", "user"]
|
240
|
+
should_not validate_exclusion_of :username, :in => ["clark_kent", "peter_park"]
|
240
241
|
|
241
|
-
it { should validate_exclusion_of(:age, 30..60) }
|
242
|
-
it { should validate_exclusion_of(:username, "admin", "user") }
|
243
|
-
it { should_not validate_exclusion_of(:username, "clark_kent", "peter_park") }</code></pre>
|
242
|
+
it { should validate_exclusion_of(:age, :in => 30..60) }
|
243
|
+
it { should validate_exclusion_of(:username, :in => ["admin", "user"]) }
|
244
|
+
it { should_not validate_exclusion_of(:username, :in => ["clark_kent", "peter_park"]) }</code></pre>
|
244
245
|
|
245
|
-
h3. validate_format_of
|
246
|
+
h3. validate_format_of
|
246
247
|
|
247
248
|
Ensures that the attribute can be set to the given values.
|
248
249
|
|
@@ -269,16 +270,17 @@ Ensures that given values are valid for the attribute. If a range is given, ensu
|
|
269
270
|
Note: this matcher accepts at once just one attribute to test.
|
270
271
|
|
271
272
|
Options:
|
273
|
+
* :in - values to ensure inclusion
|
272
274
|
* :allow_nil - when supplied, validates if it allows nil or not.
|
273
275
|
* :allow_blank - when supplied, validates if it allows blank or not.
|
274
276
|
* :message - value the test expects to find in errors.on(:attribute).
|
275
277
|
Regexp, string or symbol. Default = I18n.translate('activerecord.errors.messages.inclusion')
|
276
278
|
|
277
|
-
<pre><code>
|
278
|
-
|
279
|
-
it { should validate_inclusion_of(:isbn, "isbn 1 2345 6789 0", "ISBN 1-2345-6789-0") }
|
279
|
+
<pre><code> should_validate_inclusion_of :age, :in => 18..100
|
280
|
+
should_validate_inclusion_of :size :in => ['S', 'M', 'L', 'XL']
|
280
281
|
|
281
|
-
it {
|
282
|
+
it { should validate_inclusion_of(:age, :in => 18..100) }
|
283
|
+
it { should validate_inclusion_of(:size :in => ['S', 'M', 'L', 'XL']) }
|
282
284
|
</code></pre>
|
283
285
|
|
284
286
|
h3. validate_length_of
|
@@ -78,7 +78,7 @@ module Remarkable # :nodoc:
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def less_than_min_length?
|
81
|
-
return true if @behavior == :maximum || @options[:minimum] <=
|
81
|
+
return true if @behavior == :maximum || @options[:minimum] <= 1
|
82
82
|
return true if bad?(value_for_length(@options[:minimum] - 1), :short_message)
|
83
83
|
|
84
84
|
@missing = "allow #{@attribute} to be less than #{@options[:minimum]} chars long"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add new inflection rules to avoid those rules from being overwriten.
|
2
|
+
if defined?(ActiveSupport::Inflector)
|
3
|
+
ActiveSupport::Inflector.inflections do |inflect|
|
4
|
+
inflect.irregular 'attribute', 'attributes'
|
5
|
+
inflect.irregular 'good_value', 'good_values'
|
6
|
+
end
|
7
|
+
end
|
data/remarkable.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{remarkable}
|
5
|
-
s.version = "2.2.
|
5
|
+
s.version = "2.2.8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Carlos Brando", "Jos\303\251 Valim", "Diego Carrion"]
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = %q{}
|
11
11
|
s.email = ["eduardobrando@gmail.com", "jose.valim@gmail.com", "dc.rec1@gmail.com"]
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
|
13
|
-
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "init.rb", "lib/remarkable.rb", "lib/remarkable/active_record/README.markdown", "lib/remarkable/active_record/active_record.rb", "lib/remarkable/active_record/helpers.rb", "lib/remarkable/active_record/macros.rb", "lib/remarkable/active_record/macros/associations/association_matcher.rb", "lib/remarkable/active_record/macros/callbacks/callback_matcher.rb", "lib/remarkable/active_record/macros/database/have_db_column_matcher.rb", "lib/remarkable/active_record/macros/database/index_matcher.rb", "lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_range_matcher.rb", "lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb", "lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_acceptance_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_associated_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_confirmation_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_format_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_numericality_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_presence_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb", "lib/remarkable/assertions.rb", "lib/remarkable/controller/README.markdown", "lib/remarkable/controller/controller.rb", "lib/remarkable/controller/helpers.rb", "lib/remarkable/controller/macros.rb", "lib/remarkable/controller/macros/assign_matcher.rb", "lib/remarkable/controller/macros/filter_params_matcher.rb", "lib/remarkable/controller/macros/metadata_matcher.rb", "lib/remarkable/controller/macros/render_with_layout_matcher.rb", "lib/remarkable/controller/macros/respond_with_content_type_matcher.rb", "lib/remarkable/controller/macros/respond_with_matcher.rb", "lib/remarkable/controller/macros/set_session_matcher.rb", "lib/remarkable/controller/macros/route_matcher.rb", "lib/remarkable/controller/macros/set_the_flash_to_matcher.rb", "lib/remarkable/dsl.rb", "lib/remarkable/example/example_methods.rb", "lib/remarkable/helpers.rb", "lib/remarkable/matcher_base.rb", "lib/remarkable/private_helpers.rb", "lib/remarkable/rails.rb", "lib/remarkable/rails/extract_options.rb", "rails/init.rb", "remarkable.gemspec", "script/console", "script/destroy", "script/generate", "tasks/rspec.rake"]
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "init.rb", "lib/remarkable.rb", "lib/remarkable/active_record/README.markdown", "lib/remarkable/active_record/active_record.rb", "lib/remarkable/active_record/helpers.rb", "lib/remarkable/active_record/macros.rb", "lib/remarkable/active_record/macros/associations/association_matcher.rb", "lib/remarkable/active_record/macros/callbacks/callback_matcher.rb", "lib/remarkable/active_record/macros/database/have_db_column_matcher.rb", "lib/remarkable/active_record/macros/database/index_matcher.rb", "lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_range_matcher.rb", "lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb", "lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_acceptance_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_associated_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_confirmation_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_format_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_numericality_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_presence_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb", "lib/remarkable/assertions.rb", "lib/remarkable/controller/README.markdown", "lib/remarkable/controller/controller.rb", "lib/remarkable/controller/helpers.rb", "lib/remarkable/controller/macros.rb", "lib/remarkable/controller/macros/assign_matcher.rb", "lib/remarkable/controller/macros/filter_params_matcher.rb", "lib/remarkable/controller/macros/metadata_matcher.rb", "lib/remarkable/controller/macros/render_with_layout_matcher.rb", "lib/remarkable/controller/macros/respond_with_content_type_matcher.rb", "lib/remarkable/controller/macros/respond_with_matcher.rb", "lib/remarkable/controller/macros/set_session_matcher.rb", "lib/remarkable/controller/macros/route_matcher.rb", "lib/remarkable/controller/macros/set_the_flash_to_matcher.rb", "lib/remarkable/dsl.rb", "lib/remarkable/example/example_methods.rb", "lib/remarkable/helpers.rb", "lib/remarkable/inflections.rb", "lib/remarkable/matcher_base.rb", "lib/remarkable/private_helpers.rb", "lib/remarkable/rails.rb", "lib/remarkable/rails/extract_options.rb", "rails/init.rb", "remarkable.gemspec", "script/console", "script/destroy", "script/generate", "tasks/rspec.rake"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://www.nomedojogo.com/2008/11/18/shoulda-for-rspec-is-remarkable/}
|
16
16
|
s.post_install_message = %q{PostInstall.txt}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carlosbrando-remarkable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Brando
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/remarkable/dsl.rb
|
120
120
|
- lib/remarkable/example/example_methods.rb
|
121
121
|
- lib/remarkable/helpers.rb
|
122
|
+
- lib/remarkable/inflections.rb
|
122
123
|
- lib/remarkable/matcher_base.rb
|
123
124
|
- lib/remarkable/private_helpers.rb
|
124
125
|
- lib/remarkable/rails.rb
|