fizx-collapsed_routes 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +86 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/collapsed_routes.gemspec +136 -0
- data/lib/collapsed_routes.rb +53 -0
- data/spec/app/README +243 -0
- data/spec/app/Rakefile +10 -0
- data/spec/app/app/controllers/application_controller.rb +10 -0
- data/spec/app/app/controllers/comments_controller.rb +85 -0
- data/spec/app/app/controllers/posts_controller.rb +85 -0
- data/spec/app/app/controllers/users_controller.rb +85 -0
- data/spec/app/app/helpers/application_helper.rb +3 -0
- data/spec/app/app/helpers/comments_helper.rb +2 -0
- data/spec/app/app/helpers/posts_helper.rb +2 -0
- data/spec/app/app/helpers/users_helper.rb +2 -0
- data/spec/app/app/models/comment.rb +3 -0
- data/spec/app/app/models/post.rb +4 -0
- data/spec/app/app/models/user.rb +3 -0
- data/spec/app/app/views/comments/edit.html.erb +24 -0
- data/spec/app/app/views/comments/index.html.erb +24 -0
- data/spec/app/app/views/comments/new.html.erb +23 -0
- data/spec/app/app/views/comments/show.html.erb +18 -0
- data/spec/app/app/views/layouts/comments.html.erb +17 -0
- data/spec/app/app/views/layouts/posts.html.erb +17 -0
- data/spec/app/app/views/layouts/users.html.erb +17 -0
- data/spec/app/app/views/posts/edit.html.erb +24 -0
- data/spec/app/app/views/posts/index.html.erb +24 -0
- data/spec/app/app/views/posts/new.html.erb +23 -0
- data/spec/app/app/views/posts/show.html.erb +18 -0
- data/spec/app/app/views/users/edit.html.erb +16 -0
- data/spec/app/app/views/users/index.html.erb +20 -0
- data/spec/app/app/views/users/new.html.erb +15 -0
- data/spec/app/app/views/users/show.html.erb +8 -0
- data/spec/app/config/boot.rb +110 -0
- data/spec/app/config/database.yml +22 -0
- data/spec/app/config/environment.rb +41 -0
- data/spec/app/config/environments/development.rb +17 -0
- data/spec/app/config/environments/production.rb +28 -0
- data/spec/app/config/environments/test.rb +28 -0
- data/spec/app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/app/config/initializers/inflections.rb +10 -0
- data/spec/app/config/initializers/mime_types.rb +5 -0
- data/spec/app/config/initializers/new_rails_defaults.rb +19 -0
- data/spec/app/config/initializers/session_store.rb +15 -0
- data/spec/app/config/locales/en.yml +5 -0
- data/spec/app/config/routes.rb +7 -0
- data/spec/app/db/migrate/20090623181503_create_users.rb +13 -0
- data/spec/app/db/migrate/20090623181555_create_posts.rb +15 -0
- data/spec/app/db/migrate/20090623181609_create_comments.rb +15 -0
- data/spec/app/db/schema.rb +36 -0
- data/spec/app/db/test.sqlite3 +0 -0
- data/spec/app/doc/README_FOR_APP +2 -0
- data/spec/app/lib/tasks/rspec.rake +167 -0
- data/spec/app/log/.gitignore +1 -0
- data/spec/app/script/about +4 -0
- data/spec/app/script/autospec +6 -0
- data/spec/app/script/console +3 -0
- data/spec/app/script/dbconsole +3 -0
- data/spec/app/script/destroy +3 -0
- data/spec/app/script/generate +3 -0
- data/spec/app/script/performance/benchmarker +3 -0
- data/spec/app/script/performance/profiler +3 -0
- data/spec/app/script/plugin +3 -0
- data/spec/app/script/runner +3 -0
- data/spec/app/script/server +3 -0
- data/spec/app/script/spec +10 -0
- data/spec/app/script/spec_server +9 -0
- data/spec/app/tmp/.gitignore +4 -0
- data/spec/collapsed_routes_spec.rb +39 -0
- data/spec/spec_helper.rb +13 -0
- metadata +153 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)}
|
3
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
4
|
+
else
|
5
|
+
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
6
|
+
ENV["RAILS_ENV"] ||= 'test'
|
7
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
|
8
|
+
end
|
9
|
+
require 'spec/autorun'
|
10
|
+
exit ::Spec::Runner::CommandLine.run
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
3
|
+
|
4
|
+
puts "Loading Rails environment"
|
5
|
+
ENV["RAILS_ENV"] ||= 'test'
|
6
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
|
7
|
+
|
8
|
+
require 'optparse'
|
9
|
+
require 'spec/rails/spec_server'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
include ActionController::UrlWriter
|
4
|
+
include CollapsedRoutes
|
5
|
+
|
6
|
+
ActionController::Base.default_url_options[:host] = "localhost"
|
7
|
+
|
8
|
+
describe "UrlWriter" do
|
9
|
+
before do
|
10
|
+
@user = User.create :name => "Buddy Holly"
|
11
|
+
@post = @user.posts.create :title => "Hi world", :body => "foo bar"
|
12
|
+
@comment = @post.comments.create :title => "Hello back", :body => "who?"
|
13
|
+
collapsed_routes :users, :posts, :comments
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have routes already defined" do
|
17
|
+
user_path(@user).should == "/users/#{@user.id}"
|
18
|
+
user_posts_path(@user).should == "/users/#{@user.id}/posts"
|
19
|
+
user_post_path(@user, @post).should == "/users/#{@user.id}/posts/#{@post.id}"
|
20
|
+
user_post_comment_path(@user, @post, @comment).should == "/users/#{@user.id}/posts/#{@post.id}/comments/#{@comment.id}"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should define collapsed paths" do
|
24
|
+
comment_path(@comment).should == user_post_comment_path(@user, @post, @comment)
|
25
|
+
comment_path.should == user_post_comment_path(@user, @post, @comment)
|
26
|
+
edit_comment_path(@comment).should == edit_user_post_comment_path(@user, @post, @comment)
|
27
|
+
new_comment_path(@post).should == new_user_post_comment_path(@user, @post)
|
28
|
+
comments_path(@post).should == user_post_comments_path(@user, @post)
|
29
|
+
comments_path.should == user_post_comments_path(@user, @post)
|
30
|
+
end
|
31
|
+
it "should define collapsed urls" do
|
32
|
+
comment_url(@comment).should == user_post_comment_url(@user, @post, @comment)
|
33
|
+
comment_url.should == user_post_comment_url(@user, @post, @comment)
|
34
|
+
edit_comment_url(@comment).should == edit_user_post_comment_url(@user, @post, @comment)
|
35
|
+
new_comment_url(@post).should == new_user_post_comment_url(@user, @post)
|
36
|
+
comments_url(@post).should == user_post_comments_url(@user, @post)
|
37
|
+
comments_url.should == user_post_comments_url(@user, @post)
|
38
|
+
end
|
39
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
4
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
|
+
require 'collapsed_routes'
|
6
|
+
ENV["RAILS_ENV"] = "test"
|
7
|
+
require File.dirname(__FILE__) + "/app/config/environment"
|
8
|
+
require 'spec/autorun'
|
9
|
+
require 'spec/rails'
|
10
|
+
|
11
|
+
Spec::Runner.configure do |config|
|
12
|
+
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fizx-collapsed_routes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kyle Maxwell
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-23 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: kyle@kylemaxwell.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
29
|
+
- README.rdoc
|
30
|
+
- Rakefile
|
31
|
+
- VERSION
|
32
|
+
- collapsed_routes.gemspec
|
33
|
+
- lib/collapsed_routes.rb
|
34
|
+
- spec/app/README
|
35
|
+
- spec/app/Rakefile
|
36
|
+
- spec/app/app/controllers/application_controller.rb
|
37
|
+
- spec/app/app/controllers/comments_controller.rb
|
38
|
+
- spec/app/app/controllers/posts_controller.rb
|
39
|
+
- spec/app/app/controllers/users_controller.rb
|
40
|
+
- spec/app/app/helpers/application_helper.rb
|
41
|
+
- spec/app/app/helpers/comments_helper.rb
|
42
|
+
- spec/app/app/helpers/posts_helper.rb
|
43
|
+
- spec/app/app/helpers/users_helper.rb
|
44
|
+
- spec/app/app/models/comment.rb
|
45
|
+
- spec/app/app/models/post.rb
|
46
|
+
- spec/app/app/models/user.rb
|
47
|
+
- spec/app/app/views/comments/edit.html.erb
|
48
|
+
- spec/app/app/views/comments/index.html.erb
|
49
|
+
- spec/app/app/views/comments/new.html.erb
|
50
|
+
- spec/app/app/views/comments/show.html.erb
|
51
|
+
- spec/app/app/views/layouts/comments.html.erb
|
52
|
+
- spec/app/app/views/layouts/posts.html.erb
|
53
|
+
- spec/app/app/views/layouts/users.html.erb
|
54
|
+
- spec/app/app/views/posts/edit.html.erb
|
55
|
+
- spec/app/app/views/posts/index.html.erb
|
56
|
+
- spec/app/app/views/posts/new.html.erb
|
57
|
+
- spec/app/app/views/posts/show.html.erb
|
58
|
+
- spec/app/app/views/users/edit.html.erb
|
59
|
+
- spec/app/app/views/users/index.html.erb
|
60
|
+
- spec/app/app/views/users/new.html.erb
|
61
|
+
- spec/app/app/views/users/show.html.erb
|
62
|
+
- spec/app/config/boot.rb
|
63
|
+
- spec/app/config/database.yml
|
64
|
+
- spec/app/config/environment.rb
|
65
|
+
- spec/app/config/environments/development.rb
|
66
|
+
- spec/app/config/environments/production.rb
|
67
|
+
- spec/app/config/environments/test.rb
|
68
|
+
- spec/app/config/initializers/backtrace_silencers.rb
|
69
|
+
- spec/app/config/initializers/inflections.rb
|
70
|
+
- spec/app/config/initializers/mime_types.rb
|
71
|
+
- spec/app/config/initializers/new_rails_defaults.rb
|
72
|
+
- spec/app/config/initializers/session_store.rb
|
73
|
+
- spec/app/config/locales/en.yml
|
74
|
+
- spec/app/config/routes.rb
|
75
|
+
- spec/app/db/migrate/20090623181503_create_users.rb
|
76
|
+
- spec/app/db/migrate/20090623181555_create_posts.rb
|
77
|
+
- spec/app/db/migrate/20090623181609_create_comments.rb
|
78
|
+
- spec/app/db/schema.rb
|
79
|
+
- spec/app/db/test.sqlite3
|
80
|
+
- spec/app/doc/README_FOR_APP
|
81
|
+
- spec/app/lib/tasks/rspec.rake
|
82
|
+
- spec/app/log/.gitignore
|
83
|
+
- spec/app/script/about
|
84
|
+
- spec/app/script/autospec
|
85
|
+
- spec/app/script/console
|
86
|
+
- spec/app/script/dbconsole
|
87
|
+
- spec/app/script/destroy
|
88
|
+
- spec/app/script/generate
|
89
|
+
- spec/app/script/performance/benchmarker
|
90
|
+
- spec/app/script/performance/profiler
|
91
|
+
- spec/app/script/plugin
|
92
|
+
- spec/app/script/runner
|
93
|
+
- spec/app/script/server
|
94
|
+
- spec/app/script/spec
|
95
|
+
- spec/app/script/spec_server
|
96
|
+
- spec/app/tmp/.gitignore
|
97
|
+
- spec/collapsed_routes_spec.rb
|
98
|
+
- spec/spec_helper.rb
|
99
|
+
has_rdoc: true
|
100
|
+
homepage: http://github.com/fizx/collapsed_routes
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options:
|
103
|
+
- --charset=UTF-8
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: "0"
|
111
|
+
version:
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: "0"
|
117
|
+
version:
|
118
|
+
requirements: []
|
119
|
+
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 1.2.0
|
122
|
+
signing_key:
|
123
|
+
specification_version: 3
|
124
|
+
summary: TODO
|
125
|
+
test_files:
|
126
|
+
- spec/app/app/controllers/application_controller.rb
|
127
|
+
- spec/app/app/controllers/comments_controller.rb
|
128
|
+
- spec/app/app/controllers/posts_controller.rb
|
129
|
+
- spec/app/app/controllers/users_controller.rb
|
130
|
+
- spec/app/app/helpers/application_helper.rb
|
131
|
+
- spec/app/app/helpers/comments_helper.rb
|
132
|
+
- spec/app/app/helpers/posts_helper.rb
|
133
|
+
- spec/app/app/helpers/users_helper.rb
|
134
|
+
- spec/app/app/models/comment.rb
|
135
|
+
- spec/app/app/models/post.rb
|
136
|
+
- spec/app/app/models/user.rb
|
137
|
+
- spec/app/config/boot.rb
|
138
|
+
- spec/app/config/environment.rb
|
139
|
+
- spec/app/config/environments/development.rb
|
140
|
+
- spec/app/config/environments/production.rb
|
141
|
+
- spec/app/config/environments/test.rb
|
142
|
+
- spec/app/config/initializers/backtrace_silencers.rb
|
143
|
+
- spec/app/config/initializers/inflections.rb
|
144
|
+
- spec/app/config/initializers/mime_types.rb
|
145
|
+
- spec/app/config/initializers/new_rails_defaults.rb
|
146
|
+
- spec/app/config/initializers/session_store.rb
|
147
|
+
- spec/app/config/routes.rb
|
148
|
+
- spec/app/db/migrate/20090623181503_create_users.rb
|
149
|
+
- spec/app/db/migrate/20090623181555_create_posts.rb
|
150
|
+
- spec/app/db/migrate/20090623181609_create_comments.rb
|
151
|
+
- spec/app/db/schema.rb
|
152
|
+
- spec/collapsed_routes_spec.rb
|
153
|
+
- spec/spec_helper.rb
|