r7insight 2.7.6 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +7 -0
- data/.travis.yml +13 -0
- data/CONTRIBUTING.md +31 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +39 -0
- data/LICENSE +2 -2
- data/Makefile +34 -0
- data/README.md +19 -18
- data/Rakefile +9 -7
- data/lib/{le.rb → r7_insight.rb} +19 -28
- data/lib/{le → r7_insight}/host.rb +11 -7
- data/lib/r7_insight/host/connection.rb +309 -0
- data/r7insight.gemspec +31 -0
- data/test/host_spec.rb +18 -14
- data/test/http_spec.rb +42 -23
- data/test/r7insight_spec.rb +312 -0
- data/test/region.rb +47 -26
- data/test/spec_helper.rb +3 -1
- metadata +45 -29
- data/LE.gemspec +0 -29
- data/lib/le/host/connection.rb +0 -315
- data/test/le_spec.rb +0 -142
data/test/le_spec.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Le do
|
4
|
-
|
5
|
-
let(:token) { '11111111-2222-3333-aaaa-bbbbbbbbbbbb' }
|
6
|
-
let(:local) { false }
|
7
|
-
let(:logger) { Le.new(token, local: local) }
|
8
|
-
let(:logdev) { logger.instance_variable_get(:@logdev).dev }
|
9
|
-
let(:logger_console) { logdev.instance_variable_get(:@logger_console) }
|
10
|
-
let(:logger_console_dev) { logger_console.instance_variable_get(:@logdev).dev }
|
11
|
-
|
12
|
-
|
13
|
-
describe "when non-Rails environment" do
|
14
|
-
|
15
|
-
describe "when initialised with just a token" do
|
16
|
-
let(:logger) { Le.new(token) }
|
17
|
-
specify { logger.must_be_instance_of Logger }
|
18
|
-
specify { logdev.must_be_instance_of Le::Host::HTTP }
|
19
|
-
specify { logdev.local.must_equal false }
|
20
|
-
specify { logger_console.must_be_nil }
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "and :local is false" do
|
24
|
-
specify { logdev.local.must_equal false }
|
25
|
-
specify { logger_console.must_be_nil }
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "and :local is true" do
|
29
|
-
let(:local) { true }
|
30
|
-
|
31
|
-
specify { logdev.local.must_equal true }
|
32
|
-
specify { logger_console.must_be_instance_of Logger }
|
33
|
-
specify { logger_console_dev.must_be_instance_of IO }
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
describe "and :local => " do
|
38
|
-
let(:local_test_log) { Pathname.new(File.dirname(__FILE__)).join('fixtures','log','local_log.log') }
|
39
|
-
let(:local) { log_file }
|
40
|
-
|
41
|
-
describe "Pathname" do
|
42
|
-
let(:log_file) { local_test_log }
|
43
|
-
|
44
|
-
specify { logdev.must_be_instance_of Le::Host::HTTP }
|
45
|
-
specify { logdev.local.must_equal true }
|
46
|
-
specify { logger_console.must_be_instance_of Logger }
|
47
|
-
specify { logger_console_dev.must_be_instance_of File }
|
48
|
-
specify { logger_console_dev.path.must_match 'local_log.log' }
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "path string" do
|
52
|
-
let(:log_file) { local_test_log.to_s }
|
53
|
-
|
54
|
-
specify { logdev.must_be_instance_of Le::Host::HTTP }
|
55
|
-
specify { logdev.local.must_equal true }
|
56
|
-
specify { logger_console.must_be_instance_of Logger }
|
57
|
-
specify { logger_console_dev.must_be_instance_of File }
|
58
|
-
specify { logger_console_dev.path.must_match 'local_log.log' }
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "File" do
|
62
|
-
let(:log_file) { File.new(local_test_log, 'w') }
|
63
|
-
|
64
|
-
specify { logdev.must_be_instance_of Le::Host::HTTP }
|
65
|
-
specify { logdev.local.must_equal true }
|
66
|
-
specify { logger_console.must_be_instance_of Logger }
|
67
|
-
specify { logger_console_dev.must_be_instance_of File }
|
68
|
-
specify { logger_console_dev.path.must_match 'local_log.log' }
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "when Rails environment" do
|
76
|
-
before do
|
77
|
-
class Rails
|
78
|
-
def self.root
|
79
|
-
Pathname.new(File.dirname(__FILE__)).join('fixtures')
|
80
|
-
end
|
81
|
-
def self.env
|
82
|
-
'test'
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
after do
|
87
|
-
Object.send(:remove_const, :Rails)
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "and :local is false" do
|
91
|
-
specify { logdev.local.must_equal false }
|
92
|
-
specify { logger_console.must_be_nil }
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "and :local is true" do
|
96
|
-
let(:local) { true }
|
97
|
-
|
98
|
-
specify { logdev.local.must_equal true }
|
99
|
-
specify { logger_console.must_be_instance_of Logger }
|
100
|
-
specify { logger_console_dev.must_be_instance_of File }
|
101
|
-
specify { logger_console_dev.path.must_match 'test.log' }
|
102
|
-
end
|
103
|
-
|
104
|
-
describe "and :local => " do
|
105
|
-
let(:local_test_log) { Pathname.new(File.dirname(__FILE__)).join('fixtures','log','local_log.log') }
|
106
|
-
let(:local) { log_file }
|
107
|
-
|
108
|
-
describe "Pathname" do
|
109
|
-
let(:log_file) { local_test_log }
|
110
|
-
|
111
|
-
specify { logdev.must_be_instance_of Le::Host::HTTP }
|
112
|
-
specify { logdev.local.must_equal true }
|
113
|
-
specify { logger_console.must_be_instance_of Logger }
|
114
|
-
specify { logger_console_dev.must_be_instance_of File }
|
115
|
-
specify { logger_console_dev.path.must_match 'local_log.log' }
|
116
|
-
end
|
117
|
-
|
118
|
-
describe "path string" do
|
119
|
-
let(:log_file) { local_test_log.to_s }
|
120
|
-
|
121
|
-
specify { logdev.must_be_instance_of Le::Host::HTTP }
|
122
|
-
specify { logdev.local.must_equal true }
|
123
|
-
specify { logger_console.must_be_instance_of Logger }
|
124
|
-
specify { logger_console_dev.must_be_instance_of File }
|
125
|
-
specify { logger_console_dev.path.must_match 'local_log.log' }
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "File" do
|
129
|
-
let(:log_file) { File.new(local_test_log, 'w') }
|
130
|
-
|
131
|
-
specify { logdev.must_be_instance_of Le::Host::HTTP }
|
132
|
-
specify { logdev.local.must_equal true }
|
133
|
-
specify { logger_console.must_be_instance_of Logger }
|
134
|
-
specify { logger_console_dev.must_be_instance_of File }
|
135
|
-
specify { logger_console_dev.path.must_match 'local_log.log' }
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
end
|
141
|
-
|
142
|
-
end
|