-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathspec_helper.rb
56 lines (46 loc) · 1.36 KB
/
spec_helper.rb
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
54
55
56
# encoding: utf-8
require 'simplecov'
SimpleCov.start
#-----------------------------------------------------------------------------#
require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
require 'bundler/setup'
require 'bacon'
require 'mocha-on-bacon'
require 'pretty_bacon'
require 'claide'
require 'spec_helper/fixtures'
require 'spec_helper/rubygems'
require 'spec_helper/string_ext'
#-- Helpers ------------------------------------------------------------------#
module Bacon
class Context
def should_raise_help(error_message)
error = nil
begin
yield
rescue CLAide::Help => e
error = e
end
error.should.not.nil?
error.error_message.should == error_message
end
end
end
#-- Spec environment ---------------------------------------------------------#
# Specs should produce the same output regardless whether they are called from
# a TTY or not.
#
CLAide::Command.ansi_output = false
Mocha::Configuration.prevent(:stubbing_non_existent_method)
module Bacon
class Context
old_run_requirement = instance_method(:run_requirement)
define_method(:run_requirement) do |description, spec|
::CLAide::ANSI.disabled = true
old_run_requirement.bind(self).call(description, spec)
end
end
end