liquid-validations 1.0.1 → 1.0.2

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- liquid-validations (1.0.1)
4
+ liquid-validations (1.0.2)
5
5
  activerecord
6
6
  liquid
7
7
 
@@ -1,3 +1,3 @@
1
1
  module LiquidValidations
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -16,7 +16,7 @@ module LiquidValidations
16
16
  end
17
17
 
18
18
  for error in errors
19
- record.errors.add(attr_name, friendly_liquid_error(error))
19
+ record.errors.add(:base, friendly_liquid_error(error) + " in your #{ friendly_attr_name(attr_name) }")
20
20
  end
21
21
  end
22
22
  end
@@ -35,9 +35,9 @@ module LiquidValidations
35
35
  container_re = /<\s*#{ container }.*>.*#{ variable_re }.*<\/\s*#{ container }\s*>/im
36
36
 
37
37
  if container.blank? && !(value =~ variable_re)
38
- record.errors.add(attr_name, "You must include {{ #{ variable } }} in your #{ friendly_attr_name(attr_name) }")
38
+ record.errors.add(:base, "You must include {{ #{ variable } }} in your #{ friendly_attr_name(attr_name) }")
39
39
  elsif !container.blank? && !(value =~ container_re)
40
- record.errors.add(attr_name, "You must include {{ #{ variable } }} inside the <#{ container }> tag of your #{ friendly_attr_name(attr_name) }")
40
+ record.errors.add(:base, "You must include {{ #{ variable } }} inside the <#{ container }> tag of your #{ friendly_attr_name(attr_name) }")
41
41
  end
42
42
  end
43
43
  end
@@ -19,6 +19,7 @@ describe LiquidValidations do
19
19
  end
20
20
 
21
21
  @mixin = Mixin.new
22
+ @mixin.errors.clear
22
23
  end
23
24
 
24
25
  [ ' {{ Bad liquid ',
@@ -33,7 +34,7 @@ describe LiquidValidations do
33
34
  it 'should include the errors in the errors object' do
34
35
  @mixin.content = '{{ unclosed variable '
35
36
  @mixin.valid?
36
- @mixin.errors.must_include(:content)
37
+ @mixin.errors.full_messages.any? { |e| e == "Variable '{{' was not properly closed in your content" }.must_equal true
37
38
  end
38
39
  end
39
40
 
@@ -58,7 +59,7 @@ describe LiquidValidations do
58
59
  it 'should include the errors in the errors object' do
59
60
  @mixin.content = '{{ josh_is_not_awesome }}'
60
61
  @mixin.valid?
61
- @mixin.errors.must_include(:content)
62
+ @mixin.errors.full_messages.any? { |e| e == "You must include {{ josh_is_awesome }} in your content" }.must_equal true
62
63
  end
63
64
  end
64
65
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquid-validations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Wigham