File: spec_helper.rb

package info (click to toggle)
ruby-postmark 1.25.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 480 kB
  • sloc: ruby: 5,413; makefile: 4
file content (53 lines) | stat: -rw-r--r-- 1,781 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
49
50
51
52
53
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'bundler'
Bundler.setup(:development)
require 'mail'
require 'postmark'
require 'active_support'
require 'json'
require 'fakeweb'
require 'fakeweb_matcher'
require 'rspec'
require 'rspec/its'
require File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'shared_examples.rb')
require File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'custom_matchers.rb')
require File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'helpers.rb')

Postmark::Deprecations.behavior = :silence

if ENV['JSONGEM']
  # `JSONGEM=Yajl rake spec`
  Postmark.response_parser_class = ENV['JSONGEM'].to_sym
  puts "Setting ResponseParser class to #{Postmark::ResponseParsers.const_get Postmark.response_parser_class}"
end

RSpec.configure do |config|
  include Postmark::RSpecHelpers

  config.expect_with(:rspec) { |c| c.syntax = :expect }

	config.filter_run_excluding :skip_for_platform => lambda { |platform|
    RUBY_PLATFORM.to_s =~ /^#{platform.to_s}/
  }

  config.filter_run_excluding :skip_ruby_version => lambda { |version|
    versions = [*version]
    versions.any? { |v| RUBY_VERSION.to_s =~ /^#{v.to_s}/ }
  }

  config.filter_run_excluding :exclusive_for_ruby_version => lambda { |version|
    versions = [*version]
    versions.all? { |v| !(RUBY_VERSION.to_s =~ /^#{v.to_s}/) }
  }

  config.before(:each) do
    %w(api_client response_parser_class secure api_token proxy_host proxy_port
       proxy_user proxy_pass host port path_prefix http_open_timeout
       http_read_timeout max_retries).each do |var|
      Postmark.instance_variable_set(:"@#{var}", nil)
    end
    Postmark.response_parser_class = nil
  end
end