rails_html_validator 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 050a2bb82cccee0adb0a90856ac22b0b3ebb7f4e8492484db5af18e13960b174
4
- data.tar.gz: 3aeffef3671afe21e1be0bc8e9a69cf671cf7f6d488cabf355c8ecb6849af894
3
+ metadata.gz: 4abb440380e02a02035d41a755b778db89e487c2125911c400f33b767b431d70
4
+ data.tar.gz: 2461fcbebe3720d0a9ff4d75bdc175f7e1eda661e9816ae1ef99c6466d9882a3
5
5
  SHA512:
6
- metadata.gz: b72c7c30268f518a19d5082eb295083e3b27a45cb1397057b83ab3fd2dbeff415f234649ee5c249d6ad39e919a324c3e078b2545a50a14d37e7f513678411f3a
7
- data.tar.gz: 8b911b18ed96a14f63689e581f573b2bd94e6be23387fca0af193249369482a90ccab34f35f7746b4f8d2783a4ca3ab28e83b6b1e27fbb72d051c5ceadd5c4f1
6
+ metadata.gz: 067a51960db789db0a3779382dca930fa5fa9e4e58a41325ccecf6b9d3f528970f5c64d11d1d62ad566574d118f4e7e1bc13ab1eac7112bceaf5cc593c9af5dc
7
+ data.tar.gz: a79500c0bacb8b4b7d08c25e6f64fae8e773efc1e84e111b538b0ffa36c4567bdc5c6a39d6c2bb232cf3682e3745903fef4b2ca001755fff41545015a09d3bbe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_html_validator (0.1.6)
4
+ rails_html_validator (0.1.7)
5
5
  activemodel (>= 3.0.0)
6
6
  nokogiri
7
7
  rspec (~> 3.0)
@@ -2,11 +2,19 @@ require "nokogiri"
2
2
 
3
3
  module RailsHtmlValidator
4
4
  module Matchers
5
- ::RSpec::Matchers.define :exclude_html_tag_of do |value, tag:|
5
+ ::RSpec::Matchers.define :exclude_html_tag_of do |attribute, tag:|
6
6
  match do |model|
7
7
  html = "<#{tag.to_s}></#{tag.to_s}>"
8
- model.try("#{value}=", html)
9
- !model.valid?
8
+ model.try("#{attribute}=", html)
9
+
10
+ validators = model._validators[attribute].select do |v|
11
+ v.class == ActiveModel::Validations::HtmlValidator
12
+ end
13
+ return false if validators.blank?
14
+
15
+ validators.first.validate_each(model, attribute, html)
16
+ p model.errors.messages[attribute]
17
+ model.errors.messages[attribute].length > 0
10
18
  end
11
19
  end
12
20
  end
@@ -1,3 +1,3 @@
1
1
  module RailsHtmlValidator
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_html_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kawaoka