2010-10-31 19:21:26 -07:00
|
|
|
#
|
2011-05-06 15:20:52 -07:00
|
|
|
# Running specs from the command line:
|
2011-05-06 17:35:49 -07:00
|
|
|
# $ rake spec # Entire spec suite.
|
2012-09-03 11:54:32 -07:00
|
|
|
# $ rspec spec/objects_spec.rb # Individual spec file.
|
2015-01-20 17:52:27 -02:00
|
|
|
require 'codeclimate-test-reporter'
|
|
|
|
CodeClimate::TestReporter.start
|
2010-03-24 21:31:59 -07:00
|
|
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
|
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
|
|
|
2014-12-31 13:04:42 -02:00
|
|
|
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each do |file|
|
|
|
|
require file
|
|
|
|
end
|
|
|
|
|
2014-12-31 18:59:32 -02:00
|
|
|
ExtVerifier.require_dependencies!(%w{rails active_record action_view
|
2014-01-07 02:10:56 -05:00
|
|
|
active_support/all mongoid mongo_mapper ripple nobrainer})
|
2014-12-31 18:59:32 -02:00
|
|
|
require 'nokogiri'
|
|
|
|
require 'awesome_print'
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.disable_monkey_patching!
|
|
|
|
# TODO: Make specs not order dependent
|
|
|
|
# config.order = :random
|
|
|
|
Kernel.srand config.seed
|
|
|
|
config.filter_run focus: true
|
|
|
|
config.run_all_when_everything_filtered = true
|
|
|
|
config.expect_with :rspec do |expectations|
|
|
|
|
expectations.syntax = :expect
|
|
|
|
end
|
|
|
|
config.mock_with :rspec do |mocks|
|
|
|
|
mocks.syntax = :expect
|
|
|
|
mocks.verify_partial_doubles = true
|
|
|
|
end
|
|
|
|
if config.files_to_run.one?
|
|
|
|
config.default_formatter = 'doc'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-04-08 19:57:58 -07:00
|
|
|
def stub_dotfile!
|
|
|
|
dotfile = File.join(ENV["HOME"], ".aprc")
|
2014-05-15 16:47:57 -04:00
|
|
|
expect(File).to receive(:readable?).at_least(:once).with(dotfile).and_return(false)
|
2010-03-24 21:31:59 -07:00
|
|
|
end
|
2011-05-04 20:20:07 -04:00
|
|
|
|
2012-09-05 21:55:04 -07:00
|
|
|
def capture!
|
|
|
|
standard, $stdout = $stdout, StringIO.new
|
|
|
|
yield
|
|
|
|
ensure
|
|
|
|
$stdout = standard
|
|
|
|
end
|