application_insights 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +40 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +106 -0
- data/Rakefile +10 -0
- data/application_insights.gemspec +25 -0
- data/lib/application_insights.rb +2 -0
- data/lib/application_insights/channel/contracts/application.rb +35 -0
- data/lib/application_insights/channel/contracts/data.rb +47 -0
- data/lib/application_insights/channel/contracts/data_point.rb +125 -0
- data/lib/application_insights/channel/contracts/data_point_type.rb +16 -0
- data/lib/application_insights/channel/contracts/dependency_kind.rb +22 -0
- data/lib/application_insights/channel/contracts/dependency_source_type.rb +19 -0
- data/lib/application_insights/channel/contracts/device.rb +243 -0
- data/lib/application_insights/channel/contracts/envelope.rb +254 -0
- data/lib/application_insights/channel/contracts/event_data.rb +77 -0
- data/lib/application_insights/channel/contracts/exception_data.rb +105 -0
- data/lib/application_insights/channel/contracts/exception_details.rb +125 -0
- data/lib/application_insights/channel/contracts/internal.rb +51 -0
- data/lib/application_insights/channel/contracts/json_serializable.rb +59 -0
- data/lib/application_insights/channel/contracts/location.rb +35 -0
- data/lib/application_insights/channel/contracts/message_data.rb +76 -0
- data/lib/application_insights/channel/contracts/metric_data.rb +60 -0
- data/lib/application_insights/channel/contracts/operation.rb +83 -0
- data/lib/application_insights/channel/contracts/page_view_data.rb +109 -0
- data/lib/application_insights/channel/contracts/remote_dependency_data.rb +218 -0
- data/lib/application_insights/channel/contracts/request_data.rb +173 -0
- data/lib/application_insights/channel/contracts/session.rb +67 -0
- data/lib/application_insights/channel/contracts/severity_level.rb +25 -0
- data/lib/application_insights/channel/contracts/stack_frame.rb +91 -0
- data/lib/application_insights/channel/contracts/user.rb +83 -0
- data/lib/application_insights/channel/queue_base.rb +48 -0
- data/lib/application_insights/channel/sender_base.rb +46 -0
- data/lib/application_insights/channel/synchronous_queue.rb +28 -0
- data/lib/application_insights/channel/synchronous_sender.rb +13 -0
- data/lib/application_insights/channel/telemetry_channel.rb +81 -0
- data/lib/application_insights/channel/telemetry_context.rb +49 -0
- data/lib/application_insights/telemetry_client.rb +111 -0
- data/lib/application_insights/version.rb +3 -0
- data/test/application_insights.rb +9 -0
- data/test/application_insights/channel/contracts/test_application.rb +31 -0
- data/test/application_insights/channel/contracts/test_data.rb +44 -0
- data/test/application_insights/channel/contracts/test_data_point.rb +109 -0
- data/test/application_insights/channel/contracts/test_device.rb +200 -0
- data/test/application_insights/channel/contracts/test_envelope.rb +209 -0
- data/test/application_insights/channel/contracts/test_event_data.rb +62 -0
- data/test/application_insights/channel/contracts/test_exception_data.rb +85 -0
- data/test/application_insights/channel/contracts/test_exception_details.rb +106 -0
- data/test/application_insights/channel/contracts/test_internal.rb +44 -0
- data/test/application_insights/channel/contracts/test_location.rb +31 -0
- data/test/application_insights/channel/contracts/test_message_data.rb +66 -0
- data/test/application_insights/channel/contracts/test_metric_data.rb +50 -0
- data/test/application_insights/channel/contracts/test_operation.rb +70 -0
- data/test/application_insights/channel/contracts/test_page_view_data.rb +88 -0
- data/test/application_insights/channel/contracts/test_remote_dependency_data.rb +183 -0
- data/test/application_insights/channel/contracts/test_request_data.rb +153 -0
- data/test/application_insights/channel/contracts/test_session.rb +57 -0
- data/test/application_insights/channel/contracts/test_stack_frame.rb +83 -0
- data/test/application_insights/channel/contracts/test_user.rb +70 -0
- data/test/application_insights/channel/test_queue_base.rb +88 -0
- data/test/application_insights/channel/test_sender_base.rb +96 -0
- data/test/application_insights/channel/test_synchronous_queue.rb +42 -0
- data/test/application_insights/channel/test_synchronous_sender.rb +11 -0
- data/test/application_insights/channel/test_telemetry_channel.rb +102 -0
- data/test/application_insights/channel/test_telemetry_context.rb +72 -0
- data/test/application_insights/test_telemetry_client.rb +107 -0
- metadata +166 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/page_view_data'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestPageViewData < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::PageViewData.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ver_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::PageViewData.new
|
15
|
+
item.ver = expected
|
16
|
+
actual = item.ver
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 13
|
19
|
+
item.ver = expected
|
20
|
+
actual = item.ver
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_url_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::PageViewData.new
|
27
|
+
item.url = expected
|
28
|
+
actual = item.url
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.url = expected
|
32
|
+
actual = item.url
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_name_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::PageViewData.new
|
39
|
+
item.name = expected
|
40
|
+
actual = item.name
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.name = expected
|
44
|
+
actual = item.name
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_duration_works_as_expected
|
49
|
+
expected = 'Test string'
|
50
|
+
item = Contracts::PageViewData.new
|
51
|
+
item.duration = expected
|
52
|
+
actual = item.duration
|
53
|
+
assert_equal expected, actual
|
54
|
+
expected = 'Other string'
|
55
|
+
item.duration = expected
|
56
|
+
actual = item.duration
|
57
|
+
assert_equal expected, actual
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_properties_works_as_expected
|
61
|
+
item = Contracts::PageViewData.new
|
62
|
+
actual = item.properties
|
63
|
+
assert_not_nil actual
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_measurements_works_as_expected
|
67
|
+
item = Contracts::PageViewData.new
|
68
|
+
actual = item.measurements
|
69
|
+
assert_not_nil actual
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_to_json_works_as_expected
|
73
|
+
item = Contracts::PageViewData.new
|
74
|
+
item.ver = 42
|
75
|
+
item.url = 'Test string'
|
76
|
+
item.name = 'Test string'
|
77
|
+
item.duration = 'Test string'
|
78
|
+
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
79
|
+
item.properties[key] = value
|
80
|
+
end
|
81
|
+
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
82
|
+
item.measurements[key] = value
|
83
|
+
end
|
84
|
+
actual = item.to_json
|
85
|
+
expected = '{"ver":42,"url":"Test string","name":"Test string","duration":"Test string","properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
86
|
+
assert_equal expected, actual
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/remote_dependency_data'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestRemoteDependencyData < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::RemoteDependencyData.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ver_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::RemoteDependencyData.new
|
15
|
+
item.ver = expected
|
16
|
+
actual = item.ver
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 13
|
19
|
+
item.ver = expected
|
20
|
+
actual = item.ver
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_name_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::RemoteDependencyData.new
|
27
|
+
item.name = expected
|
28
|
+
actual = item.name
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.name = expected
|
32
|
+
actual = item.name
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_kind_works_as_expected
|
37
|
+
expected = { 'key' => 'value' }
|
38
|
+
item = Contracts::RemoteDependencyData.new
|
39
|
+
item.kind = expected
|
40
|
+
actual = item.kind
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = { 'key' => 'value' }
|
43
|
+
item.kind = expected
|
44
|
+
actual = item.kind
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_value_works_as_expected
|
49
|
+
expected = 1.5
|
50
|
+
item = Contracts::RemoteDependencyData.new
|
51
|
+
item.value = expected
|
52
|
+
actual = item.value
|
53
|
+
assert_equal expected, actual
|
54
|
+
expected = 4.8
|
55
|
+
item.value = expected
|
56
|
+
actual = item.value
|
57
|
+
assert_equal expected, actual
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_count_works_as_expected
|
61
|
+
expected = 42
|
62
|
+
item = Contracts::RemoteDependencyData.new
|
63
|
+
item.count = expected
|
64
|
+
actual = item.count
|
65
|
+
assert_equal expected, actual
|
66
|
+
expected = 13
|
67
|
+
item.count = expected
|
68
|
+
actual = item.count
|
69
|
+
assert_equal expected, actual
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_min_works_as_expected
|
73
|
+
expected = 1.5
|
74
|
+
item = Contracts::RemoteDependencyData.new
|
75
|
+
item.min = expected
|
76
|
+
actual = item.min
|
77
|
+
assert_equal expected, actual
|
78
|
+
expected = 4.8
|
79
|
+
item.min = expected
|
80
|
+
actual = item.min
|
81
|
+
assert_equal expected, actual
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_max_works_as_expected
|
85
|
+
expected = 1.5
|
86
|
+
item = Contracts::RemoteDependencyData.new
|
87
|
+
item.max = expected
|
88
|
+
actual = item.max
|
89
|
+
assert_equal expected, actual
|
90
|
+
expected = 4.8
|
91
|
+
item.max = expected
|
92
|
+
actual = item.max
|
93
|
+
assert_equal expected, actual
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_std_dev_works_as_expected
|
97
|
+
expected = 1.5
|
98
|
+
item = Contracts::RemoteDependencyData.new
|
99
|
+
item.std_dev = expected
|
100
|
+
actual = item.std_dev
|
101
|
+
assert_equal expected, actual
|
102
|
+
expected = 4.8
|
103
|
+
item.std_dev = expected
|
104
|
+
actual = item.std_dev
|
105
|
+
assert_equal expected, actual
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_dependency_kind_works_as_expected
|
109
|
+
expected = { 'key' => 'value' }
|
110
|
+
item = Contracts::RemoteDependencyData.new
|
111
|
+
item.dependency_kind = expected
|
112
|
+
actual = item.dependency_kind
|
113
|
+
assert_equal expected, actual
|
114
|
+
expected = { 'key' => 'value' }
|
115
|
+
item.dependency_kind = expected
|
116
|
+
actual = item.dependency_kind
|
117
|
+
assert_equal expected, actual
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_success_works_as_expected
|
121
|
+
expected = TRUE
|
122
|
+
item = Contracts::RemoteDependencyData.new
|
123
|
+
item.success = expected
|
124
|
+
actual = item.success
|
125
|
+
assert_equal expected, actual
|
126
|
+
expected = FALSE
|
127
|
+
item.success = expected
|
128
|
+
actual = item.success
|
129
|
+
assert_equal expected, actual
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_async_works_as_expected
|
133
|
+
expected = TRUE
|
134
|
+
item = Contracts::RemoteDependencyData.new
|
135
|
+
item.async = expected
|
136
|
+
actual = item.async
|
137
|
+
assert_equal expected, actual
|
138
|
+
expected = FALSE
|
139
|
+
item.async = expected
|
140
|
+
actual = item.async
|
141
|
+
assert_equal expected, actual
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_dependency_source_works_as_expected
|
145
|
+
expected = { 'key' => 'value' }
|
146
|
+
item = Contracts::RemoteDependencyData.new
|
147
|
+
item.dependency_source = expected
|
148
|
+
actual = item.dependency_source
|
149
|
+
assert_equal expected, actual
|
150
|
+
expected = { 'key' => 'value' }
|
151
|
+
item.dependency_source = expected
|
152
|
+
actual = item.dependency_source
|
153
|
+
assert_equal expected, actual
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_properties_works_as_expected
|
157
|
+
item = Contracts::RemoteDependencyData.new
|
158
|
+
actual = item.properties
|
159
|
+
assert_not_nil actual
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_to_json_works_as_expected
|
163
|
+
item = Contracts::RemoteDependencyData.new
|
164
|
+
item.ver = 42
|
165
|
+
item.name = 'Test string'
|
166
|
+
item.kind = { 'key' => 'value' }
|
167
|
+
item.value = 1.5
|
168
|
+
item.count = 42
|
169
|
+
item.min = 1.5
|
170
|
+
item.max = 1.5
|
171
|
+
item.std_dev = 1.5
|
172
|
+
item.dependency_kind = { 'key' => 'value' }
|
173
|
+
item.success = TRUE
|
174
|
+
item.async = TRUE
|
175
|
+
item.dependency_source = { 'key' => 'value' }
|
176
|
+
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
177
|
+
item.properties[key] = value
|
178
|
+
end
|
179
|
+
actual = item.to_json
|
180
|
+
expected = '{"ver":42,"name":"Test string","kind":{"key":"value"},"value":1.5,"count":42,"min":1.5,"max":1.5,"stdDev":1.5,"dependencyKind":{"key":"value"},"success":true,"async":true,"dependencySource":{"key":"value"},"properties":{"key1":"test value 1","key2":"test value 2"}}'
|
181
|
+
assert_equal expected, actual
|
182
|
+
end
|
183
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/request_data'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestRequestData < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::RequestData.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ver_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::RequestData.new
|
15
|
+
item.ver = expected
|
16
|
+
actual = item.ver
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 13
|
19
|
+
item.ver = expected
|
20
|
+
actual = item.ver
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_id_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::RequestData.new
|
27
|
+
item.id = expected
|
28
|
+
actual = item.id
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.id = expected
|
32
|
+
actual = item.id
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_name_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::RequestData.new
|
39
|
+
item.name = expected
|
40
|
+
actual = item.name
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.name = expected
|
44
|
+
actual = item.name
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_start_time_works_as_expected
|
49
|
+
expected = 'Test string'
|
50
|
+
item = Contracts::RequestData.new
|
51
|
+
item.start_time = expected
|
52
|
+
actual = item.start_time
|
53
|
+
assert_equal expected, actual
|
54
|
+
expected = 'Other string'
|
55
|
+
item.start_time = expected
|
56
|
+
actual = item.start_time
|
57
|
+
assert_equal expected, actual
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_duration_works_as_expected
|
61
|
+
expected = 'Test string'
|
62
|
+
item = Contracts::RequestData.new
|
63
|
+
item.duration = expected
|
64
|
+
actual = item.duration
|
65
|
+
assert_equal expected, actual
|
66
|
+
expected = 'Other string'
|
67
|
+
item.duration = expected
|
68
|
+
actual = item.duration
|
69
|
+
assert_equal expected, actual
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_response_code_works_as_expected
|
73
|
+
expected = 'Test string'
|
74
|
+
item = Contracts::RequestData.new
|
75
|
+
item.response_code = expected
|
76
|
+
actual = item.response_code
|
77
|
+
assert_equal expected, actual
|
78
|
+
expected = 'Other string'
|
79
|
+
item.response_code = expected
|
80
|
+
actual = item.response_code
|
81
|
+
assert_equal expected, actual
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_success_works_as_expected
|
85
|
+
expected = TRUE
|
86
|
+
item = Contracts::RequestData.new
|
87
|
+
item.success = expected
|
88
|
+
actual = item.success
|
89
|
+
assert_equal expected, actual
|
90
|
+
expected = FALSE
|
91
|
+
item.success = expected
|
92
|
+
actual = item.success
|
93
|
+
assert_equal expected, actual
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_http_method_works_as_expected
|
97
|
+
expected = 'Test string'
|
98
|
+
item = Contracts::RequestData.new
|
99
|
+
item.http_method = expected
|
100
|
+
actual = item.http_method
|
101
|
+
assert_equal expected, actual
|
102
|
+
expected = 'Other string'
|
103
|
+
item.http_method = expected
|
104
|
+
actual = item.http_method
|
105
|
+
assert_equal expected, actual
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_url_works_as_expected
|
109
|
+
expected = 'Test string'
|
110
|
+
item = Contracts::RequestData.new
|
111
|
+
item.url = expected
|
112
|
+
actual = item.url
|
113
|
+
assert_equal expected, actual
|
114
|
+
expected = 'Other string'
|
115
|
+
item.url = expected
|
116
|
+
actual = item.url
|
117
|
+
assert_equal expected, actual
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_properties_works_as_expected
|
121
|
+
item = Contracts::RequestData.new
|
122
|
+
actual = item.properties
|
123
|
+
assert_not_nil actual
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_measurements_works_as_expected
|
127
|
+
item = Contracts::RequestData.new
|
128
|
+
actual = item.measurements
|
129
|
+
assert_not_nil actual
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_to_json_works_as_expected
|
133
|
+
item = Contracts::RequestData.new
|
134
|
+
item.ver = 42
|
135
|
+
item.id = 'Test string'
|
136
|
+
item.name = 'Test string'
|
137
|
+
item.start_time = 'Test string'
|
138
|
+
item.duration = 'Test string'
|
139
|
+
item.response_code = 'Test string'
|
140
|
+
item.success = TRUE
|
141
|
+
item.http_method = 'Test string'
|
142
|
+
item.url = 'Test string'
|
143
|
+
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
144
|
+
item.properties[key] = value
|
145
|
+
end
|
146
|
+
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
147
|
+
item.measurements[key] = value
|
148
|
+
end
|
149
|
+
actual = item.to_json
|
150
|
+
expected = '{"ver":42,"id":"Test string","name":"Test string","startTime":"Test string","duration":"Test string","responseCode":"Test string","success":true,"httpMethod":"Test string","url":"Test string","properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
151
|
+
assert_equal expected, actual
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/session'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestSession < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::Session.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_id_works_as_expected
|
13
|
+
expected = 'Test string'
|
14
|
+
item = Contracts::Session.new
|
15
|
+
item.id = expected
|
16
|
+
actual = item.id
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 'Other string'
|
19
|
+
item.id = expected
|
20
|
+
actual = item.id
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_is_first_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::Session.new
|
27
|
+
item.is_first = expected
|
28
|
+
actual = item.is_first
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.is_first = expected
|
32
|
+
actual = item.is_first
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_is_new_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::Session.new
|
39
|
+
item.is_new = expected
|
40
|
+
actual = item.is_new
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.is_new = expected
|
44
|
+
actual = item.is_new
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_to_json_works_as_expected
|
49
|
+
item = Contracts::Session.new
|
50
|
+
item.id = 'Test string'
|
51
|
+
item.is_first = 'Test string'
|
52
|
+
item.is_new = 'Test string'
|
53
|
+
actual = item.to_json
|
54
|
+
expected = '{"ai.session.id":"Test string","ai.session.isFirst":"Test string","ai.session.isNew":"Test string"}'
|
55
|
+
assert_equal expected, actual
|
56
|
+
end
|
57
|
+
end
|