/
helper.rb
79 lines (62 loc) · 1.5 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
72
73
74
75
76
77
78
79
require 'simplecov'
require 'coveralls'
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
SimpleCov.start do
add_filter '/spec/'
add_filter '/vendor/'
minimum_coverage(99.55)
end
require 'twitter'
require 'rspec'
require 'stringio'
require 'tempfile'
require 'timecop'
require 'webmock/rspec'
require File.expand_path('../support/media_object_examples', __FILE__)
WebMock.disable_net_connect!(allow: 'coveralls.io')
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
def a_delete(path)
a_request(:delete, Twitter::REST::Client::BASE_URL + path)
end
def a_get(path)
a_request(:get, Twitter::REST::Client::BASE_URL + path)
end
def a_post(path)
a_request(:post, Twitter::REST::Client::BASE_URL + path)
end
def a_put(path)
a_request(:put, Twitter::REST::Client::BASE_URL + path)
end
def stub_delete(path)
stub_request(:delete, Twitter::REST::Client::BASE_URL + path)
end
def stub_get(path)
stub_request(:get, Twitter::REST::Client::BASE_URL + path)
end
def stub_post(path)
stub_request(:post, Twitter::REST::Client::BASE_URL + path)
end
def stub_put(path)
stub_request(:put, Twitter::REST::Client::BASE_URL + path)
end
def fixture_path
File.expand_path('../fixtures', __FILE__)
end
def fixture(file)
File.new(fixture_path + '/' + file)
end
def capture_warning
begin
old_stderr = $stderr
$stderr = StringIO.new
yield
result = $stderr.string
ensure
$stderr = old_stderr
end
result
end