File: spec_helper.rb

package info (click to toggle)
ruby-distribution 0.8.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 624 kB
  • sloc: ruby: 4,535; makefile: 10
file content (48 lines) | stat: -rw-r--r-- 968 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
begin
  require 'simplecov'
  SimpleCov.start do
    add_filter '/spec/'
    add_group 'Libraries', 'lib'
  end
rescue LoadError
end
require 'rspec'
require 'distribution'

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = [:should, :expect]
  end

  # 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
end

module ExampleWithGSL
  def it_only_with_gsl(name, opts = {}, &block)
    it(name, opts) do
      if Distribution.has_gsl?
        instance_eval(&block)
      else
        skip('Requires GSL')
      end
    end
  end

  def it_only_with_java(name, &block)
    it(name) do
      if Distribution.has_java?
        instance_eval(&block)
      else
        skip('Requires Java')
      end
    end
  end
end