spec/spec_helper.rb
author Mahlon E. Smith <mahlon@laika.com>
Wed, 16 Nov 2016 13:22:21 -0800
changeset 1 70dba2d6deb8
parent 0 266fe36d11dd
permissions -rw-r--r--
Added signature for changeset 266fe36d11dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     1
# -*- ruby -*-
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     2
#encoding: utf-8
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     3
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     4
require 'simplecov' if ENV['COVERAGE']
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     5
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     6
require 'rspec'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     7
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     8
require 'mongrel2'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     9
require 'mongrel2/testing'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    10
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    11
require 'thingfish'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    12
require 'thingfish/spechelpers'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    13
require 'thingfish/processor/pdf'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    14
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    15
require 'loggability/spechelpers'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    16
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    17
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    18
module Thingfish::Processor::PDF::SpecHelpers
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    19
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    20
	FIXTURE_DIR = Pathname( __FILE__ ).dirname + 'data'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    21
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    22
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    23
	### Load and return the data from the fixture with the specified +filename+.
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    24
	def fixture_data( filename )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    25
		fixture = FIXTURE_DIR + filename
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    26
		return fixture.open( 'r', encoding: 'binary' )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    27
	end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    28
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    29
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    30
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    31
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    32
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    33
### Mock with RSpec
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    34
RSpec.configure do |config|
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    35
	config.run_all_when_everything_filtered = true
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    36
	config.filter_run :focus
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    37
	config.order = 'random'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    38
	config.mock_with( :rspec ) do |mock|
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    39
		mock.syntax = :expect
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    40
	end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    41
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    42
	config.include( Mongrel2::SpecHelpers )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    43
	config.include( Thingfish::SpecHelpers )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    44
	config.include( Loggability::SpecHelpers )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    45
	config.include( Thingfish::Processor::PDF::SpecHelpers )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    46
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    47
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    48
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    49