Sha256: b64e895acf159f3c90a170d4b866b51121bed439044f0899d7d0d9c0dd3931cd

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

if ENV['COVERAGE'] == 'true'
  require 'simplecov'
  require 'coveralls'

  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
    SimpleCov::Formatter::HTMLFormatter,
    Coveralls::SimpleCov::Formatter
  ]

  SimpleCov.start do
    command_name     'spec:unit'
    add_filter       'config/'
    add_filter       'spec'
    add_filter       '.bundle'
    minimum_coverage 99
  end
end

require 'rspec'
require 'bogus/rspec'
require 'virtus'

module Virtus
  def self.warn(*)
    # shut up in tests
  end
end

ENV['TZ'] = 'UTC'

# require spec support files and shared behavior
Dir[File.expand_path('../shared/**/*.rb', __FILE__)].each { |file| require file }

RSpec.configure do |config|

  # Remove anonymous- and example- Attribute classes from Attribute descendants
  config.after :all do
    stack = [ Virtus::Attribute ]
    while klass = stack.pop
      klass.descendants.delete_if do |descendant|
        descendant.name.nil? || descendant.name.empty? || descendant.name.start_with?('Examples::')
      end
      stack.concat(klass.descendants)
    end
  end

  # Remove constants in the Example-Module
  config.after :each do
    if defined?(Examples)
      Examples.constants.each do |const_name|
        ConstantsHelpers.undef_constant(Examples, const_name)
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
virtus-1.0.0.beta7 spec/spec_helper.rb
virtus-1.0.0.beta6 spec/spec_helper.rb
virtus-1.0.0.beta5 spec/spec_helper.rb
virtus-1.0.0.beta4 spec/spec_helper.rb
virtus-1.0.0.beta3 spec/spec_helper.rb