-
Notifications
You must be signed in to change notification settings - Fork 1
/
helper.rb
71 lines (54 loc) · 1.63 KB
/
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'simplecov'
SimpleCov.start
require 'rails'
require 'resque'
require 'rubygems'
require 'bundler'
require 'active_record'
require 'net/http'
#load Cleo Module for result and server
require File.dirname(__FILE__) + '/../lib/cleo/cleo'
#load Cleo reference
require File.dirname(__FILE__) + '/../lib/cleo/element'
#load xml elements
require File.dirname(__FILE__) + '/../lib/xml/connection'
require File.dirname(__FILE__) + '/../lib/xml/result'
#require acts_as_cleo
require File.dirname(__FILE__) + '/../lib/acts_as_cleo/acts_as_cleo'
#require acts_as_cleo_connection
require File.dirname(__FILE__) + '/../lib/acts_as_cleo_connection/acts_as_cleo_connection'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'test/unit'
require 'shoulda'
file_dirname = File.dirname(__FILE__)
#Load Lib
$LOAD_PATH.unshift(File.join(file_dirname, '..', 'lib'))
$LOAD_PATH.unshift file_dirname
#Load sqlilte for testing
sqlite = File.join(file_dirname, 'db', 'connection', 'sqlite')
require sqlite
#Load Database Cleaner
require 'database_cleaner'
DatabaseCleaner[:active_record].strategy = :truncation
# Load Models
models_dir = File.join(file_dirname, 'models')
Dir[ models_dir + '/*.rb'].each { |m| require m }
server_config = {:url => "http://localhost:8080/cleo-primer/", :run_async => false}
Cleo.configure server_config
class Test::Unit::TestCase
def setup
DatabaseCleaner.clean
end
def teardown
Author.destroy_all
Book.destroy_all
Category.destroy_all
Movie.destroy_all
end
end