schematic 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,8 @@ module Schematic
8
8
  value = pattern.source
9
9
  value.gsub!(/^(?:\^|\\A|\\a)?/, '')
10
10
  value.gsub!(/(?:\$|\\Z|\\z)?$/, '')
11
+ value.gsub!(/\\\$/, '$')
12
+ value.gsub!(/\(\?:/, '(')
11
13
  builder.xs(:pattern, "value" => value)
12
14
  end
13
15
  end
@@ -1,3 +1,3 @@
1
1
  module Schematic
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -51,10 +51,12 @@ describe Schematic::Generator::Restrictions::Pattern do
51
51
  with_model :pattern_model do
52
52
  table :id => false do |t|
53
53
  t.string "email"
54
+ t.string "money"
54
55
  end
55
56
 
56
57
  model do
57
58
  validates :email, :format => { :with => /\A([\w\.%\+\-`']+)@([\w\-]+\.)+([\w]{2,})\Z/ }
59
+ validates :money, :format => { :with => /\$?[,0-9]+(?:\.\d+)?/ }
58
60
  end
59
61
  end
60
62
 
@@ -64,7 +66,12 @@ describe Schematic::Generator::Restrictions::Pattern do
64
66
  lambda {
65
67
  validate_xml_against_xsd(xml, subject)
66
68
  }.should raise_error
67
- valid_instance = PatternModel.new(:email => "foo@bar.com")
69
+ invalid_instance = PatternModel.new(:money => "whatever")
70
+ xml = [invalid_instance].to_xml
71
+ lambda {
72
+ validate_xml_against_xsd(xml, subject)
73
+ }.should raise_error
74
+ valid_instance = PatternModel.new(:email => "foo@bar.com", :money => "$99.95")
68
75
  xml = [valid_instance].to_xml
69
76
  lambda {
70
77
  validate_xml_against_xsd(xml, subject)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: schematic
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Case Commons, LLC