soapy_cake 1.14.1 → 1.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/soapy_cake/admin.rb +6 -1
- data/lib/soapy_cake/version.rb +1 -1
- data/spec/lib/soapy_cake/admin_spec.rb +16 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e818f8c8f8f07c68afce7217b6ec5289d889dba4
|
4
|
+
data.tar.gz: b2ca4293be84d7e7bc3dbeb25763e951375a8b30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b41b4e7c2b45f00c9ed526970f6765cd66ee0e58f14a8e10b45f4f7421fbf72c84d168f54a8c4f41302cfda13b42e746f85971c433b6041f1fc670895210b9d9
|
7
|
+
data.tar.gz: 5375bb41a9b31ae198368eddf1ba7164ffe75f8f97ea606a72afa901a6c74abe66df66601d5676dad7a7bf31f47a2d44aeaf3080ff07e138f9ee00b195f096c5
|
data/lib/soapy_cake/admin.rb
CHANGED
@@ -109,11 +109,16 @@ module SoapyCake
|
|
109
109
|
def add_blacklist(opts)
|
110
110
|
require_params(opts, %i(blacklist_date))
|
111
111
|
|
112
|
+
blacklist_date = opts[:blacklist_date].to_date
|
113
|
+
# CAKE applies the blacklisting at 00:00 of the specified day, so add one more day.
|
114
|
+
# Unless it is the current day, then blacklisting should take effect immediately.
|
115
|
+
blacklist_date += 1.day if blacklist_date > Date.today
|
116
|
+
|
112
117
|
run Request.new(
|
113
118
|
:admin,
|
114
119
|
:addedit,
|
115
120
|
:blacklist,
|
116
|
-
opts.merge(blacklist_date:
|
121
|
+
opts.merge(blacklist_date: blacklist_date.to_s)
|
117
122
|
)
|
118
123
|
end
|
119
124
|
|
data/lib/soapy_cake/version.rb
CHANGED
@@ -174,13 +174,26 @@ RSpec.describe SoapyCake::Admin do
|
|
174
174
|
end
|
175
175
|
|
176
176
|
describe '#add_blacklist' do
|
177
|
+
around { |example| Timecop.freeze(Time.utc(2015, 2, 17), &example) }
|
178
|
+
|
177
179
|
let(:method) { :add_blacklist }
|
178
180
|
let(:cake_method) { :blacklist }
|
179
|
-
let(:date) { Date.new(2015, 9, 3) }
|
180
181
|
let(:request) { double('request') }
|
181
182
|
let(:opts) { { blacklist_date: date } }
|
182
|
-
|
183
|
-
|
183
|
+
|
184
|
+
context 'immediate blacklisting for current date' do
|
185
|
+
let(:date) { Date.today }
|
186
|
+
let(:cake_opts) { { blacklist_date: date.to_s } }
|
187
|
+
|
188
|
+
it_behaves_like 'a cake admin method'
|
189
|
+
end
|
190
|
+
|
191
|
+
context 'scheduled blacklisting in the future' do
|
192
|
+
let(:date) { Date.new(2015, 9, 3) }
|
193
|
+
let(:cake_opts) { { blacklist_date: (date + 1.day).to_s } }
|
194
|
+
|
195
|
+
it_behaves_like 'a cake admin method'
|
196
|
+
end
|
184
197
|
end
|
185
198
|
end
|
186
199
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soapy_cake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ad2games GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|