Class: BeValidAsset::BeValidCss
- Inherits:
-
BeValidBase
- Object
- BeValidBase
- BeValidAsset::BeValidCss
- Defined in:
- lib/be_valid_asset/be_valid_css.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object (also: #negative_failure_message)
-
#initialize(profile) ⇒ BeValidCss
constructor
A new instance of BeValidCss.
- #matches?(fragment) ⇒ Boolean
Constructor Details
#initialize(profile) ⇒ BeValidCss
Returns a new instance of BeValidCss.
10 11 12 |
# File 'lib/be_valid_asset/be_valid_css.rb', line 10 def initialize(profile) @profile = profile end |
Instance Method Details
#description ⇒ Object
27 28 29 |
# File 'lib/be_valid_asset/be_valid_css.rb', line 27 def description "be valid css" end |
#failure_message ⇒ Object
31 32 33 |
# File 'lib/be_valid_asset/be_valid_css.rb', line 31 def " expected css to be valid, but validation produced these errors:\n#{@message}" end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
35 36 37 |
# File 'lib/be_valid_asset/be_valid_css.rb', line 35 def " expected to not be valid, but was (missing validation?)" end |
#matches?(fragment) ⇒ Boolean
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/be_valid_asset/be_valid_css.rb', line 14 def matches?(fragment) if fragment.respond_to? :body fragment = fragment.body.to_s end # The validator return a 500 Error if it's sent empty string fragment = ' ' if fragment.empty? query_params = { :text => fragment, :profile => @profile, :vextwarning => 'true' } return validate(query_params) end |