redirector 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/redirect_rule.rb +5 -1
- data/lib/redirector/version.rb +1 -1
- data/spec/models/redirect_rule_spec.rb +9 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79bd4542eac104277c220b0b1a1c008c57358b8e1f107b1056d8299094f415d8
|
4
|
+
data.tar.gz: 69763dfd60e894007e85e4da50ea2b362af399bc2842a972d2b3d5a967ff31b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac144f306013c32555b6c3981d359a9881b69429f6fe844e8470b2edaff6ea6e212e1db3ff6e396166ce7655d9945eb31544f6a452189ae4efa9e923c324607a
|
7
|
+
data.tar.gz: 2498d91d3421de504600032ef4690bf127157ae70cfd411cceb56c925651a2d98e3d8903378a845a000ca810cf54a97a5b2e7e406d366575a2f8f9c5b4df9c46
|
data/app/models/redirect_rule.rb
CHANGED
@@ -20,7 +20,7 @@ class RedirectRule < ActiveRecord::Base
|
|
20
20
|
validates :active, :inclusion => { :in => ['0', '1', true, false] }
|
21
21
|
end
|
22
22
|
|
23
|
-
before_save :strip_source_whitespace
|
23
|
+
before_save :strip_source_whitespace, :strip_destination_whitespace
|
24
24
|
|
25
25
|
def self.regex_expression
|
26
26
|
if connection_mysql?
|
@@ -89,4 +89,8 @@ class RedirectRule < ActiveRecord::Base
|
|
89
89
|
self.source = self.source.strip
|
90
90
|
end
|
91
91
|
|
92
|
+
def strip_destination_whitespace
|
93
|
+
self.destination = self.destination.strip
|
94
|
+
end
|
95
|
+
|
92
96
|
end
|
data/lib/redirector/version.rb
CHANGED
@@ -46,6 +46,15 @@ describe RedirectRule do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
describe 'strip_destination_whitespace before_save callback' do
|
50
|
+
it 'strips leading and trailing whitespace when saved' do
|
51
|
+
subject = build(:redirect_rule, :destination => ' /needs-stripping ')
|
52
|
+
|
53
|
+
subject.save
|
54
|
+
expect(subject.reload.destination).to eq('/needs-stripping')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
49
58
|
describe '.match_for' do
|
50
59
|
it 'returns nil if there is no matching rule' do
|
51
60
|
expect(RedirectRule.match_for('/someplace', {})).to be_nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redirector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Landau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -258,8 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
258
|
- !ruby/object:Gem::Version
|
259
259
|
version: '0'
|
260
260
|
requirements: []
|
261
|
-
|
262
|
-
rubygems_version: 2.7.6
|
261
|
+
rubygems_version: 3.0.4
|
263
262
|
signing_key:
|
264
263
|
specification_version: 4
|
265
264
|
summary: A Rails engine that adds a piece of middleware to the top of your middleware
|