macmillan-utils 1.0.42 → 1.0.43

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47a645523245155b095b0354763345b184ddbe1f
4
- data.tar.gz: b8412d1213a8b819c0f6f1fcc8f4fa389c111756
3
+ metadata.gz: 3fe9b990a00a9e419dc06a35dc5ab6a4f5a82cc5
4
+ data.tar.gz: f1315b6e760d45bb4203b103a68d2efee6aa0af1
5
5
  SHA512:
6
- metadata.gz: f7da8c342a2c11ed45adc7fd872083d84e11ac345bc5df7b30ca687c1a9220575ce53c163db00b5f8c7b5110aab866d1a2e3d5d54b222f791ff3b6015859b378
7
- data.tar.gz: 62f4c9aa96fd7347c48ee79e6363b816d3e29efee993d2960155a7ceb0be501e52e0885af5d64cf587ea288f0f823e665e0b32d25316b13137b770f491482356
6
+ metadata.gz: e7868d4031c99050605469da7728bb3417338080be5e55126c577f6ba4249be951337d19ec92b69c6d12f06e5d170ef48c783ff6445e26ad6034345b7c42a143
7
+ data.tar.gz: 0693ecddea825200da01a11dbd65123ea84e68eeebe32a3b5f43e7064555c6450d9bda2974b0814eb1424ff501d739bf3a627355a6224b76ef42743a6c93e020
@@ -64,6 +64,7 @@ Style/CollectionMethods:
64
64
  inject: 'reduce'
65
65
  detect: 'find'
66
66
  find_all: 'select'
67
+ Enabled: true
67
68
 
68
69
  Layout/DotPosition:
69
70
  EnforcedStyle: leading
@@ -72,9 +73,32 @@ Layout/DotPosition:
72
73
  Style/DoubleNegation:
73
74
  Enabled: false
74
75
 
76
+ Style/Alias:
77
+ # I like alias_method with symbol parameters
78
+ Enabled: false
79
+
75
80
  Layout/SpaceAroundOperators:
76
81
  # When true, allows most uses of extra spacing if the intent is to align
77
82
  # with an operator on the previous or next line, not counting empty lines
78
83
  # or comment lines.
79
84
  AllowForAlignment: true
80
85
  Enabled: true
86
+
87
+ Style/SymbolArray:
88
+ # Turned off because the associated auto-correct makes a real mess
89
+ Enabled: false
90
+
91
+ Style/FrozenStringLiteralComment:
92
+ # An 'every file in the repo' recommendation.
93
+ Enabled: false
94
+ Severity: warning
95
+
96
+ Layout/EmptyLineAfterMagicComment:
97
+ # Nooo not another 'every file in the repo' recommendation.
98
+ Enabled: false
99
+ Severity: warning
100
+
101
+ Style/GlobalVars:
102
+ # Doesn't justify a critical
103
+ Enabled: true
104
+ Severity: warning
@@ -0,0 +1,34 @@
1
+ group :all_plugins, halt_on_fail: true do
2
+
3
+ # Note: The cmd option is now required due to the increasing number of ways
4
+ # rspec may be run, below are examples of the most common uses.
5
+ # * bundler: 'bundle exec rspec'
6
+ # * bundler binstubs: 'bin/rspec'
7
+ # * spring: 'bin/rspec' (This will use spring if running and you have
8
+ # installed the spring binstubs per the docs)
9
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
10
+ # * 'just' rspec: 'rspec'
11
+
12
+ guard :rspec, cmd: 'bundle exec rspec --no-profile', all_after_pass: true, all_on_start: true do
13
+ require "guard/rspec/dsl"
14
+ dsl = Guard::RSpec::Dsl.new(self)
15
+
16
+ # Feel free to open issues for suggestions and improvements
17
+
18
+ # RSpec files
19
+ rspec = dsl.rspec
20
+ watch(rspec.spec_helper) { rspec.spec_dir }
21
+ watch(rspec.spec_support) { rspec.spec_dir }
22
+ watch(rspec.spec_files)
23
+
24
+ # Ruby files
25
+ ruby = dsl.ruby
26
+ dsl.watch_spec_files_for(ruby.lib_files)
27
+ end
28
+
29
+ guard :rubocop, cli: ['--only-guide-cops'] do
30
+ watch(%r{.+\.rb$})
31
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
32
+ end
33
+
34
+ end
@@ -93,10 +93,11 @@ module Macmillan
93
93
 
94
94
  def cookie_options(request)
95
95
  {
96
- value: 'accepted',
97
- domain: request.host_with_port,
98
- path: '/',
99
- expires: Time.now.getutc + YEAR
96
+ value: 'accepted',
97
+ domain: request.host_with_port,
98
+ path: '/',
99
+ httponly: true,
100
+ expires: Time.now.getutc + YEAR
100
101
  }
101
102
  end
102
103
 
@@ -76,7 +76,10 @@ module Macmillan
76
76
  alias_method :uuid_is_new?, :store_cookie?
77
77
 
78
78
  def save_cookie
79
- cookie_value = { value: final_user_uuid, path: '/', expires: DateTime.now.next_year.to_time }
79
+ cookie_value = { value: final_user_uuid,
80
+ path: '/',
81
+ httponly: true,
82
+ expires: DateTime.now.next_year.to_time }
80
83
  response.set_cookie(cookie_key, cookie_value)
81
84
  end
82
85
 
@@ -21,6 +21,10 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'pry'
22
22
  spec.add_development_dependency 'rack-test'
23
23
  spec.add_development_dependency 'rack', '< 2.0.0'
24
+ spec.add_development_dependency 'guard'
25
+ spec.add_development_dependency 'guard-rspec'
26
+ spec.add_development_dependency 'guard-rubocop'
27
+ spec.add_development_dependency 'terminal-notifier-guard'
24
28
 
25
29
  spec.add_dependency 'rspec'
26
30
  spec.add_dependency 'simplecov'
@@ -46,6 +46,7 @@ RSpec.describe Macmillan::Utils::Middleware::CookieMessage do
46
46
  expect(cookie).to match(/domain=www\.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
+ expect(cookie).to match(/httponly/i)
49
50
  end
50
51
 
51
52
  it 'redirects back to the original url' do
@@ -41,6 +41,11 @@ RSpec.describe Macmillan::Utils::Middleware::Uuid do
41
41
  expect(headers['Set-Cookie']).to include("user.uuid=#{user_uuid}")
42
42
  end
43
43
 
44
+ it 'uses httponly cookie' do
45
+ _status, headers, _body = subject.call(request.env)
46
+ expect(headers['Set-Cookie']).to match(/httponly/i)
47
+ end
48
+
44
49
  it 'tells following rack app the user_uuid is new' do
45
50
  expect(app).to receive(:call).with(hash_including('user.uuid_is_new' => true)).and_return(app_return)
46
51
  _status, _headers, _body = subject.call(request.env)
@@ -65,6 +70,11 @@ RSpec.describe Macmillan::Utils::Middleware::Uuid do
65
70
  expect(headers['Set-Cookie']).to include('user.uuid=wibble')
66
71
  end
67
72
 
73
+ it 'uses httponly cookie' do
74
+ _status, headers, _body = subject.call(request.env)
75
+ expect(headers['Set-Cookie']).to match(/httponly/i)
76
+ end
77
+
68
78
  it 'tells following rack app the user_uuid is new' do
69
79
  expect(app).to receive(:call).with(hash_including('user.uuid_is_new' => true)).and_return(app_return)
70
80
  _status, _headers, _body = subject.call(request.env)
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.42
4
+ version: 1.0.43
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-05-30 00:00:00.000000000 Z
11
+ date: 2017-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,62 @@ dependencies:
94
94
  - - "<"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.0.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: terminal-notifier-guard
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
97
153
  - !ruby/object:Gem::Dependency
98
154
  name: rspec
99
155
  requirement: !ruby/object:Gem::Requirement
@@ -247,6 +303,7 @@ files:
247
303
  - ".rubocop.yml"
248
304
  - ".travis.yml"
249
305
  - Gemfile
306
+ - Guardfile
250
307
  - LICENSE
251
308
  - README.rdoc
252
309
  - Rakefile
@@ -315,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
372
  version: '0'
316
373
  requirements: []
317
374
  rubyforge_project:
318
- rubygems_version: 2.6.7
375
+ rubygems_version: 2.6.11
319
376
  signing_key:
320
377
  specification_version: 4
321
378
  summary: A collection of useful patterns we (Springer Nature) use in our Ruby applications.