redirector 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ describe 'Redirector middleware' do
4
4
  before do
5
5
  FactoryGirl.create(:redirect_rule, :destination => '/news/5', :source => '/my_custom_url')
6
6
  FactoryGirl.create(:redirect_rule_regex, :destination => '/news/$1', :source => '/my_custom_url/([A-Za-z0-9_]+)')
7
+ FactoryGirl.create(:redirect_rule_regex, :destination => '/news', :source => 'categoryID=12345')
7
8
  end
8
9
 
9
10
  it 'correctly redirects the visitor for an exact match rule' do
@@ -15,4 +16,17 @@ describe 'Redirector middleware' do
15
16
  visit '/my_custom_url/20'
16
17
  current_path.should == '/news/20'
17
18
  end
19
+
20
+ it 'should not do the query string match if the Redirector.include_query_in_source is false' do
21
+ visit '/my_old_url?categoryID=12345'
22
+ current_path.should == '/my_old_url'
23
+ end
24
+
25
+ it 'should do the query string match if the Redirector.include_query_in_source is true' do
26
+ original_option = Redirector.include_query_in_source
27
+ Redirector.include_query_in_source = true
28
+ visit '/my_old_url?categoryID=12345'
29
+ current_path.should == '/news'
30
+ Redirector.include_query_in_source = original_option
31
+ end
18
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redirector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -197,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  segments:
199
199
  - 0
200
- hash: 3438278425952232537
200
+ hash: -1807659678167474884
201
201
  required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  none: false
203
203
  requirements:
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  segments:
208
208
  - 0
209
- hash: 3438278425952232537
209
+ hash: -1807659678167474884
210
210
  requirements: []
211
211
  rubyforge_project:
212
212
  rubygems_version: 1.8.21