Sha256: 3550a6e5c914625209f2dc235a96298b9f5243bfb00b1de9b16ce6953409191e

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

module EpubValidator
  describe FormatMessage do
    it "should be valid" do
      errm = FormatMessage.new("Epubcheck Version 3.0\n\nValidating against EPUB version 3.0\nNo errors or warnings detected.\n")
      errm.valid?.should be true
    end
    it "should set the EPUB version that is being checked" do
      errm = FormatMessage.new("Epubcheck Version 3.0\n\nValidating against EPUB version 3.0\nNo errors or warnings detected.\n")
      errm.epub_version.should eq '3.0'
    end

    context "when no file is given" do
      it "should not be valid" do
        message = "Epubcheck Version 3.0\n\nAt least one argument expected"
        errm = FormatMessage.new(message)
        errm.valid?.should be false
      end
    end

    context "when it recieves an invalid file message" do
      it "should not be valid" do
        errm = FormatMessage.new("Epubcheck Version 3.0\n\nAt least one argument expected")
        errm.valid?.should be false
      end
      it "should return error message as an array" do
        message = "Epubcheck Version 3.0\n\nValidating against EPUB version 3.0\nERROR: book.epub: resource OEBPS/stylesheets/handbookish.css is missing\n\nCheck finished with warnings or errors"
        formatted_message = ["ERROR: book.epub: resource OEBPS/stylesheets/handbookish.css is missing"]
        errm = FormatMessage.new(message)
        errm.messages.should eq formatted_message
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
epub_validator-1.1.1 spec/epub_validator/format_message_spec.rb
epub_validator-1.1.0 spec/epub_validator/format_message_spec.rb
epub_validator-1.0.2 spec/epub_validator/format_message_spec.rb
epub_validator-1.0.0 spec/epub_validator/format_message_spec.rb