forked from bears4barrett/CloudMux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec_helper.rb
55 lines (44 loc) · 1.38 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
# test env
require 'rspec'
require 'factory_girl'
require 'simplecov'
require 'coveralls'
require 'webmock/rspec'
#
# [XXX] Disabling Network Access for tests
#
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
#Coveralls.wear!
# gems required only for tests
# require 'open-uri'
# Setup the rack environment to signal test mode to all gems and configurations
ENV['RACK_ENV'] = 'test'
# require the dependencies
require File.join(File.dirname(__FILE__), '..', 'lib', 'core')
require File.join(File.dirname(__FILE__), 'support', 'fake_ansible')
WebMock.disable_net_connect! allow_localhost:true
# from http://robots.thoughtbot.com/how-to-stub-external-services-in-tests/
RSpec.configure do |config|
config.before :each do
stub_request(:any, /.*the.ansibleserver.com.*/).to_rack FakeAnsible
end
end
#
# Helper methods
#
def file(filename)
File.new(filename).readlines.join("\n")
end
def create_project
@cloud_credential = FactoryGirl.build(:cloud_credential)
@owner = FactoryGirl.build(:account, :login=>"standard_subscriber_1", :email=>"[email protected]")
#@owner.cloud_accounts << @cloud_account
@owner.save
@project = FactoryGirl.create(:project, :cloud_credential=>@cloud_credential, :owner=>@owner)
@project
end