spec_helper.rb
1.63 KB
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
57
58
59
60
61
62
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
if ENV['COVERAGE']
require 'coveralls'
require 'simplecov'
Coveralls.wear!('rails') do
add_filter 'bundle'
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start('rails') do
add_filter 'bundle'
end
end
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'database_cleaner'
require 'webmock/rspec'
require 'xmpp4r'
require 'xmpp4r/muc'
require 'mongoid-rspec'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
Fabrication.configure do |config|
fabricator_dir = "spec/fabricators"
end
RSpec.configure do |config|
config.mock_with :rspec
config.include Devise::TestHelpers, :type => :controller
config.include Mongoid::Matchers, :type => :model
config.filter_run :focused => true
config.run_all_when_everything_filtered = true
config.alias_example_to :fit, :focused => true
config.before(:each) do
DatabaseCleaner[:mongoid].strategy = :truncation
DatabaseCleaner.clean
end
config.include WebMock::API
config.include Haml, :type => :helper
config.include Haml::Helpers, :type => :helper
config.before(:each, :type => :helper) do |config|
init_haml_helpers
end
config.after(:all) do
WebMock.disable_net_connect! :allow => /coveralls\.io/
end
end
OmniAuth.config.test_mode = true