forked from hotsh/rstat.us
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_helper.rb
52 lines (46 loc) · 1.18 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
require 'simplecov'
SimpleCov.start do
add_filter "/models/all.rb"
add_filter "/config.rb"
add_filter "/test/"
add_group "Models", "/models"
add_group "Controllers", "/controllers"
coverage_dir "/test/coverage"
end
require 'minitest/autorun'
ENV['RACK_ENV'] = 'test'
require 'bundler'
Bundler.setup
Bundler.require(:default, :test)
require_relative 'factories'
require_relative '../rstatus'
module TestHelper
def app() Rstatus end
def setup
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.start
end
def teardown
DatabaseCleaner.clean
end
def auth_response(username, options={})
hsh = {
"provider" => options[:provider] || "twitter",
"uid" => options[:uid] || 12345,
"user_info" => {
"name" => "Joe Public",
"email" => "[email protected]",
"nickname" => username,
"urls" => { "Website" => "http://rstat.us" },
"description" => "A description",
"image" => "/images/something.png"
},
"credentials" => {
"token" => options[:token] || "1234",
"secret" => options[:secret] || "4567"
}
}
return hsh
end
end