macmillan-utils 1.0.43 → 1.0.44

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fe9b990a00a9e419dc06a35dc5ab6a4f5a82cc5
4
- data.tar.gz: f1315b6e760d45bb4203b103a68d2efee6aa0af1
3
+ metadata.gz: 2a5401e1c1aeb8646df418c3366d2722cce444ee
4
+ data.tar.gz: '01284e81b6652c5b129545aacc1cd25ef795525f'
5
5
  SHA512:
6
- metadata.gz: e7868d4031c99050605469da7728bb3417338080be5e55126c577f6ba4249be951337d19ec92b69c6d12f06e5d170ef48c783ff6445e26ad6034345b7c42a143
7
- data.tar.gz: 0693ecddea825200da01a11dbd65123ea84e68eeebe32a3b5f43e7064555c6450d9bda2974b0814eb1424ff501d739bf3a627355a6224b76ef42743a6c93e020
6
+ metadata.gz: 812f79da23a9e53fe08570c7e165c99d3c0e8eef0291abb5da6eafaee08801c3c36f7b910183203401519a8647b9dfec7ac9a8e10b24ddd387256b1da86d9efd
7
+ data.tar.gz: 8ea8946f6852a8c31084f8ba1fd29c49d0143efc1881c36e27686b3f45340bea4d7433b5353990d3a5ea63b9c963758c4e7eebffa6f6b215e7dc484ef5ade448
data/.gitignore CHANGED
@@ -21,3 +21,6 @@ tmp
21
21
  mkmf.log
22
22
  RBENV_VERSION*
23
23
  Gemfile.lock
24
+ /.idea/
25
+ *.iml
26
+
@@ -94,7 +94,7 @@ module Macmillan
94
94
  def cookie_options(request)
95
95
  {
96
96
  value: 'accepted',
97
- domain: request.host_with_port,
97
+ domain: ".#{request.host_with_port.split('.').drop(1).join('.')}",
98
98
  path: '/',
99
99
  httponly: true,
100
100
  expires: Time.now.getutc + YEAR
@@ -43,12 +43,24 @@ RSpec.describe Macmillan::Utils::Middleware::CookieMessage do
43
43
 
44
44
  it 'sets the cookie' do
45
45
  expect(cookie).to match(/euCookieNotice=accepted;/)
46
- expect(cookie).to match(/domain=www\.nature\.com:80;/)
46
+ expect(cookie).to match(/domain=\.nature\.com:80;/)
47
47
  expect(cookie).to match(%r{path=/;})
48
48
  expect(cookie).to match(/expires=Wed, 31 Jan 2018 00:00:00 -0000/)
49
49
  expect(cookie).to match(/httponly/i)
50
50
  end
51
51
 
52
+ context 'and the domain non-standard' do
53
+ let(:url) { 'http://test-www.naturechina.com:5124/?cookies=accepted' }
54
+
55
+ it 'sets the cookie' do
56
+ expect(cookie).to match(/euCookieNotice=accepted;/)
57
+ expect(cookie).to match(/domain=\.naturechina\.com:5124;/)
58
+ expect(cookie).to match(%r{path=/;})
59
+ expect(cookie).to match(/expires=Wed, 31 Jan 2018 00:00:00 -0000/)
60
+ expect(cookie).to match(/httponly/i)
61
+ end
62
+ end
63
+
52
64
  it 'redirects back to the original url' do
53
65
  expect(location).to eq('http://www.nature.com/?cookies=accepted')
54
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macmillan-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.43
4
+ version: 1.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Springer Nature
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-01 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -372,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
372
372
  version: '0'
373
373
  requirements: []
374
374
  rubyforge_project:
375
- rubygems_version: 2.6.11
375
+ rubygems_version: 2.6.13
376
376
  signing_key:
377
377
  specification_version: 4
378
378
  summary: A collection of useful patterns we (Springer Nature) use in our Ruby applications.
@@ -391,4 +391,3 @@ test_files:
391
391
  - spec/lib/macmillan/utils/statsd_decorator_spec.rb
392
392
  - spec/lib/macmillan/utils/statsd_middleware_spec.rb
393
393
  - spec/spec_helper.rb
394
- has_rdoc: