sayso-routing-filter 0.2.2.001

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+
3
+ module TestRailsAdapter
4
+ routes = ActionController::Routing::Routes = ActionController::Routing::RouteSet.new
5
+ routes.draw do |map|
6
+ map.connect '/', :controller => 'rails_test/tests', :action => 'index'
7
+ map.foo '/foo/:id', :controller => 'rails_test/tests', :action => 'show'
8
+ map.filter :uuid, :pagination ,:locale, :extension
9
+ end
10
+
11
+ attr_reader :session
12
+ delegate :get, :response, :to => :session
13
+
14
+ def setup
15
+ @session = ActionController::Integration::Session.new(lambda { |env| ActionController::Routing::Routes.call(env) })
16
+ end
17
+ end
@@ -0,0 +1,28 @@
1
+ require 'test_helper'
2
+
3
+ require "rails"
4
+ require 'rack/test'
5
+
6
+ module TestRailsAdapter
7
+ include ::Rack::Test::Methods
8
+
9
+ APP = Class.new(Rails::Application).tap do |app|
10
+ app.config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
11
+ app.config.session_store :cookie_store, :key => "_myapp_session"
12
+ app.config.active_support.deprecation = :log
13
+ app.routes.draw do
14
+ match "/" => "rails_test/tests#index"
15
+ match "/foo/:id" => "rails_test/tests#show", :as => 'foo'
16
+ filter :uuid, :pagination ,:locale, :extension
17
+ end
18
+ app.initialize!
19
+ end
20
+
21
+ def app
22
+ APP
23
+ end
24
+
25
+ def response
26
+ last_response
27
+ end
28
+ end
@@ -0,0 +1,41 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+
3
+ require 'rubygems'
4
+ require 'test/unit'
5
+ require 'bundler/setup'
6
+
7
+ require 'i18n'
8
+ require 'action_pack'
9
+ require 'active_support'
10
+ require 'action_controller'
11
+ require 'active_support/core_ext/enumerable.rb'
12
+ require 'test_declarative'
13
+ require 'routing_filter'
14
+
15
+ include RoutingFilter
16
+
17
+ class SomeController < ActionController::Base
18
+ end
19
+
20
+ class Test::Unit::TestCase
21
+ def draw_routes(&block)
22
+ normalized_block = rails_2? ? lambda { |set| set.instance_eval(&block) } : block
23
+ klass = rails_2? ? ActionController::Routing::RouteSet : ActionDispatch::Routing::RouteSet
24
+ klass.new.tap { |set| set.draw(&normalized_block) }
25
+ end
26
+
27
+ def rails_2?
28
+ ActionPack::VERSION::MAJOR == 2
29
+ end
30
+ end
31
+
32
+ if ActionPack::VERSION::MAJOR == 2
33
+ ActionController::Routing::RouteSet::Mapper.class_eval do
34
+ def match(pattern, options)
35
+ pattern.gsub!('(.:format)', '.:format')
36
+ controller, action = options.delete(:to).split('#')
37
+ options.merge!(:controller => controller, :action => action)
38
+ connect(pattern, options)
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sayso-routing-filter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.2.2.001
6
+ platform: ruby
7
+ authors:
8
+ - SaySo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-23 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: actionpack
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: configatron
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: i18n
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rails
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: test_declarative
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ type: :development
70
+ version_requirements: *id005
71
+ description: Routing filters wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation - forked and gemified for sayso
72
+ email: sayso@truvolabs.com
73
+ executables: []
74
+
75
+ extensions: []
76
+
77
+ extra_rdoc_files: []
78
+
79
+ files:
80
+ - lib/routing-filter.rb
81
+ - lib/routing_filter/adapters/rails_2.rb
82
+ - lib/routing_filter/adapters/rails_3.rb
83
+ - lib/routing_filter/chain.rb
84
+ - lib/routing_filter/filter.rb
85
+ - lib/routing_filter/filters/extension.rb
86
+ - lib/routing_filter/filters/language.rb
87
+ - lib/routing_filter/filters/locale.rb
88
+ - lib/routing_filter/filters/pagination.rb
89
+ - lib/routing_filter/filters/uuid.rb
90
+ - lib/routing_filter/version.rb
91
+ - lib/routing_filter.rb
92
+ - test/all.rb
93
+ - test/filters/all_filters/generation.rb
94
+ - test/filters/all_filters/recognition.rb
95
+ - test/filters/all_filters_test.rb
96
+ - test/filters/extension_test.rb
97
+ - test/filters/locale_test.rb
98
+ - test/filters/pagination_test.rb
99
+ - test/filters/uuid_test.rb
100
+ - test/rails_test.rb
101
+ - test/routes_test.rb
102
+ - test/routing_filter_test.rb
103
+ - test/test_adapters/rails_2.rb
104
+ - test/test_adapters/rails_3.rb
105
+ - test/test_helper.rb
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - MIT-LICENSE
109
+ - README.markdown
110
+ has_rdoc: true
111
+ homepage: http://github.com/sayso/routing-filter
112
+ licenses: []
113
+
114
+ post_install_message:
115
+ rdoc_options: []
116
+
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: "0"
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: "0"
131
+ requirements: []
132
+
133
+ rubyforge_project: "[none]"
134
+ rubygems_version: 1.6.2
135
+ signing_key:
136
+ specification_version: 3
137
+ summary: Routing filters wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation - forked and gemified for sayso
138
+ test_files: []
139
+