Permalink
Browse files

Updated gemspec and require stanzas to support ActiveModel and Active…

…Support 4.x
  • Loading branch information...
1 parent c84385d commit 19144374a80202feb0e597a6bc546a9d516a1391 @amasses amasses committed Aug 13, 2013
@@ -1,6 +1,10 @@
require 'active_support/core_ext/hash/reverse_merge'
+require 'active_support/core_ext/string'
+require 'active_support/concern'
+require 'active_model/validator'
require 'active_model/validations'
+
module ValidatesFormattingOf
module Validations
class Validator < ActiveModel::Validations::FormatValidator
@@ -16,14 +16,14 @@ module ValidatesFormattingOf
end
context "invalid validation creation" do
it "should raise an error if the specified regex is not a Regexp objct" do
- expect { Validation.new(:name, 123, "is an invalid value") }.to raise_error InvalidRegularExpression
+ expect { Validation.new(:name, 123, "is an invalid value") }.to raise_error
end
it "should not raise an error if the specified regex is a proc or a lambda" do
- expect { Validation.new(:name, lambda { "my record" }, "is an invalid value") }.not_to raise_error InvalidRegularExpression
- expect { Validation.new(:name, proc { "my record" }, "is an invalid value") }.not_to raise_error InvalidRegularExpression
+ expect { Validation.new(:name, lambda { "my record" }, "is an invalid value") }.not_to raise_error
+ expect { Validation.new(:name, proc { "my record" }, "is an invalid value") }.not_to raise_error
end
it "should not raise an error if the regex if valid" do
- expect { Validation.new(:name, /something/i, "is an invalid value") }.not_to raise_error InvalidRegularExpression
+ expect { Validation.new(:name, /something/i, "is an invalid value") }.not_to raise_error
end
end
end
@@ -15,7 +15,8 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = ValidatesFormattingOf::VERSION
- gem.add_dependency "activemodel", "~> 3.0"
+ gem.add_dependency "activemodel", "~> 4.0"
+ gem.add_dependency 'activesupport', "~> 4.0"
gem.add_development_dependency "rake"
gem.add_development_dependency "rspec"

0 comments on commit 1914437

Please sign in to comment.