Sha256: 60ff684b4f3bf9c57cf6b673855bbacf9466aa4856fb271e13b3ec2d2a6fea3c

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

require 'coveralls'
Coveralls.wear!

require "stringio"

begin
  require 'rspec'
rescue LoadError
  require 'rubygems' unless ENV['NO_RUBYGEMS']
  gem 'rspec'
  require 'spec'
end

RSpec.configure do |config|
  # Use color in STDOUT
  config.color = true
  # Use color not only in STDOUT but also in pagers and files
  config.tty = true
  # Use the specified formatter
  config.formatter = :documentation # :progress, :html, :textmate

  def capture(stream)
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new"
      yield
      result = eval("$#{stream}").string
    ensure
      eval "$#{stream} = #{stream.upcase}"
    end
    result
  end

  def epubcheck(epubname)
    jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-4.0.1/epubcheck.jar')    
    stdout = capture(:stdout) do 
      puts %x(java -Duser.language=en -jar #{jar} #{epubname})
    end
    expect(stdout).to include("No errors or warnings detected.")
  end
  
end

require 'rspec/core/formatters/base_text_formatter'
module RSpec
  module Core
    module Formatters
      class DocumentationFormatter < BaseTextFormatter
        # def green(text); color(text, "\e[42m") end
        def red(text); color(text, "\e[41m") end
        # def magenta(text); color(text, "\e[45m") end
      end
    end
  end
end
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'gepub'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gepub-1.0.1 spec/spec_helper.rb
gepub-1.0.0 spec/spec_helper.rb
gepub-1.0.0rc1 spec/spec_helper.rb
gepub-1.0.0beta1 spec/spec_helper.rb
gepub-0.7.1 spec/spec_helper.rb
gepub-0.7.0 spec/spec_helper.rb
gepub-0.7.0beta4 spec/spec_helper.rb