route_dog 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +20 -6
- data/VERSION +1 -1
- data/lib/route_dog.rb +3 -1
- data/test/mock_app/Gemfile +0 -3
- data/test/test_helper.rb +0 -1
- data/test/unit/route_dog_test.rb +17 -0
- metadata +6 -8
- data/.gitignore +0 -1
- data/test/mock_app/Gemfile.lock +0 -94
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
RouteDog for Ruby on Rails
|
2
2
|
==========================
|
3
3
|
|
4
|
+
**It only works in Rails 3 for now, Rails 2.3 support is comming.**
|
5
|
+
|
4
6
|
RouteDog is a small collection of Rack middlewares to be used with your Ruby On Rails project as a helper to identify not tested routes.
|
5
7
|
|
6
8
|
The way that RouteDog knows if you are testing a route is through the Watcher middleware which only runs in Test Environment
|
7
|
-
and collects the routes that you've called from your **
|
9
|
+
and collects the routes that you've called from your **Integration Tests** (See Note About Integration Tests).
|
8
10
|
|
9
11
|
The way that RouteDog shows to you a warning is through a middleware called Notifier which only runs in Developement Enviroment.
|
10
12
|
|
@@ -21,7 +23,7 @@ the coverage results but you want to live the experience using the application a
|
|
21
23
|
|
22
24
|
* You were a Rumble Guy that thought that tests were not necessary? ok, may be this is for you if you don't want to drop all your code.
|
23
25
|
|
24
|
-
* Even if you are not planning to write
|
26
|
+
* Even if you are not planning to write Integration Tests you can take advantage of the route defined, tested and used report.
|
25
27
|
|
26
28
|
|
27
29
|
Usage
|
@@ -29,8 +31,6 @@ Usage
|
|
29
31
|
|
30
32
|
### Instalation ###
|
31
33
|
|
32
|
-
sudo gem install route_dog
|
33
|
-
|
34
34
|
If you are using Bundler
|
35
35
|
|
36
36
|
gem 'route_dog'
|
@@ -42,7 +42,7 @@ If you are not using Bundler
|
|
42
42
|
|
43
43
|
### Get a report of defined, implemented and tested routes ###
|
44
44
|
|
45
|
-
Run your *
|
45
|
+
Run your *Integration Tests* and then call a report
|
46
46
|
|
47
47
|
rake route_dog:report
|
48
48
|
|
@@ -67,14 +67,28 @@ very uncommon, but here is the command.
|
|
67
67
|
TODO
|
68
68
|
----
|
69
69
|
|
70
|
+
* Rails 2.3 support.
|
70
71
|
* Show Notifier warnings for other than regular html responses.
|
71
72
|
* Generator to extract route_dog.yml config file, so you can disable the middlewares you don't want.
|
72
73
|
|
73
74
|
Notes
|
74
75
|
-----
|
75
76
|
|
76
|
-
* Watcher middleware don't work with Controller Tests, it only works with
|
77
|
+
* Watcher middleware don't work with Controller Tests, it only works with Integration Tests.
|
78
|
+
|
79
|
+
DEVELOPMENT
|
80
|
+
-----------
|
81
|
+
|
82
|
+
If you are planning to contribute to this gem, please read the following advice.
|
83
|
+
|
84
|
+
Once you have pulled the source code do this...
|
85
|
+
|
86
|
+
cd test/mock_app
|
87
|
+
bundle install
|
88
|
+
|
89
|
+
Then you can run the tests...
|
77
90
|
|
91
|
+
rake
|
78
92
|
|
79
93
|
Copyright
|
80
94
|
---------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/lib/route_dog.rb
CHANGED
@@ -16,9 +16,11 @@ module RouteDog
|
|
16
16
|
File.open(config_file, "w+") {|file| file.puts(routes.to_yaml) }
|
17
17
|
end
|
18
18
|
|
19
|
+
# When method.nil? it respond to all methods.
|
19
20
|
def self.route_tested?(controller, action, method)
|
20
21
|
begin
|
21
|
-
load_watched_routes[controller.to_s.downcase][action.to_s.downcase]
|
22
|
+
available_methods = load_watched_routes[controller.to_s.downcase][action.to_s.downcase]
|
23
|
+
method.nil? ? available_methods.any? : available_methods.include?(method.to_s.downcase)
|
22
24
|
rescue
|
23
25
|
false
|
24
26
|
end
|
data/test/mock_app/Gemfile
CHANGED
data/test/test_helper.rb
CHANGED
data/test/unit/route_dog_test.rb
CHANGED
@@ -22,4 +22,21 @@ class RouteDogTest < Test::Unit::TestCase
|
|
22
22
|
assert_equal Admin::Blogs::PostsController, RouteDog.constantize_controller_str("admin/blogs/posts")
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
context "Identify tested routes" do
|
27
|
+
|
28
|
+
def write_tested_routes_yaml(hash)
|
29
|
+
File.open(RouteDog.config_file, "w+") {|file| file.puts(hash.to_yaml) }
|
30
|
+
end
|
31
|
+
|
32
|
+
test "identify routes that respond to get method" do
|
33
|
+
write_tested_routes_yaml("products" => {"index" => ["get"]})
|
34
|
+
assert_equal true, RouteDog.route_tested?(:products, :index, :get)
|
35
|
+
end
|
36
|
+
|
37
|
+
test "identify routes that respond to any method" do
|
38
|
+
write_tested_routes_yaml("products" => {"index" => ["get"]})
|
39
|
+
assert_equal true, RouteDog.route_tested?(:products, :index, nil)
|
40
|
+
end
|
41
|
+
end
|
25
42
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: route_dog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 2.
|
10
|
+
version: 2.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alvaro Gil
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-04-12 00:00:00 -03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -91,7 +91,6 @@ extra_rdoc_files:
|
|
91
91
|
- LICENSE
|
92
92
|
- README.md
|
93
93
|
files:
|
94
|
-
- .gitignore
|
95
94
|
- LICENSE
|
96
95
|
- README.md
|
97
96
|
- Rakefile
|
@@ -109,7 +108,6 @@ files:
|
|
109
108
|
- test/integration/users_controller_test.rb
|
110
109
|
- test/mock_app/.gitignore
|
111
110
|
- test/mock_app/Gemfile
|
112
|
-
- test/mock_app/Gemfile.lock
|
113
111
|
- test/mock_app/Rakefile
|
114
112
|
- test/mock_app/app/controllers/admin/blogs/posts_controller.rb
|
115
113
|
- test/mock_app/app/controllers/admin/project_settings_controller.rb
|
@@ -162,8 +160,8 @@ homepage: http://github.com/zevarito/route_dog
|
|
162
160
|
licenses: []
|
163
161
|
|
164
162
|
post_install_message:
|
165
|
-
rdoc_options:
|
166
|
-
|
163
|
+
rdoc_options: []
|
164
|
+
|
167
165
|
require_paths:
|
168
166
|
- lib
|
169
167
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
test/mock_app/config/route_dog_routes.yml
|
data/test/mock_app/Gemfile.lock
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: /Users/zevarito/Sources/zevarito/route_dog
|
3
|
-
specs:
|
4
|
-
route_dog (2.1.1)
|
5
|
-
rack
|
6
|
-
rails (>= 2.3.8)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
abstract (1.0.0)
|
12
|
-
actionmailer (3.0.1)
|
13
|
-
actionpack (= 3.0.1)
|
14
|
-
mail (~> 2.2.5)
|
15
|
-
actionpack (3.0.1)
|
16
|
-
activemodel (= 3.0.1)
|
17
|
-
activesupport (= 3.0.1)
|
18
|
-
builder (~> 2.1.2)
|
19
|
-
erubis (~> 2.6.6)
|
20
|
-
i18n (~> 0.4.1)
|
21
|
-
rack (~> 1.2.1)
|
22
|
-
rack-mount (~> 0.6.12)
|
23
|
-
rack-test (~> 0.5.4)
|
24
|
-
tzinfo (~> 0.3.23)
|
25
|
-
activemodel (3.0.1)
|
26
|
-
activesupport (= 3.0.1)
|
27
|
-
builder (~> 2.1.2)
|
28
|
-
i18n (~> 0.4.1)
|
29
|
-
activerecord (3.0.1)
|
30
|
-
activemodel (= 3.0.1)
|
31
|
-
activesupport (= 3.0.1)
|
32
|
-
arel (~> 1.0.0)
|
33
|
-
tzinfo (~> 0.3.23)
|
34
|
-
activeresource (3.0.1)
|
35
|
-
activemodel (= 3.0.1)
|
36
|
-
activesupport (= 3.0.1)
|
37
|
-
activesupport (3.0.1)
|
38
|
-
arel (1.0.1)
|
39
|
-
activesupport (~> 3.0.0)
|
40
|
-
builder (2.1.2)
|
41
|
-
columnize (0.3.1)
|
42
|
-
configuration (1.1.0)
|
43
|
-
erubis (2.6.6)
|
44
|
-
abstract (>= 1.0.0)
|
45
|
-
i18n (0.4.1)
|
46
|
-
launchy (0.3.7)
|
47
|
-
configuration (>= 0.0.5)
|
48
|
-
rake (>= 0.8.1)
|
49
|
-
linecache (0.43)
|
50
|
-
mail (2.2.7)
|
51
|
-
activesupport (>= 2.3.6)
|
52
|
-
mime-types
|
53
|
-
treetop (>= 1.4.5)
|
54
|
-
mime-types (1.16)
|
55
|
-
polyglot (0.3.1)
|
56
|
-
rack (1.2.1)
|
57
|
-
rack-mount (0.6.13)
|
58
|
-
rack (>= 1.0.0)
|
59
|
-
rack-test (0.5.6)
|
60
|
-
rack (>= 1.0)
|
61
|
-
rails (3.0.1)
|
62
|
-
actionmailer (= 3.0.1)
|
63
|
-
actionpack (= 3.0.1)
|
64
|
-
activerecord (= 3.0.1)
|
65
|
-
activeresource (= 3.0.1)
|
66
|
-
activesupport (= 3.0.1)
|
67
|
-
bundler (~> 1.0.0)
|
68
|
-
railties (= 3.0.1)
|
69
|
-
railties (3.0.1)
|
70
|
-
actionpack (= 3.0.1)
|
71
|
-
activesupport (= 3.0.1)
|
72
|
-
rake (>= 0.8.4)
|
73
|
-
thor (~> 0.14.0)
|
74
|
-
rake (0.8.7)
|
75
|
-
ruby-debug (0.10.3)
|
76
|
-
columnize (>= 0.1)
|
77
|
-
ruby-debug-base (~> 0.10.3.0)
|
78
|
-
ruby-debug-base (0.10.3)
|
79
|
-
linecache (>= 0.3)
|
80
|
-
sqlite3-ruby (1.3.1)
|
81
|
-
thor (0.14.3)
|
82
|
-
treetop (1.4.8)
|
83
|
-
polyglot (>= 0.3.1)
|
84
|
-
tzinfo (0.3.23)
|
85
|
-
|
86
|
-
PLATFORMS
|
87
|
-
ruby
|
88
|
-
|
89
|
-
DEPENDENCIES
|
90
|
-
launchy
|
91
|
-
rails (= 3.0.1)
|
92
|
-
route_dog!
|
93
|
-
ruby-debug
|
94
|
-
sqlite3-ruby
|