forked from addisoncole/betsy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_helper.rb
More file actions
58 lines (48 loc) · 1.49 KB
/
Copy pathtest_helper.rb
File metadata and controls
58 lines (48 loc) · 1.49 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
require 'simplecov'
SimpleCov.start 'rails' do
add_filter '/bin/'
add_filter '/db/'
add_filter '/spec/' # for rspec
add_filter '/test/' # for minitest
end
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help"
require "minitest/rails"
require "minitest/reporters" # for Colorized output
# For colorful output!
Minitest::Reporters.use!(
Minitest::Reporters::SpecReporter.new,
ENV,
Minitest.backtrace_filter
)
# To add Capybara feature tests add `gem "minitest-rails-capybara"`
# to the test group in the Gemfile and uncomment the following:
# require "minitest/rails/capybara"
# Uncomment for awesome colorful output
# require "minitest/pride"
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
def setup
# Once you have enabled test mode, all requests
# to OmniAuth will be short circuited to use the mock authentication hash.
# A request to /auth/provider will redirect immediately to /auth/provider/callback.
OmniAuth.config.test_mode = true
end
def mock_auth_hash(user)
return {
provider: user.provider,
uid: user.uid,
info: {
email: user.email,
nickname: user.username
}
}
end
def perform_login(user)
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new(mock_auth_hash(user))
get login_path(:github)
end
end