MuranoCLI 3.0.2 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +30 -59
  3. data/Gemfile +9 -3
  4. data/MuranoCLI.gemspec +11 -4
  5. data/bin/murano +2 -90
  6. data/lib/MrMurano.rb +5 -1
  7. data/lib/MrMurano/{spec_commander.rb → Commander-Entry.rb} +1 -2
  8. data/lib/MrMurano/Solution.rb +12 -15
  9. data/lib/MrMurano/SolutionId.rb +1 -5
  10. data/lib/MrMurano/SyncAllowed.rb +2 -2
  11. data/lib/MrMurano/SyncUpDown.rb +6 -3
  12. data/lib/MrMurano/progress.rb +11 -2
  13. data/lib/MrMurano/verbosing.rb +3 -2
  14. data/lib/MrMurano/version.rb +2 -2
  15. data/spec/Account-Passwords_spec.rb +34 -48
  16. data/spec/Account_spec.rb +58 -63
  17. data/spec/Business_spec.rb +151 -139
  18. data/spec/ConfigFile_spec.rb +15 -11
  19. data/spec/ConfigMigrate_spec.rb +23 -12
  20. data/spec/Config_spec.rb +57 -54
  21. data/spec/Content_spec.rb +233 -201
  22. data/spec/GatewayBase_spec.rb +35 -27
  23. data/spec/GatewayDevice_spec.rb +149 -149
  24. data/spec/GatewayResource_spec.rb +115 -102
  25. data/spec/GatewaySettings_spec.rb +69 -62
  26. data/spec/Http_spec.rb +66 -56
  27. data/spec/MakePretties_spec.rb +82 -73
  28. data/spec/Mock_spec.rb +38 -29
  29. data/spec/ProjectFile_spec.rb +118 -106
  30. data/spec/Setting_spec.rb +24 -15
  31. data/spec/Solution-ServiceConfig_spec.rb +168 -140
  32. data/spec/Solution-ServiceEventHandler_spec.rb +186 -188
  33. data/spec/Solution-ServiceModules_spec.rb +314 -232
  34. data/spec/Solution-UsersRoles_spec.rb +136 -86
  35. data/spec/Solution_spec.rb +78 -50
  36. data/spec/SyncRoot_spec.rb +26 -24
  37. data/spec/SyncUpDown_spec.rb +268 -249
  38. data/spec/Verbosing_spec.rb +95 -93
  39. data/spec/Webservice-Cors_spec.rb +141 -95
  40. data/spec/Webservice-Endpoint_spec.rb +382 -346
  41. data/spec/Webservice-File_spec.rb +148 -109
  42. data/spec/Webservice-Setting_spec.rb +47 -41
  43. data/spec/cmd_business_spec.rb +17 -17
  44. data/spec/cmd_common.rb +27 -7
  45. data/spec/cmd_config_spec.rb +31 -20
  46. data/spec/cmd_content_spec.rb +80 -68
  47. data/spec/cmd_cors_spec.rb +11 -5
  48. data/spec/cmd_device_spec.rb +16 -14
  49. data/spec/cmd_domain_spec.rb +10 -8
  50. data/spec/cmd_exchange_spec.rb +3 -3
  51. data/spec/cmd_init_spec.rb +100 -101
  52. data/spec/cmd_keystore_spec.rb +17 -12
  53. data/spec/cmd_link_spec.rb +22 -37
  54. data/spec/cmd_password_spec.rb +11 -7
  55. data/spec/cmd_setting_application_spec.rb +47 -33
  56. data/spec/cmd_setting_product_spec.rb +32 -27
  57. data/spec/cmd_status_spec.rb +125 -114
  58. data/spec/cmd_syncdown_spec.rb +70 -65
  59. data/spec/cmd_syncup_spec.rb +19 -15
  60. data/spec/cmd_usage_spec.rb +14 -10
  61. metadata +29 -15
@@ -1,3 +1,10 @@
1
+ # Last Modified: 2017.09.12 /coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright © 2016-2017 Exosite LLC.
5
+ # License: MIT. See LICENSE.txt.
6
+ # vim:tw=0:ts=2:sw=2:et:ai
7
+
1
8
  require 'MrMurano/version'
2
9
  require 'MrMurano/http'
3
10
  require 'MrMurano/verbosing'
@@ -14,7 +21,7 @@ class Tst
14
21
  end
15
22
 
16
23
  RSpec.describe MrMurano::Http do
17
- include_context "WORKSPACE"
24
+ include_context 'WORKSPACE'
18
25
 
19
26
  before(:example) do
20
27
  $cfg = MrMurano::Config.new
@@ -22,133 +29,137 @@ RSpec.describe MrMurano::Http do
22
29
  @tst = Tst.new
23
30
  end
24
31
 
25
- context "gets a token" do
32
+ context 'gets a token' do
26
33
  before(:example) do
27
- @acc = instance_double("MrMurano::Account")
34
+ @acc = instance_double('MrMurano::Account')
28
35
  #allow(MrMurano::Account).to receive(:new).and_return(@acc)
29
36
  allow(MrMurano::Account).to receive(:instance).and_return(@acc)
30
37
  end
31
38
 
32
- it "already has one" do
33
- @tst.instance_variable_set(:@token, "ABCDEFG")
39
+ it 'already has one' do
40
+ @tst.instance_variable_set(:@token, 'ABCDEFG')
34
41
  ret = @tst.token
35
- expect(ret).to eq("ABCDEFG")
42
+ expect(ret).to eq('ABCDEFG')
36
43
  end
37
44
 
38
- it "gets one" do
45
+ it 'gets one' do
39
46
  #expect(@acc).to receive(:adc_compat_check)
40
- expect(@acc).to receive(:token).and_return("ABCDEFG")
47
+ expect(@acc).to receive(:token).and_return('ABCDEFG')
41
48
  ret = @tst.token
42
- expect(ret).to eq("ABCDEFG")
49
+ expect(ret).to eq('ABCDEFG')
43
50
  end
44
51
 
45
- it "raises when not logged in" do
52
+ it 'raises when not logged in' do
46
53
  expect(@acc).to receive(:token).and_return(nil)
47
54
  # 2017-07-13: The token command used to raise an error, but [lb]
48
55
  # doesn't like seeing the "use --trace" message that Ruby spits
49
56
  # out. So write to stderr and exit instead. Here, use check that
50
57
  # the function exits by expecting it to raise SystemExit.
51
- expect {
58
+ expect do
52
59
  @tst.token
53
- }.to raise_error(SystemExit).and output("\e[31mNot logged in!\e[0m\n").to_stderr
60
+ end.to raise_error(SystemExit).and output("\e[31mNot logged in!\e[0m\n").to_stderr
54
61
  end
55
62
  end
56
63
 
57
- context "puts curl request" do
64
+ context 'puts curl request' do
58
65
  before(:example) do
59
- @req = Net::HTTP::Get.new URI("https://test.host/this/is/a/test")
66
+ @req = Net::HTTP::Get.new URI('https://test.host/this/is/a/test')
60
67
  @req.content_type = 'application/json'
61
68
  @req['User-Agent'] = 'test'
62
69
  end
63
- it "puts nothing" do
70
+ it 'puts nothing' do
64
71
  $cfg['tool.curldebug'] = false
65
72
  $stdout = StringIO.new
66
73
  @tst.curldebug(@req)
67
- expect($stdout.string).to eq("")
74
+ expect($stdout.string).to eq('')
68
75
  end
69
76
 
70
- it "puts something" do
77
+ it 'puts something' do
71
78
  $cfg['tool.curldebug'] = true
72
79
  $cfg.curlfile_f = nil
73
80
  $stdout = StringIO.new
74
81
  @tst.curldebug(@req)
75
- expect($stdout.string).to eq(%{curl -s -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test'\n})
82
+ expect($stdout.string).to eq(
83
+ %(curl -s -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test'\n)
84
+ )
76
85
  end
77
86
 
78
- it "puts something with Auth" do
87
+ it 'puts something with Auth' do
79
88
  $cfg['tool.curldebug'] = true
80
89
  $cfg.curlfile_f = nil
81
90
  $stdout = StringIO.new
82
91
  @req['Authorization'] = 'LetMeIn'
83
92
  @tst.curldebug(@req)
84
- expect($stdout.string).to eq(%{curl -s -H 'Authorization: LetMeIn' -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test'\n})
93
+ expect($stdout.string).to eq(
94
+ %(curl -s -H 'Authorization: LetMeIn' -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test'\n)
95
+ )
85
96
  end
86
97
 
87
- it "puts something with Body" do
98
+ it 'puts something with Body' do
88
99
  $cfg['tool.curldebug'] = true
89
100
  $cfg.curlfile_f = nil
90
101
  $stdout = StringIO.new
91
- @req.body = "builder"
102
+ @req.body = 'builder'
92
103
  @tst.curldebug(@req)
93
- expect($stdout.string).to eq(%{curl -s -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test' -d 'builder'\n})
104
+ expect($stdout.string).to eq(
105
+ %(curl -s -H 'User-Agent: test' -H 'Content-Type: application/json' -X GET 'https://test.host/this/is/a/test' -d 'builder'\n)
106
+ )
94
107
  end
95
108
  end
96
109
 
97
- context "checks if JSON" do
98
- it "is JSON" do
99
- ok, data = @tst.isJSON(%{{"one": "two", "three":[1,2,3,4,5,6]}})
110
+ context 'checks if JSON' do
111
+ it 'is JSON' do
112
+ ok, data = @tst.isJSON(%({"one": "two", "three":[1,2,3,4,5,6]}))
100
113
  expect(ok).to be true
101
- expect(data).to eq({
102
- :one=>'two',
103
- :three=>[1,2,3,4,5,6]
104
- })
114
+ expect(data).to eq(one: 'two',
115
+ three: [1, 2, 3, 4, 5, 6])
105
116
  end
106
- it "is not JSON" do
107
- ok, data = @tst.isJSON(%{woeiutepoxam})
117
+ it 'is not JSON' do
118
+ ok, data = @tst.isJSON(%(woeiutepoxam))
108
119
  expect(ok).to be false
109
120
  expect(data).to eq('woeiutepoxam')
110
121
  end
111
122
  end
112
123
 
113
- context "shows HTTP errors" do
124
+ context 'shows HTTP errors' do
114
125
  before(:example) do
115
- @req = Net::HTTP::Get.new URI("https://test.host/this/is/a/test")
126
+ @req = Net::HTTP::Get.new URI('https://test.host/this/is/a/test')
116
127
  @req.content_type = 'application/json'
117
128
  @req['User-Agent'] = 'test'
118
129
  @rsp = Net::HTTPGone.new('1.1', 410, 'ok')
119
130
  end
120
131
 
121
- it "shows debug details" do
132
+ it 'shows debug details' do
122
133
  $cfg['tool.debug'] = true
123
134
  $stdout = StringIO.new
124
135
  $stderr = StringIO.new
125
136
 
126
- allow(@rsp).to receive(:body).and_return("ok")
137
+ allow(@rsp).to receive(:body).and_return('ok')
127
138
  expect(@tst).to receive(:error).once.with('Request Failed: 410: ok')
128
139
 
129
140
  @tst.showHttpError(@req, @rsp)
130
- expect($stdout.string).to eq(%{Sent GET https://test.host/this/is/a/test
141
+ expect($stdout.string).to eq(%(Sent GET https://test.host/this/is/a/test
131
142
  > Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
132
143
  > Accept: */*
133
144
  > User-Agent: test
134
145
  > Host: test.host
135
146
  > Content-Type: application/json
136
147
  Got 410 ok
137
- }.gsub(/^\s+/,''))
148
+ ).gsub(/^\s+/, ''))
138
149
  expect($stderr.string).to eq('')
139
150
  end
140
151
 
141
- it "shows debug details; has req body" do
152
+ it 'shows debug details; has req body' do
142
153
  $cfg['tool.debug'] = true
143
154
  $stdout = StringIO.new
144
155
  $stderr = StringIO.new
145
156
 
146
- allow(@req).to receive(:body).and_return("this is my body")
147
- allow(@rsp).to receive(:body).and_return("ok")
157
+ allow(@req).to receive(:body).and_return('this is my body')
158
+ allow(@rsp).to receive(:body).and_return('ok')
148
159
  expect(@tst).to receive(:error).once.with('Request Failed: 410: ok')
149
160
 
150
161
  @tst.showHttpError(@req, @rsp)
151
- expect($stdout.string).to eq(%{Sent GET https://test.host/this/is/a/test
162
+ expect($stdout.string).to eq(%(Sent GET https://test.host/this/is/a/test
152
163
  > Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
153
164
  > Accept: */*
154
165
  > User-Agent: test
@@ -156,59 +167,58 @@ RSpec.describe MrMurano::Http do
156
167
  > Content-Type: application/json
157
168
  >> this is my body
158
169
  Got 410 ok
159
- }.gsub(/^\s+/,''))
170
+ ).gsub(/^\s+/, ''))
160
171
  expect($stderr.string).to eq('')
161
172
  end
162
173
 
163
- it "shows debug details; json body" do
174
+ it 'shows debug details; json body' do
164
175
  $cfg['tool.debug'] = true
165
176
  $stdout = StringIO.new
166
177
  $stderr = StringIO.new
167
178
 
168
- allow(@rsp).to receive(:body).and_return(%{{"statusCode": 123, "message": "ok"}})
179
+ allow(@rsp).to receive(:body).and_return(%({"statusCode": 123, "message": "ok"}))
169
180
  expect(@tst).to receive(:error).once.with('Request Failed: 410: [123] ok')
170
181
 
171
182
  @tst.showHttpError(@req, @rsp)
172
- expect($stdout.string).to eq(%{Sent GET https://test.host/this/is/a/test
183
+ expect($stdout.string).to eq(%(Sent GET https://test.host/this/is/a/test
173
184
  > Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
174
185
  > Accept: */*
175
186
  > User-Agent: test
176
187
  > Host: test.host
177
188
  > Content-Type: application/json
178
189
  Got 410 ok
179
- }.gsub(/^\s+/,''))
190
+ ).gsub(/^\s+/, ''))
180
191
  expect($stderr.string).to eq('')
181
192
  end
182
193
 
183
- it "shows full error responses" do
194
+ it 'shows full error responses' do
184
195
  $cfg['tool.fullerror'] = true
185
196
  $stdout = StringIO.new
186
197
  $stderr = StringIO.new
187
198
 
188
- allow(@rsp).to receive(:body).and_return(%{{"statusCode": 123, "message": "ok"}})
189
- expect(@tst).to receive(:error).once.with("Request Failed: 410: {\n \"statusCode\": 123,\n \"message\": \"ok\"\n}")
199
+ allow(@rsp).to receive(:body).and_return(%({"statusCode": 123, "message": "ok"}))
200
+ expect(@tst).to receive(:error).once.with(
201
+ "Request Failed: 410: {\n \"statusCode\": 123,\n \"message\": \"ok\"\n}"
202
+ )
190
203
 
191
204
  @tst.showHttpError(@req, @rsp)
192
205
  expect($stdout.string).to eq('')
193
206
  expect($stderr.string).to eq('')
194
207
  end
195
208
 
196
-
197
- it "calls showHttpError" do
209
+ it 'calls showHttpError' do
198
210
  $stdout = StringIO.new
199
211
  $stderr = StringIO.new
200
212
 
201
213
  idhttp = instance_double('Net::HTTP')
202
214
  expect(idhttp).to receive(:request).once.and_return(@rsp)
203
215
  expect(@tst).to receive(:http).once.and_return(idhttp)
204
- expect(@rsp).to receive(:body).and_return(%{{"statusCode": 123, "message": "gone"}})
216
+ expect(@rsp).to receive(:body).and_return(%({"statusCode": 123, "message": "gone"}))
205
217
 
206
218
  @tst.workit(@req)
207
219
  expect($stdout.string).to eq('')
208
220
  expect($stderr.string).to eq("\e[31mRequest Failed: 410: [123] gone\e[0m\n")
209
-
210
221
  end
211
222
  end
212
-
213
223
  end
214
- # vim: set ai et sw=2 ts=2 :
224
+
@@ -1,118 +1,127 @@
1
+ # Last Modified: 2017.09.12 /coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright © 2016-2017 Exosite LLC.
5
+ # License: MIT. See LICENSE.txt.
6
+ # vim:tw=0:ts=2:sw=2:et:ai
7
+
1
8
  require 'MrMurano/version'
2
9
  require 'MrMurano/makePretty'
3
10
 
4
11
  RSpec.describe MrMurano::Pretties do
5
12
  before(:example) do
6
- @options = {:pretty=>true, :localtime=>false}
13
+ @options = { pretty: true, localtime: false }
14
+ # [lb] not sure how to fix this warning...
15
+ # rubocop:disable Style/MethodMissing
16
+ # "When using method_missing, define respond_to_missing?"
7
17
  def @options.method_missing(mid)
8
18
  self[mid]
9
19
  end
10
20
  end
11
21
 
12
- it "makes json pretty with color" do
13
- data ={:type=>"debug", :timestamp=>1476386031,
14
- :subject=>"websocket_websocket_info",
15
- :data=>"Script Error: "}
16
- str ="\e[35m{\e[0m\n \"type\": \"debug\",\n \"timestamp\": 1476386031,\n \"subject\": \"websocket_websocket_info\",\n \"data\": \"Script Error: \"\n\e[35m}\e[0m"
17
- ret = MrMurano::Pretties::makeJsonPretty(data, @options)
22
+ it 'makes json pretty with color' do
23
+ data = { type: 'debug', timestamp: 1_476_386_031,
24
+ subject: 'websocket_websocket_info',
25
+ data: 'Script Error: ', }
26
+ str = "\e[35m{\e[0m\n \"type\": \"debug\",\n \"timestamp\": 1476386031,\n \"subject\": \"websocket_websocket_info\",\n \"data\": \"Script Error: \"\n\e[35m}\e[0m"
27
+ ret = MrMurano::Pretties.makeJsonPretty(data, @options)
18
28
  expect(ret).to eq(str)
19
29
  end
20
- it "makes json pretty without color" do
21
- data ={:type=>"debug", :timestamp=>1476386031,
22
- :subject=>"websocket_websocket_info",
23
- :data=>"Script Error: "}
24
- str ="{\"type\":\"debug\",\"timestamp\":1476386031,\"subject\":\"websocket_websocket_info\",\"data\":\"Script Error: \"}"
30
+ it 'makes json pretty without color' do
31
+ data = { type: 'debug', timestamp: 1_476_386_031,
32
+ subject: 'websocket_websocket_info',
33
+ data: 'Script Error: ', }
34
+ str = '{"type":"debug","timestamp":1476386031,"subject":"websocket_websocket_info","data":"Script Error: "}'
25
35
  @options[:pretty] = false
26
- ret = MrMurano::Pretties::makeJsonPretty(data, @options)
36
+ ret = MrMurano::Pretties.makeJsonPretty(data, @options)
27
37
  expect(ret).to eq(str)
28
38
  end
29
39
 
30
- it "makes it pretty." do
31
- data ={:type=>"debug", :timestamp=>1476386031,
32
- :subject=>"websocket_websocket_info",
33
- :data=>"Script Error: "}
34
- str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
35
- ret = MrMurano::Pretties::makePretty(data, @options)
40
+ it 'makes it pretty.' do
41
+ data = { type: 'debug', timestamp: 1_476_386_031,
42
+ subject: 'websocket_websocket_info',
43
+ data: 'Script Error: ', }
44
+ str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
45
+ ret = MrMurano::Pretties.makePretty(data, @options)
36
46
  expect(ret).to eq(str)
37
47
  end
38
48
 
39
- it "makes it pretty; missing type" do
40
- data ={:timestamp=>1476386031,
41
- :subject=>"websocket_websocket_info",
42
- :data=>"Script Error: "}
43
- str ="\e[31m\e[48;5;231m-- \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
44
- ret = MrMurano::Pretties::makePretty(data, @options)
49
+ it 'makes it pretty; missing type' do
50
+ data = { timestamp: 1_476_386_031,
51
+ subject: 'websocket_websocket_info',
52
+ data: 'Script Error: ', }
53
+ str = "\e[31m\e[48;5;231m-- \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
54
+ ret = MrMurano::Pretties.makePretty(data, @options)
45
55
  expect(ret).to eq(str)
46
56
  end
47
57
 
48
- it "makes it pretty; localtime" do
49
- data ={:type=>"debug", :timestamp=>1476386031,
50
- :subject=>"websocket_websocket_info",
51
- :data=>"Script Error: "}
52
- ldt = Time.at(1476386031).localtime.to_datetime.iso8601(3)
53
- str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m#{ldt}\e[0m:\nScript Error: "
58
+ it 'makes it pretty; localtime' do
59
+ data = { type: 'debug', timestamp: 1_476_386_031,
60
+ subject: 'websocket_websocket_info',
61
+ data: 'Script Error: ', }
62
+ ldt = Time.at(1_476_386_031).localtime.to_datetime.iso8601(3)
63
+ str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m#{ldt}\e[0m:\nScript Error: "
54
64
  @options[:localtime] = true
55
- ret = MrMurano::Pretties::makePretty(data, @options)
65
+ ret = MrMurano::Pretties.makePretty(data, @options)
56
66
  @options[:localtime] = false
57
67
  expect(ret).to eq(str)
58
68
  end
59
69
 
60
- it "makes it pretty; missing timestamp" do
61
- data ={:type=>"debug",
62
- :subject=>"websocket_websocket_info",
63
- :data=>"Script Error: "}
64
- str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m<no timestamp>\e[0m:\nScript Error: "
65
- ret = MrMurano::Pretties::makePretty(data, @options)
70
+ it 'makes it pretty; missing timestamp' do
71
+ data = { type: 'debug',
72
+ subject: 'websocket_websocket_info',
73
+ data: 'Script Error: ', }
74
+ str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m<no timestamp>\e[0m:\nScript Error: "
75
+ ret = MrMurano::Pretties.makePretty(data, @options)
66
76
  expect(ret).to eq(str)
67
77
  end
68
78
 
69
- it "makes it pretty; missing subject" do
70
- data ={:type=>"debug", :timestamp=>1476386031,
71
- :data=>"Script Error: "}
72
- str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
73
- ret = MrMurano::Pretties::makePretty(data, @options)
79
+ it 'makes it pretty; missing subject' do
80
+ data = { type: 'debug', timestamp: 1_476_386_031,
81
+ data: 'Script Error: ', }
82
+ str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\nScript Error: "
83
+ ret = MrMurano::Pretties.makePretty(data, @options)
74
84
  expect(ret).to eq(str)
75
85
  end
76
86
 
77
-
78
- it "makes it pretty; missing data" do
79
- data ={:type=>"debug", :timestamp=>1476386031,
80
- :subject=>"websocket_websocket_info"}
81
- str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n\e[35m{\e[0m\n\e[35m}\e[0m"
82
- ret = MrMurano::Pretties::makePretty(data, @options)
87
+ it 'makes it pretty; missing data' do
88
+ data = { type: 'debug', timestamp: 1_476_386_031,
89
+ subject: 'websocket_websocket_info', }
90
+ str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n\e[35m{\e[0m\n\e[35m}\e[0m"
91
+ ret = MrMurano::Pretties.makePretty(data, @options)
83
92
  expect(ret).to eq(str)
84
93
  end
85
94
 
86
- it "makes it pretty; NAN timestamp" do
87
- data ={:type=>"debug", :timestamp => "bob",
88
- :subject=>"websocket_websocket_info",
89
- :data=>"Script Error: "}
90
- str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34mbob\e[0m:\nScript Error: "
91
- ret = MrMurano::Pretties::makePretty(data, @options)
95
+ it 'makes it pretty; NAN timestamp' do
96
+ data = { type: 'debug', timestamp: 'bob',
97
+ subject: 'websocket_websocket_info',
98
+ data: 'Script Error: ', }
99
+ str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34mbob\e[0m:\nScript Error: "
100
+ ret = MrMurano::Pretties.makePretty(data, @options)
92
101
  expect(ret).to eq(str)
93
102
  end
94
103
 
95
- it "makes it pretty; hash data" do
96
- data ={:type=>"debug", :timestamp=>1476386031,
97
- :subject=>"websocket_websocket_info",
98
- :data=>{
99
- :random=>'junk'
100
- }}
101
- str ="\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n\e[35m{\e[0m\n \"random\": \"junk\"\n\e[35m}\e[0m"
102
- ret = MrMurano::Pretties::makePretty(data, @options)
104
+ it 'makes it pretty; hash data' do
105
+ data = { type: 'debug', timestamp: 1_476_386_031,
106
+ subject: 'websocket_websocket_info',
107
+ data: {
108
+ random: 'junk',
109
+ }, }
110
+ str = "\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n\e[35m{\e[0m\n \"random\": \"junk\"\n\e[35m}\e[0m"
111
+ ret = MrMurano::Pretties.makePretty(data, @options)
103
112
  expect(ret).to eq(str)
104
113
  end
105
114
 
106
- it "makes it pretty; http hash data" do
107
- data ={:type=>"debug", :timestamp=>1476386031,
108
- :subject=>"websocket_websocket_info",
109
- :data=>{
110
- :request=>{:method=>'get'},
111
- :response=>{:status=>200},
112
- }}
113
- str =%|\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n---------\nrequest:\e[35m{\e[0m\n "method\": \"get\"\n\e[35m}\e[0m\n---------\nresponse:\e[35m{\e[0m\n \"status\": 200\n\e[35m}\e[0m|
114
- ret = MrMurano::Pretties::makePretty(data, @options)
115
+ it 'makes it pretty; http hash data' do
116
+ data = { type: 'debug', timestamp: 1_476_386_031,
117
+ subject: 'websocket_websocket_info',
118
+ data: {
119
+ request: { method: 'get' },
120
+ response: { status: 200 },
121
+ }, }
122
+ str = %(\e[31m\e[48;5;231mDEBUG \e[0m\e[31m\e[48;5;231m[websocket_websocket_info]\e[0m \e[34m2016-10-13T19:13:51.000+00:00\e[0m:\n---------\nrequest:\e[35m{\e[0m\n "method\": \"get\"\n\e[35m}\e[0m\n---------\nresponse:\e[35m{\e[0m\n \"status\": 200\n\e[35m}\e[0m)
123
+ ret = MrMurano::Pretties.makePretty(data, @options)
115
124
  expect(ret).to eq(str)
116
125
  end
117
126
  end
118
- # vim: set ai et sw=2 ts=2 :
127
+