forked from kentaro/webistrano
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_helper.rb
57 lines (44 loc) · 1.25 KB
/
test_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
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
#
def prepare_email
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []
return ActionMailer::Base.deliveries
end
# Add more helper methods to be used by all tests here...
def login(user=nil)
user ||= Factory(:user)
sign_in :user, user
return user
end
def admin_login(user=nil)
admin = login(user)
admin.make_admin!
return admin
end
def assert_include(expected, value)
assert_kind_of Array, value
assert value.include?(expected)
end
def assert_empty(value)
assert_kind_of Array, value
assert value.empty?
end
def assert_not_empty(value)
assert_kind_of Array, value
assert !value.empty?
end
end
class ActionController::TestCase
include Devise::TestHelpers
end