lws 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/lib/lws/auth.rb +6 -25
- data/lib/lws/corporate_website.rb +6 -7
- data/lib/lws/generic.rb +6 -9
- data/lib/lws/maps.rb +4 -9
- data/lib/lws/presence.rb +4 -6
- data/lib/lws/stubbing.rb +11 -0
- data/lib/lws/ticket.rb +5 -20
- data/lib/lws/version.rb +2 -1
- data/lib/lws.rb +7 -2
- data/test/api_token_middleware_test.rb +1 -0
- data/test/auth_test.rb +1 -0
- data/test/caching_test.rb +1 -0
- data/test/{test_corporate_website.rb → corporate_website_test.rb} +1 -0
- data/test/generic_test.rb +1 -0
- data/test/logger_test.rb +1 -0
- data/test/maps_test.rb +1 -0
- data/test/presence_test.rb +1 -0
- data/test/setup_test.rb +42 -0
- data/test/stubbing_test.rb +1 -0
- data/test/support/with_env.rb +24 -0
- data/test/test_helper.rb +5 -1
- data/test/{test_ticket.rb → ticket_test.rb} +2 -1
- metadata +10 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8a4f59dac348f40f4c5530b07d71147a9c4078e
|
|
4
|
+
data.tar.gz: 94615b304d6d65389c35b1ee741cfb5e7d6cdfc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afbc173c984051c4577386663d57e31166fcbca9428ef17f8a5a4f293be346061ee9adc35d0a865aff52a005513cca2cf2946174a229d6965999a7ea4836d23f
|
|
7
|
+
data.tar.gz: 9ca37c4dc44a665191bf06163f52f340de2e49c1d0cec30b16b3914f9df1f8ffc28f17699db5c82ee279a81aaed11128a040b25fb75bb1e7b14d5cd803457d8f
|
data/Rakefile
CHANGED
data/lib/lws/auth.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# = The auth app module
|
|
2
1
|
#
|
|
3
2
|
# Copyright © 2016 LeftClick B.V.
|
|
4
3
|
#
|
|
@@ -9,15 +8,19 @@
|
|
|
9
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
10
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
11
10
|
|
|
11
|
+
|
|
12
|
+
# = The auth app module
|
|
12
13
|
module LWS::Auth
|
|
13
14
|
|
|
15
|
+
# :nocov:
|
|
14
16
|
unless defined? ENDPOINT
|
|
15
17
|
# The API endpoint for the auth app
|
|
16
18
|
ENDPOINT = { production: "https://leftclick.cloud/" ,
|
|
17
19
|
development: "https://dev.leftclick.cloud/" }
|
|
18
20
|
end
|
|
21
|
+
# :nocov:
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
#@!visibility private
|
|
21
24
|
def self.api
|
|
22
25
|
LWS.setup_api(LWS.config.endpoints[:auth] ||
|
|
23
26
|
ENDPOINT[LWS.config.environment])
|
|
@@ -77,10 +80,6 @@ module LWS::Auth
|
|
|
77
80
|
|
|
78
81
|
#@!attribute updated_at
|
|
79
82
|
# @return [String] the timestamp of when the account was last updated
|
|
80
|
-
|
|
81
|
-
def initialize(attrs = {})
|
|
82
|
-
super
|
|
83
|
-
end
|
|
84
83
|
end
|
|
85
84
|
|
|
86
85
|
# = The app class
|
|
@@ -111,9 +110,7 @@ module LWS::Auth
|
|
|
111
110
|
#@!attribute updated_at
|
|
112
111
|
# @return [String] the timestamp of when the app was last updated
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
super
|
|
116
|
-
end
|
|
113
|
+
self # To ensure that YARD does not skip the attributes of this class
|
|
117
114
|
end
|
|
118
115
|
|
|
119
116
|
# = The company class
|
|
@@ -168,10 +165,6 @@ module LWS::Auth
|
|
|
168
165
|
|
|
169
166
|
#@!attribute updated_at
|
|
170
167
|
# @return [String] the timestamp of when the company was last updated
|
|
171
|
-
|
|
172
|
-
def initialize(attrs = {})
|
|
173
|
-
super
|
|
174
|
-
end
|
|
175
168
|
end
|
|
176
169
|
|
|
177
170
|
# = The device class
|
|
@@ -199,10 +192,6 @@ module LWS::Auth
|
|
|
199
192
|
|
|
200
193
|
#@!attribute updated_at
|
|
201
194
|
# @return [String] the timestamp of when the device was last updated
|
|
202
|
-
|
|
203
|
-
def initialize(attrs = {})
|
|
204
|
-
super
|
|
205
|
-
end
|
|
206
195
|
end
|
|
207
196
|
|
|
208
197
|
# = The token class
|
|
@@ -259,10 +248,6 @@ module LWS::Auth
|
|
|
259
248
|
|
|
260
249
|
#@!attribute updated_at
|
|
261
250
|
# @return [String] the timestamp of when the token was last updated
|
|
262
|
-
|
|
263
|
-
def initialize(attrs = {})
|
|
264
|
-
super
|
|
265
|
-
end
|
|
266
251
|
end
|
|
267
252
|
|
|
268
253
|
# = The user class
|
|
@@ -293,10 +278,6 @@ module LWS::Auth
|
|
|
293
278
|
|
|
294
279
|
#@!attribute updated_at
|
|
295
280
|
# @return [String] the timestamp of when the user was last updated
|
|
296
|
-
|
|
297
|
-
def initialize(attrs = {})
|
|
298
|
-
super
|
|
299
|
-
end
|
|
300
281
|
end
|
|
301
282
|
|
|
302
283
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# = The corporate website app module
|
|
2
1
|
#
|
|
3
2
|
# Copyright © 2016 LeftClick B.V.
|
|
4
3
|
#
|
|
@@ -9,13 +8,17 @@
|
|
|
9
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
10
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
11
10
|
|
|
11
|
+
|
|
12
|
+
# = The corporate website app module
|
|
12
13
|
module LWS::CorporateWebsite
|
|
13
14
|
|
|
15
|
+
# :nocov:
|
|
14
16
|
unless defined? ENDPOINT
|
|
15
17
|
# The API endpoint for the corporate website app
|
|
16
18
|
ENDPOINT = { production: "https://www.leftclick.cloud/",
|
|
17
19
|
development: "https://www-dev.leftclick.cloud/" }
|
|
18
20
|
end
|
|
21
|
+
# :nocov:
|
|
19
22
|
|
|
20
23
|
#@!visibility private
|
|
21
24
|
def self.api
|
|
@@ -101,9 +104,7 @@ module LWS::CorporateWebsite
|
|
|
101
104
|
#@!attribute updated_at
|
|
102
105
|
# @return [String] the timestamp of when the article was last updated
|
|
103
106
|
|
|
104
|
-
|
|
105
|
-
super
|
|
106
|
-
end
|
|
107
|
+
self # To ensure that YARD does not skip the attributes of this class
|
|
107
108
|
end
|
|
108
109
|
|
|
109
110
|
# = The opening hours class
|
|
@@ -138,9 +139,7 @@ module LWS::CorporateWebsite
|
|
|
138
139
|
#@!attribute updated_at
|
|
139
140
|
# @return [String] the timestamp of when the office time was last updated
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
super
|
|
143
|
-
end
|
|
142
|
+
self # To ensure that YARD does not skip the attributes of this class
|
|
144
143
|
end
|
|
145
144
|
|
|
146
145
|
end
|
data/lib/lws/generic.rb
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
# = The generic app module
|
|
2
|
-
#
|
|
3
|
-
# This module contains classes that are present in all applications.
|
|
4
1
|
#
|
|
5
2
|
# Copyright © 2016 LeftClick B.V.
|
|
6
3
|
#
|
|
@@ -11,6 +8,10 @@
|
|
|
11
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
12
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
13
10
|
|
|
11
|
+
|
|
12
|
+
# = The generic app module
|
|
13
|
+
#
|
|
14
|
+
# This module contains classes that are present in all applications.
|
|
14
15
|
module LWS::Generic
|
|
15
16
|
|
|
16
17
|
# = The generic model class
|
|
@@ -37,9 +38,7 @@ module LWS::Generic
|
|
|
37
38
|
#@!attribute updated_at
|
|
38
39
|
# @return [String] the timestamp of when the configuration was last updated
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
super
|
|
42
|
-
end
|
|
41
|
+
self # To ensure that YARD does not skip the attributes of this class
|
|
43
42
|
end
|
|
44
43
|
|
|
45
44
|
# = The task class
|
|
@@ -74,9 +73,7 @@ module LWS::Generic
|
|
|
74
73
|
#@!attribute updated_at
|
|
75
74
|
# @return [String] the timestamp of when the map was last updated
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
super
|
|
79
|
-
end
|
|
76
|
+
self # To ensure that YARD does not skip the attributes of this class
|
|
80
77
|
end
|
|
81
78
|
|
|
82
79
|
end
|
data/lib/lws/maps.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# = The maps app module
|
|
2
1
|
#
|
|
3
2
|
# Copyright © 2016 LeftClick B.V.
|
|
4
3
|
#
|
|
@@ -9,13 +8,17 @@
|
|
|
9
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
10
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
11
10
|
|
|
11
|
+
|
|
12
|
+
# = The maps app module
|
|
12
13
|
module LWS::Maps
|
|
13
14
|
|
|
15
|
+
# :nocov:
|
|
14
16
|
unless defined? ENDPOINT
|
|
15
17
|
# The API endpoint for the map app
|
|
16
18
|
ENDPOINT = { production: "https://maps.leftclick.cloud/",
|
|
17
19
|
development: "https://maps-dev.leftclick.cloud/" }
|
|
18
20
|
end
|
|
21
|
+
# :nocov:
|
|
19
22
|
|
|
20
23
|
#@!visibility private
|
|
21
24
|
def self.api
|
|
@@ -63,10 +66,6 @@ module LWS::Maps
|
|
|
63
66
|
|
|
64
67
|
#@!attribute updated_at
|
|
65
68
|
# @return [String] the timestamp of when the map was last updated
|
|
66
|
-
|
|
67
|
-
def initialize(attrs = {})
|
|
68
|
-
super
|
|
69
|
-
end
|
|
70
69
|
end
|
|
71
70
|
|
|
72
71
|
# = The map marker class
|
|
@@ -100,10 +99,6 @@ module LWS::Maps
|
|
|
100
99
|
|
|
101
100
|
#@!attribute updated_at
|
|
102
101
|
# @return [String] the timestamp of when the map marker was last updated
|
|
103
|
-
|
|
104
|
-
def initialize(attrs={})
|
|
105
|
-
super
|
|
106
|
-
end
|
|
107
102
|
end
|
|
108
103
|
|
|
109
104
|
end
|
data/lib/lws/presence.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# = The presence app module
|
|
2
1
|
#
|
|
3
2
|
# Copyright © 2016 LeftClick B.V.
|
|
4
3
|
#
|
|
@@ -9,13 +8,17 @@
|
|
|
9
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
10
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
11
10
|
|
|
11
|
+
|
|
12
|
+
# = The presence app module
|
|
12
13
|
module LWS::Presence
|
|
13
14
|
|
|
15
|
+
# :nocov:
|
|
14
16
|
unless defined? ENDPOINT
|
|
15
17
|
# The API endpoint for the presence app
|
|
16
18
|
ENDPOINT = { production: "https://presence.leftclick.cloud/",
|
|
17
19
|
development: "https://presence-dev.leftclick.cloud/" }
|
|
18
20
|
end
|
|
21
|
+
# :nocov:
|
|
19
22
|
|
|
20
23
|
#@!visibility private
|
|
21
24
|
def self.api
|
|
@@ -76,10 +79,6 @@ module LWS::Presence
|
|
|
76
79
|
|
|
77
80
|
#@!attribute updated_at
|
|
78
81
|
# @return [String] the timestamp of when the location was last updated
|
|
79
|
-
|
|
80
|
-
def initialize(attrs = {})
|
|
81
|
-
super
|
|
82
|
-
end
|
|
83
82
|
end
|
|
84
83
|
|
|
85
84
|
# = The person class
|
|
@@ -145,7 +144,6 @@ module LWS::Presence
|
|
|
145
144
|
|
|
146
145
|
#@!attribute updated_at
|
|
147
146
|
# @return [String] the timestamp of when the person was last updated
|
|
148
|
-
|
|
149
147
|
end
|
|
150
148
|
|
|
151
149
|
end
|
data/lib/lws/stubbing.rb
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2016 LeftClick B.V.
|
|
3
|
+
#
|
|
4
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
|
5
|
+
# and/or modified without permission. The software or any of its parts
|
|
6
|
+
# cannot be used for any other purposes than the LeftClick services and
|
|
7
|
+
# only during a valid license subscription. For more information, please
|
|
8
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
9
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
module LWS
|
|
2
13
|
|
|
3
14
|
# = Class that regulates request stubbing based on a tree of fixtures
|
data/lib/lws/ticket.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# = The ticket app module
|
|
2
1
|
#
|
|
3
2
|
# Copyright © 2016 LeftClick B.V.
|
|
4
3
|
#
|
|
@@ -9,13 +8,17 @@
|
|
|
9
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
10
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
11
10
|
|
|
11
|
+
|
|
12
|
+
# = The ticket app module
|
|
12
13
|
module LWS::Ticket
|
|
13
14
|
|
|
15
|
+
# :nocov:
|
|
14
16
|
unless defined? ENDPOINT
|
|
15
17
|
# The API endpoint for the ticket app
|
|
16
18
|
ENDPOINT = { production: "https://ticket.leftclick.cloud/",
|
|
17
19
|
development: "https://ticket-dev.leftclick.cloud/" }
|
|
18
20
|
end
|
|
21
|
+
# :nocov:
|
|
19
22
|
|
|
20
23
|
#@!visibility private
|
|
21
24
|
def self.api
|
|
@@ -127,10 +130,6 @@ module LWS::Ticket
|
|
|
127
130
|
|
|
128
131
|
#@!attribute updated_at
|
|
129
132
|
# @return [String] the timestamp of when the ticket was last updated
|
|
130
|
-
|
|
131
|
-
def initialize(attrs={})
|
|
132
|
-
super
|
|
133
|
-
end
|
|
134
133
|
end
|
|
135
134
|
|
|
136
135
|
# = The ticket message class
|
|
@@ -182,10 +181,6 @@ module LWS::Ticket
|
|
|
182
181
|
#@!attribute updated_at
|
|
183
182
|
# @return [String] the timestamp of when the ticket message was last
|
|
184
183
|
# updated
|
|
185
|
-
|
|
186
|
-
def initialize(attrs={})
|
|
187
|
-
super
|
|
188
|
-
end
|
|
189
184
|
end
|
|
190
185
|
|
|
191
186
|
# = The ticket message attachment class
|
|
@@ -223,10 +218,6 @@ module LWS::Ticket
|
|
|
223
218
|
#@!attribute updated_at
|
|
224
219
|
# @return [String] the timestamp of when the ticket message attachment
|
|
225
220
|
# was last updated
|
|
226
|
-
|
|
227
|
-
def initialize(attrs={})
|
|
228
|
-
super
|
|
229
|
-
end
|
|
230
221
|
end
|
|
231
222
|
|
|
232
223
|
# = The ticket group class
|
|
@@ -248,9 +239,7 @@ module LWS::Ticket
|
|
|
248
239
|
#@!attribute updated_at
|
|
249
240
|
# @return [String] the timestamp of when the ticket group was last updated
|
|
250
241
|
|
|
251
|
-
|
|
252
|
-
super
|
|
253
|
-
end
|
|
242
|
+
self # To ensure that YARD does not skip the attributes of this class
|
|
254
243
|
end
|
|
255
244
|
|
|
256
245
|
# = The ticket tag class
|
|
@@ -282,10 +271,6 @@ module LWS::Ticket
|
|
|
282
271
|
|
|
283
272
|
#@!attribute updated_at
|
|
284
273
|
# @return [String] the timestamp of when the ticket tag was last updated
|
|
285
|
-
|
|
286
|
-
def initialize(attrs={})
|
|
287
|
-
super
|
|
288
|
-
end
|
|
289
274
|
end
|
|
290
275
|
|
|
291
276
|
end
|
data/lib/lws/version.rb
CHANGED
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
9
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
module LWS
|
|
12
13
|
|
|
13
14
|
# The LWS library version.
|
|
14
15
|
# @note This is not the API version!
|
|
15
|
-
VERSION = '0.4.
|
|
16
|
+
VERSION = '0.4.2'
|
|
16
17
|
|
|
17
18
|
end
|
data/lib/lws.rb
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
9
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
require "faraday_middleware"
|
|
12
13
|
require "hashie"
|
|
13
14
|
require "her"
|
|
@@ -20,7 +21,7 @@ require "lws/version"
|
|
|
20
21
|
|
|
21
22
|
WebMock.disable!
|
|
22
23
|
|
|
23
|
-
# =
|
|
24
|
+
# = The main LeftClick web services module
|
|
24
25
|
#
|
|
25
26
|
# This module is the main namespace for the web service/application
|
|
26
27
|
# libraries that are represented by submodules. The {LWS} module is used
|
|
@@ -33,6 +34,7 @@ module LWS
|
|
|
33
34
|
SUPPORTED_APPS = [:generic, :auth, :corporate_website, :maps, :presence,
|
|
34
35
|
:ticket]
|
|
35
36
|
|
|
37
|
+
# @private
|
|
36
38
|
# @!visibility private
|
|
37
39
|
class HTTPLogger < Faraday::Response::Middleware
|
|
38
40
|
|
|
@@ -62,6 +64,7 @@ module LWS
|
|
|
62
64
|
|
|
63
65
|
end
|
|
64
66
|
|
|
67
|
+
# @private
|
|
65
68
|
# @!visibility private
|
|
66
69
|
class JSONLogger < Faraday::Response::Middleware
|
|
67
70
|
|
|
@@ -78,6 +81,7 @@ module LWS
|
|
|
78
81
|
|
|
79
82
|
end
|
|
80
83
|
|
|
84
|
+
# @private
|
|
81
85
|
# @!visibility private
|
|
82
86
|
class RequestHeaders < Faraday::Middleware
|
|
83
87
|
|
|
@@ -180,6 +184,7 @@ module LWS
|
|
|
180
184
|
return self
|
|
181
185
|
end
|
|
182
186
|
|
|
187
|
+
# @private
|
|
183
188
|
# @!visibility private
|
|
184
189
|
def self.setup_api(api_url)
|
|
185
190
|
api = Her::API.new
|
|
@@ -218,7 +223,7 @@ module LWS
|
|
|
218
223
|
end
|
|
219
224
|
end
|
|
220
225
|
|
|
221
|
-
# (Re)
|
|
226
|
+
# (Re)loads the stubbing if enabled (usually done by {.setup}).
|
|
222
227
|
#
|
|
223
228
|
# @return [Stubbing, nil] the stubbing object or +nil+ if disabled
|
|
224
229
|
def self.load_stubbing
|
data/test/auth_test.rb
CHANGED
data/test/caching_test.rb
CHANGED
data/test/generic_test.rb
CHANGED
data/test/logger_test.rb
CHANGED
data/test/maps_test.rb
CHANGED
data/test/presence_test.rb
CHANGED
data/test/setup_test.rb
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2016 LeftClick B.V.
|
|
3
|
+
#
|
|
4
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
|
5
|
+
# and/or modified without permission. The software or any of its parts
|
|
6
|
+
# cannot be used for any other purposes than the LeftClick services and
|
|
7
|
+
# only during a valid license subscription. For more information, please
|
|
8
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
9
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
require "test_helper"
|
|
13
|
+
|
|
14
|
+
class TestSetup < MiniTest::Test
|
|
15
|
+
|
|
16
|
+
def test_cannot_leave_out_api_token
|
|
17
|
+
assert_raises do
|
|
18
|
+
LWS.setup { }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Restore the configuration
|
|
22
|
+
reconfigure
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_get_environment_from_environment
|
|
26
|
+
with_env("LC_LWS_ENV" => "production") do
|
|
27
|
+
reconfigure
|
|
28
|
+
end
|
|
29
|
+
assert_equal(LWS.config.environment, :production)
|
|
30
|
+
|
|
31
|
+
with_env("LC_LWS_ENV" => "production") do
|
|
32
|
+
LWS.setup do |config|
|
|
33
|
+
config.api_token = ENV["LC_LWS_TEST_TOKEN"]
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
assert_equal(LWS.config.environment, :production)
|
|
37
|
+
|
|
38
|
+
# Restore the configuration
|
|
39
|
+
reconfigure
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
data/test/stubbing_test.rb
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright © 2016 LeftClick B.V.
|
|
3
|
+
#
|
|
4
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
|
5
|
+
# and/or modified without permission. The software or any of its parts
|
|
6
|
+
# cannot be used for any other purposes than the LeftClick services and
|
|
7
|
+
# only during a valid license subscription. For more information, please
|
|
8
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
9
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Minitest::Test
|
|
13
|
+
|
|
14
|
+
def with_env(settings)
|
|
15
|
+
old_env = {}
|
|
16
|
+
settings.each { |k, v| old_env[k], ENV[k] = ENV[k], v }
|
|
17
|
+
begin
|
|
18
|
+
yield
|
|
19
|
+
ensure
|
|
20
|
+
settings.each { |k, v| ENV[k] = old_env[k] }
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
data/test/test_helper.rb
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
9
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
require 'simplecov'
|
|
12
13
|
require 'simplecov-rcov'
|
|
13
14
|
SimpleCov.formatters = [
|
|
@@ -22,7 +23,7 @@ SimpleCov.at_exit do
|
|
|
22
23
|
result.format!
|
|
23
24
|
simplecov_test_suites = ['minitest']
|
|
24
25
|
parallel_offset = ENV['PARALLEL_TEST_GROUPS'] ? ENV['PARALLEL_TEST_GROUPS'].to_i - 1 : 0
|
|
25
|
-
minimum_coverage =
|
|
26
|
+
minimum_coverage = 97
|
|
26
27
|
# Count the number of commas in the command name to figure out how many result groups were combined into this result
|
|
27
28
|
if result.command_name.scan(/,/).size + 1 >= simplecov_test_suites.size + (parallel_offset * 2) # two parallel suites
|
|
28
29
|
# We only want to enforce minimum coverage after all test suites finish
|
|
@@ -37,6 +38,9 @@ require "logger"
|
|
|
37
38
|
require "lws"
|
|
38
39
|
require "minitest/autorun"
|
|
39
40
|
|
|
41
|
+
# Load the support libraries
|
|
42
|
+
Dir[File.expand_path("../support/**.rb", __FILE__)].each { |f| require f }
|
|
43
|
+
|
|
40
44
|
raise "Test token not set" if ENV["LC_LWS_TEST_TOKEN"].blank?
|
|
41
45
|
|
|
42
46
|
def reconfigure(options = {})
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
|
9
9
|
# Netherlands, info@leftclick.eu, +31492-782120.
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
require "test_helper"
|
|
12
13
|
|
|
13
14
|
class TestTicketTicket < MiniTest::Test
|
|
@@ -43,7 +44,7 @@ class TestTicketMessage < MiniTest::Test
|
|
|
43
44
|
|
|
44
45
|
def setup
|
|
45
46
|
@ticket = Ticket.all.first
|
|
46
|
-
# Messages only exist as child object
|
|
47
|
+
# Messages only exist as child object of tickets
|
|
47
48
|
@message = @ticket.messages.first
|
|
48
49
|
end
|
|
49
50
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lws
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- LeftClick B.V.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-07-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday_middleware
|
|
@@ -234,16 +234,18 @@ files:
|
|
|
234
234
|
- test/api_token_middleware_test.rb
|
|
235
235
|
- test/auth_test.rb
|
|
236
236
|
- test/caching_test.rb
|
|
237
|
+
- test/corporate_website_test.rb
|
|
237
238
|
- test/fixtures/auth.yml
|
|
238
239
|
- test/fixtures/permissions.yml
|
|
239
240
|
- test/generic_test.rb
|
|
240
241
|
- test/logger_test.rb
|
|
241
242
|
- test/maps_test.rb
|
|
242
243
|
- test/presence_test.rb
|
|
244
|
+
- test/setup_test.rb
|
|
243
245
|
- test/stubbing_test.rb
|
|
244
|
-
- test/
|
|
246
|
+
- test/support/with_env.rb
|
|
245
247
|
- test/test_helper.rb
|
|
246
|
-
- test/
|
|
248
|
+
- test/ticket_test.rb
|
|
247
249
|
homepage: https://leftclick.eu/
|
|
248
250
|
licenses: []
|
|
249
251
|
metadata: {}
|
|
@@ -271,13 +273,15 @@ test_files:
|
|
|
271
273
|
- test/api_token_middleware_test.rb
|
|
272
274
|
- test/auth_test.rb
|
|
273
275
|
- test/caching_test.rb
|
|
276
|
+
- test/corporate_website_test.rb
|
|
274
277
|
- test/fixtures/auth.yml
|
|
275
278
|
- test/fixtures/permissions.yml
|
|
276
279
|
- test/generic_test.rb
|
|
277
280
|
- test/logger_test.rb
|
|
278
281
|
- test/maps_test.rb
|
|
279
282
|
- test/presence_test.rb
|
|
283
|
+
- test/setup_test.rb
|
|
280
284
|
- test/stubbing_test.rb
|
|
281
|
-
- test/
|
|
285
|
+
- test/support/with_env.rb
|
|
282
286
|
- test/test_helper.rb
|
|
283
|
-
- test/
|
|
287
|
+
- test/ticket_test.rb
|