Sha256: 5a393d6335245d6903dc0c12c78bc97fd2555eb36851e976eee2e661ad45ab6f

Contents?: true

Size: 1.65 KB

Versions: 2

Compression:

Stored size: 1.65 KB

Contents

require "w3c_rspec_validators"

describe "error_parser" do

  describe "self.parse_css" do
    before(:each) do
      @css_error_message = "ERROR; URI: file://localhost/TextArea; line 7: 
        
                                Property foo doesn't exist :"
      @css = "
body {
  blubb: 1 px;
}
/* line 5, ../../app/assets/stylesheets/home.css.scss */
#home {
  foo: 2px;
}"
    end

    it "should properly format css errors" do
      W3cRspecValidators::ErrorParser.parse_css_error(@css_error_message, @css)
        .should == "######
 Property foo doesn't exist :
Real code location(guessed) in File ../../app/assets/stylesheets/home.css.scss on line 2

Code context:
/* line 5, ../../app/assets/stylesheets/home.css.scss */
#home {
>>  foo: 2px;
}\n"
    end
  end

  describe "self.parse_html" do
    before(:each) do
      @html_error_message = "ERROR; URI: upload://Form Submission; line 7: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images."
      @html = "<!DOCTYPE HTML SYSTEM>
        <html>
          <head>
            <title>dd</title>
          </head>
          <body>
            <img />
          </body>
        </html>"
    end

    it "should properly format a html error message" do
      W3cRspecValidators::ErrorParser.parse_html_error(@html_error_message, @html)
        .should == "######
line 7: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.

          </head>
          <body>
>>            <img />
          </body>
        </html>\n"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
w3c_rspec_validators-0.2.1 spec/error_parser_spec.rb
w3c_rspec_validators-0.2.0 spec/error_parser_spec.rb