MuranoCLI 3.0.2 → 3.0.4

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.
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,10 +1,17 @@
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/ProjectFile'
3
10
  require 'MrMurano/Webservice-File'
4
11
  require '_workspace'
5
12
 
6
13
  RSpec.describe MrMurano::Webservice::File do
7
- include_context "WORKSPACE"
14
+ include_context 'WORKSPACE'
8
15
  before(:example) do
9
16
  $cfg = MrMurano::Config.new
10
17
  $cfg.load
@@ -15,58 +22,70 @@ RSpec.describe MrMurano::Webservice::File do
15
22
  $cfg['application.id'] = 'XYZ'
16
23
 
17
24
  @srv = MrMurano::Webservice::File.new
18
- allow(@srv).to receive(:token).and_return("TTTTTTTTTT")
25
+ allow(@srv).to receive(:token).and_return('TTTTTTTTTT')
19
26
 
20
- @baseURI = "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/file"
21
- @fileuploadURI = "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/fileupload"
27
+ @base_uri = 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/file'
28
+ @fileupload_uri = 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/fileupload'
22
29
  end
23
30
 
24
- it "initializes" do
31
+ it 'initializes' do
25
32
  uri = @srv.endpoint('/')
26
- expect(uri.to_s).to eq("#{@baseURI}/")
33
+ expect(uri.to_s).to eq("#{@base_uri}/")
27
34
  end
28
35
 
29
- it "lists" do
36
+ it 'lists' do
30
37
  body = [
31
38
  {
32
- :path=>"/",
33
- :mime_type=>"text/html",
34
- :checksum=>"f535dad52b2877a49717a034b4eee5ff1cdb8a18",
39
+ path: '/',
40
+ mime_type: 'text/html',
41
+ checksum: 'f535dad52b2877a49717a034b4eee5ff1cdb8a18',
35
42
  },
36
43
  {
37
- :path=>"/batteryMeter.svg",
38
- :mime_type=>"image/svg+xml",
39
- :checksum=>"06a1aab86ba8cb9b3f2913c673d4aa243c553494",
44
+ path: '/batteryMeter.svg',
45
+ mime_type: 'image/svg+xml',
46
+ checksum: '06a1aab86ba8cb9b3f2913c673d4aa243c553494',
40
47
  },
41
48
  {
42
- :path=>"/meter.html",
43
- :mime_type=>"text/html",
44
- :checksum=>"82e12125c2f1324bbf7bd64bf187f3334416117e",
45
- }
49
+ path: '/meter.html',
50
+ mime_type: 'text/html',
51
+ checksum: '82e12125c2f1324bbf7bd64bf187f3334416117e',
52
+ },
46
53
  ]
47
- stub_request(:get, @baseURI).
48
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
49
- 'Content-Type'=>'application/json'}).
50
- to_return(body: body.to_json)
54
+ stub_request(:get, @base_uri)
55
+ .with(
56
+ headers: {
57
+ 'Authorization' => 'token TTTTTTTTTT',
58
+ 'Content-Type' => 'application/json',
59
+ }
60
+ )
61
+ .to_return(body: body.to_json)
51
62
  ret = @srv.list
52
63
  expect(ret).to eq(body)
53
64
  end
54
65
 
55
- it "removes" do
56
- stub_request(:delete, "#{@baseURI}/index.html").
57
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
58
- 'Content-Type'=>'application/json'}).
59
- to_return(status: 200)
66
+ it 'removes' do
67
+ stub_request(:delete, "#{@base_uri}/index.html")
68
+ .with(
69
+ headers: {
70
+ 'Authorization' => 'token TTTTTTTTTT',
71
+ 'Content-Type' => 'application/json',
72
+ }
73
+ )
74
+ .to_return(status: 200)
60
75
  ret = @srv.remove('index.html')
61
76
  expect(ret).to eq({})
62
77
  end
63
78
 
64
- context "fetches" do
65
- it "gets an error" do
66
- stub_request(:get, "#{@baseURI}/bob").
67
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
68
- 'Content-Type'=>'application/json'}).
69
- to_return(status: 404, body: "nope")
79
+ context 'fetches' do
80
+ it 'gets an error' do
81
+ stub_request(:get, "#{@base_uri}/bob")
82
+ .with(
83
+ headers: {
84
+ 'Authorization' => 'token TTTTTTTTTT',
85
+ 'Content-Type' => 'application/json',
86
+ }
87
+ )
88
+ .to_return(status: 404, body: 'nope')
70
89
  saved = $stderr
71
90
  $stderr = StringIO.new
72
91
  ret = @srv.fetch('/bob')
@@ -75,149 +94,169 @@ RSpec.describe MrMurano::Webservice::File do
75
94
  $stderr = saved
76
95
  end
77
96
 
78
- it "gets $stdout" do
79
- stub_request(:get, "#{@baseURI}/bob").
80
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
81
- 'Content-Type'=>'application/json'}).
82
- to_return(status: 200, body: "nope")
97
+ it 'gets $stdout' do
98
+ stub_request(:get, "#{@base_uri}/bob")
99
+ .with(
100
+ headers: {
101
+ 'Authorization' => 'token TTTTTTTTTT',
102
+ 'Content-Type' => 'application/json',
103
+ }
104
+ )
105
+ .to_return(status: 200, body: 'nope')
83
106
  saved = $stdout
84
107
  $stdout = StringIO.new
85
108
  ret = @srv.fetch('/bob')
86
109
  expect(ret).to be_nil
87
- expect($stdout.string).to eq("nope")
110
+ expect($stdout.string).to eq('nope')
88
111
  $stdout = saved
89
112
  end
90
113
 
91
- it "gets to block" do
92
- stub_request(:get, "#{@baseURI}/bob").
93
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
94
- 'Content-Type'=>'application/json'}).
95
- to_return(status: 200, body: "nope")
96
- got = ""
97
- ret = @srv.fetch('/bob') {|chunk| got << chunk}
114
+ it 'gets to block' do
115
+ stub_request(:get, "#{@base_uri}/bob")
116
+ .with(
117
+ headers: {
118
+ 'Authorization' => 'token TTTTTTTTTT',
119
+ 'Content-Type' => 'application/json',
120
+ }
121
+ )
122
+ .to_return(status: 200, body: 'nope')
123
+ got = ''
124
+ ret = @srv.fetch('/bob') { |chunk| got += chunk }
98
125
  expect(ret).to be_nil
99
- expect(got).to eq("nope")
126
+ expect(got).to eq('nope')
100
127
  end
101
128
  end
102
129
 
103
- context "uploads" do
130
+ context 'uploads' do
104
131
  before(:example) do
105
132
  FileUtils.mkpath(@project_dir + '/files')
106
133
  @lp = Pathname.new(@project_dir + '/files/one.text')
107
- @lp.open('w') {|io| io << %{Just some text}}
134
+ @lp.open('w') { |io| io << %(Just some text) }
108
135
  @lp = @lp.realpath
109
136
  end
110
137
 
111
- it "an item" do
112
- stub_request(:put, "#{@baseURI}upload/one.text").
113
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
114
- 'Content-Type'=>%r{multipart/form-data; boundary=.*}},
115
- )
138
+ it 'an item' do
139
+ stub_request(:put, "#{@base_uri}upload/one.text")
140
+ .with(
141
+ headers: {
142
+ 'Authorization' => 'token TTTTTTTTTT',
143
+ 'Content-Type' => %r{multipart/form-data; boundary=.*},
144
+ },
145
+ )
116
146
 
117
- @srv.upload(@lp, {:path=>'/one.text'}, false)
147
+ @srv.upload(@lp, { path: '/one.text' }, false)
118
148
  end
119
149
 
120
- it "gets an error" do
121
- stub_request(:put, "#{@baseURI}upload/one.text").
122
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
123
- 'Content-Type'=>%r{multipart/form-data; boundary=.*}},
124
- ).
125
- to_return(status: 401, body: "nope")
150
+ it 'gets an error' do
151
+ stub_request(:put, "#{@base_uri}upload/one.text")
152
+ .with(
153
+ headers: {
154
+ 'Authorization' => 'token TTTTTTTTTT',
155
+ 'Content-Type' => %r{multipart/form-data; boundary=.*},
156
+ },
157
+ ).to_return(status: 401, body: 'nope')
126
158
 
127
159
  saved = $stderr
128
160
  $stderr = StringIO.new
129
- @srv.upload(@lp, {:path=>'/one.text'}, false)
161
+ @srv.upload(@lp, { path: '/one.text' }, false)
130
162
  expect($stderr.string).to eq("\e[31mRequest Failed: 401: nope\e[0m\n")
131
163
  $stderr = saved
132
164
  end
133
165
 
134
- it "an item with curl debug" do
135
- stub_request(:put, "#{@baseURI}upload/one.text").
136
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
137
- 'Content-Type'=>%r{multipart/form-data; boundary=.*}},
138
- )
166
+ it 'an item with curl debug' do
167
+ stub_request(:put, "#{@base_uri}upload/one.text")
168
+ .with(
169
+ headers: {
170
+ 'Authorization' => 'token TTTTTTTTTT',
171
+ 'Content-Type' => %r{multipart/form-data; boundary=.*},
172
+ },
173
+ )
139
174
  $cfg['tool.curldebug'] = true
140
175
  $cfg.curlfile_f = nil
141
176
  saved = $stdout
142
177
  $stdout = StringIO.new
143
- @srv.upload(@lp, {:path=>'/one.text'}, false)
144
- expect($stdout.string).to match(%r{^curl -s -H 'Authorization: token TTTTTTTTTT'.*-X PUT '#{@fileuploadURI}/one.text' -F file=@.*$})
178
+ @srv.upload(@lp, { path: '/one.text' }, false)
179
+ expect($stdout.string).to match(
180
+ %r{^curl -s -H 'Authorization: token TTTTTTTTTT'.*-X PUT '#{@fileupload_uri}/one.text' -F file=@.*$}
181
+ )
145
182
  $stdout = saved
146
183
  end
147
184
  end
148
185
 
149
- context "compares" do
186
+ context 'compares' do
150
187
  before(:example) do
151
- @iA = {:path=>"/api/v1/bar",
152
- :mime_type=>"application/json",
153
- :checksum=>'12',
154
- }
155
- @iB = {:path=>"/api/v1/bar",
156
- :mime_type=>"application/json",
157
- :checksum=>'12',
158
- }
159
- end
160
- it "equal" do
161
- ret = @srv.docmp(@iA, @iB)
188
+ @i_a = {
189
+ path: '/api/v1/bar',
190
+ mime_type: 'application/json',
191
+ checksum: '12',
192
+ }
193
+ @i_b = {
194
+ path: '/api/v1/bar',
195
+ mime_type: 'application/json',
196
+ checksum: '12',
197
+ }
198
+ end
199
+ it 'equal' do
200
+ ret = @srv.docmp(@i_a, @i_b)
162
201
  expect(ret).to be false
163
202
  end
164
- it "different mime" do
165
- iA = @iA.merge({:mime_type=>'text/plain'})
166
- ret = @srv.docmp(iA, @iB)
203
+ it 'different mime' do
204
+ i_a = @i_a.merge(mime_type: 'text/plain')
205
+ ret = @srv.docmp(i_a, @i_b)
167
206
  expect(ret).to be true
168
207
  end
169
- it "different checksum" do
170
- iA = @iA.merge({:checksum=>'4352'})
171
- ret = @srv.docmp(iA, @iB)
208
+ it 'different checksum' do
209
+ i_a = @i_a.merge(checksum: '4352')
210
+ ret = @srv.docmp(i_a, @i_b)
172
211
  expect(ret).to be true
173
212
  end
174
213
  end
175
214
 
176
- context "Lookup functions" do
177
- it "gets local name" do
178
- ret = @srv.tolocalname({:path=>'/one/two/three.html'}, :path)
215
+ context 'Lookup functions' do
216
+ it 'gets local name' do
217
+ ret = @srv.tolocalname({ path: '/one/two/three.html' }, :path)
179
218
  expect(ret).to eq('/one/two/three.html')
180
219
  end
181
220
 
182
- it "gets default_page local name" do
183
- ret = @srv.tolocalname({:path=>'/'}, :path)
221
+ it 'gets default_page local name' do
222
+ ret = @srv.tolocalname({ path: '/' }, :path)
184
223
  expect(ret).to eq('index.html')
185
224
  end
186
225
 
187
- it "gets synckey" do
188
- ret = @srv.synckey({:path=>'/one/two/three'})
189
- expect(ret).to eq("/one/two/three")
226
+ it 'gets synckey' do
227
+ ret = @srv.synckey(path: '/one/two/three')
228
+ expect(ret).to eq('/one/two/three')
190
229
  end
191
230
 
192
- it "gets searchfor" do
193
- $cfg['files.searchFor'] = %{a b c/**/d/*.bob}
231
+ it 'gets searchfor' do
232
+ $cfg['files.searchFor'] = %(a b c/**/d/*.bob)
194
233
  ret = @srv.searchFor
195
- expect(ret).to eq(["a", "b", "c/**/d/*.bob"])
234
+ expect(ret).to eq(['a', 'b', 'c/**/d/*.bob'])
196
235
  end
197
236
 
198
- it "gets ignoring" do
199
- $cfg['files.ignoring'] = %{a b c/**/d/*.bob}
237
+ it 'gets ignoring' do
238
+ $cfg['files.ignoring'] = %(a b c/**/d/*.bob)
200
239
  ret = @srv.ignoring
201
- expect(ret).to eq(["a", "b", "c/**/d/*.bob"])
240
+ expect(ret).to eq(['a', 'b', 'c/**/d/*.bob'])
202
241
  end
203
242
  end
204
243
 
205
- context "to_remote_item" do
244
+ context 'to_remote_item' do
206
245
  before(:example) do
207
246
  FileUtils.mkpath(@project_dir + '/files')
208
247
  @lp = Pathname.new(@project_dir + '/files/one.text')
209
- @lp.open('w') {|io| io << %{Just some text}}
248
+ @lp.open('w') { |io| io << %(Just some text) }
210
249
  @lp = @lp.realpath
211
250
  end
212
- it "gets item" do
251
+ it 'gets item' do
213
252
  prj = Pathname.new(@project_dir).realpath
214
253
  ret = @srv.to_remote_item(prj, @lp)
215
- expect(ret).to eq({
216
- :path=>"/files/one.text",
217
- :mime_type=>"text/plain",
218
- :checksum=>"d1af3dadf08479a1d43b282f95d61dda8efda5e7"
219
- })
254
+ expect(ret).to eq(
255
+ path: '/files/one.text',
256
+ mime_type: 'text/plain',
257
+ checksum: 'd1af3dadf08479a1d43b282f95d61dda8efda5e7'
258
+ )
220
259
  end
221
260
  end
222
261
  end
223
- # vim: set ai et sw=2 ts=2 :
262
+
@@ -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 'tempfile'
2
9
  require 'yaml'
3
10
  require 'MrMurano/version'
@@ -7,7 +14,7 @@ require 'MrMurano/Webservice-Cors'
7
14
  require '_workspace'
8
15
 
9
16
  RSpec.describe MrMurano::Webservice::Settings do
10
- include_context "WORKSPACE"
17
+ include_context 'WORKSPACE'
11
18
  before(:example) do
12
19
  MrMurano::SyncRoot.instance.reset
13
20
  $cfg = MrMurano::Config.new
@@ -16,28 +23,28 @@ RSpec.describe MrMurano::Webservice::Settings do
16
23
  $cfg['application.id'] = 'XYZ'
17
24
 
18
25
  @srv = MrMurano::Webservice::Settings.new
19
- allow(@srv).to receive(:token).and_return("TTTTTTTTTT")
26
+ allow(@srv).to receive(:token).and_return('TTTTTTTTTT')
20
27
 
21
- @baseURI = "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors"
28
+ @base_uri = 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors'
22
29
  end
23
30
 
24
- it "initializes" do
31
+ it 'initializes' do
25
32
  uri = @srv.endpoint('/')
26
- expect(uri.to_s).to eq("#{@baseURI}/")
33
+ expect(uri.to_s).to eq("#{@base_uri}/")
27
34
  end
28
35
 
29
- context "when server gives string" do
30
- context "fetches" do
31
- it "as a hash" do
32
- cors = {:origin=>true,
33
- :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
34
- :headers=>["Content-Type","Cookie","Authorization"],
35
- :credentials=>true}
36
+ context 'when server gives string' do
37
+ context 'fetches' do
38
+ it 'as a hash' do
39
+ cors = { origin: true,
40
+ methods: %w[HEAD GET POST PUT DELETE OPTIONS PATCH],
41
+ headers: ['Content-Type', 'Cookie', 'Authorization'],
42
+ credentials: true, }
36
43
  body = cors
37
- stub_request(:get, "#{@baseURI}").
38
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
39
- 'Content-Type'=>'application/json'}).
40
- to_return(body: body.to_json)
44
+ stub_request(:get, @base_uri.to_s)
45
+ .with(headers: { 'Authorization' => 'token TTTTTTTTTT',
46
+ 'Content-Type' => 'application/json', })
47
+ .to_return(body: body.to_json)
41
48
 
42
49
  ret = @srv.cors
43
50
  expect(ret).to eq(cors)
@@ -45,18 +52,18 @@ RSpec.describe MrMurano::Webservice::Settings do
45
52
  end
46
53
  end
47
54
 
48
- context "when server gives object" do
49
- context "fetches" do
50
- it "as a hash" do
51
- cors = {:origin=>true,
52
- :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
53
- :headers=>["Content-Type","Cookie","Authorization"],
54
- :credentials=>true}
55
+ context 'when server gives object' do
56
+ context 'fetches' do
57
+ it 'as a hash' do
58
+ cors = { origin: true,
59
+ methods: %w[HEAD GET POST PUT DELETE OPTIONS PATCH],
60
+ headers: ['Content-Type', 'Cookie', 'Authorization'],
61
+ credentials: true, }
55
62
  body = cors
56
- stub_request(:get, "#{@baseURI}").
57
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
58
- 'Content-Type'=>'application/json'}).
59
- to_return(body: body.to_json)
63
+ stub_request(:get, @base_uri.to_s)
64
+ .with(headers: { 'Authorization' => 'token TTTTTTTTTT',
65
+ 'Content-Type' => 'application/json', })
66
+ .to_return(body: body.to_json)
60
67
 
61
68
  ret = @srv.cors
62
69
  expect(ret).to eq(cors)
@@ -64,26 +71,25 @@ RSpec.describe MrMurano::Webservice::Settings do
64
71
  end
65
72
  end
66
73
 
67
- context "uploads" do
74
+ context 'uploads' do
68
75
  before(:example) do
69
76
  $project = MrMurano::ProjectFile.new
70
77
  $project.load
71
- @cors = {:origin=>true,
72
- :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
73
- :headers=>["Content-Type","Cookie","Authorization"],
74
- :credentials=>true}
78
+ @cors = { origin: true,
79
+ methods: %w[HEAD GET POST PUT DELETE OPTIONS PATCH],
80
+ headers: ['Content-Type', 'Cookie', 'Authorization'],
81
+ credentials: true, }
75
82
  end
76
- it "sets" do
77
- stub_request(:put, "#{@baseURI}").
78
- with(:body=>@cors.to_json,
79
- :headers=>{'Authorization'=>'token TTTTTTTTTT',
80
- 'Content-Type'=>'application/json'}).
81
- to_return(body: "")
83
+ it 'sets' do
84
+ stub_request(:put, @base_uri.to_s)
85
+ .with(body: @cors.to_json,
86
+ headers: { 'Authorization' => 'token TTTTTTTTTT',
87
+ 'Content-Type' => 'application/json', })
88
+ .to_return(body: '')
82
89
 
83
- ret = @srv.cors=(@cors)
90
+ ret = @srv.cors = (@cors)
84
91
  expect(ret).to eq(@cors)
85
92
  end
86
93
  end
87
-
88
94
  end
89
- # vim: set ai et sw=2 ts=2 :
95
+