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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccf7066f0ca506084c083b3d4894af1b402feaef3ea4a9b4da17a3798f54e571
4
- data.tar.gz: b8c84d4dc6d118797c29b396d14f8e0aec3f75faac49efd13e5cb3ee007269bf
3
+ metadata.gz: 79bd4542eac104277c220b0b1a1c008c57358b8e1f107b1056d8299094f415d8
4
+ data.tar.gz: 69763dfd60e894007e85e4da50ea2b362af399bc2842a972d2b3d5a967ff31b0
5
5
  SHA512:
6
- metadata.gz: f04ec1dd818575060b493db61aaad7c977072def42e1ec1ba2e3ebfba899cb0badaebdfb5f8057d19a10d9a8992c1bda24fc6e36abababb1ce50dba5940c94c8
7
- data.tar.gz: 79385fc940de5d5df569b5ab9467715866cfdd6d9511a5b5e8364b2dd848f479c988ba396cf637d9bafe8e53b4093b1db935ba4e10431523065270ca071ab51b
6
+ metadata.gz: ac144f306013c32555b6c3981d359a9881b69429f6fe844e8470b2edaff6ea6e212e1db3ff6e396166ce7655d9945eb31544f6a452189ae4efa9e923c324607a
7
+ data.tar.gz: 2498d91d3421de504600032ef4690bf127157ae70cfd411cceb56c925651a2d98e3d8903378a845a000ca810cf54a97a5b2e7e406d366575a2f8f9c5b4df9c46
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Redirector
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
@@ -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
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-04-30 00:00:00.000000000 Z
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
- rubyforge_project:
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