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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 975d77a9bebc36a642eb905204a727ac4b461c18
4
- data.tar.gz: 515c4a92916f800774388ab2169d354f5052d2c6
3
+ metadata.gz: e818f8c8f8f07c68afce7217b6ec5289d889dba4
4
+ data.tar.gz: b2ca4293be84d7e7bc3dbeb25763e951375a8b30
5
5
  SHA512:
6
- metadata.gz: 9209729dd365c22b06a09d96de5751a609a3b970b189fe9533f84721cc468886eb133ff9ca0dcba4d4df5cab50fb2139af16baa4eaaf5025659db77d46f75094
7
- data.tar.gz: dfd5f4b2ff618af93fcd79d94ec9eb890186b52a9f41e042400a6f7911fadbb1809f3496b906e1022c08f25d499156008967cf4e04ebb8870ce977ef5a0e4a5c
6
+ metadata.gz: b41b4e7c2b45f00c9ed526970f6765cd66ee0e58f14a8e10b45f4f7421fbf72c84d168f54a8c4f41302cfda13b42e746f85971c433b6041f1fc670895210b9d9
7
+ data.tar.gz: 5375bb41a9b31ae198368eddf1ba7164ffe75f8f97ea606a72afa901a6c74abe66df66601d5676dad7a7bf31f47a2d44aeaf3080ff07e138f9ee00b195f096c5
@@ -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: (opts[:blacklist_date] + 1.day).to_s)
121
+ opts.merge(blacklist_date: blacklist_date.to_s)
117
122
  )
118
123
  end
119
124
 
@@ -1,3 +1,3 @@
1
1
  module SoapyCake
2
- VERSION = '1.14.1'.freeze
2
+ VERSION = '1.14.2'.freeze
3
3
  end
@@ -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
- let(:cake_opts) { { blacklist_date: (date + 1.day).to_s } }
183
- it_behaves_like 'a cake admin method'
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.1
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-15 00:00:00.000000000 Z
11
+ date: 2015-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport