spreadhead 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spreadhead/extensions/routes.rb +1 -1
- data/test/controllers/pages_controller_test.rb +36 -31
- metadata +47 -17
@@ -3,7 +3,7 @@ if defined?(ActionController::Routing::RouteSet)
|
|
3
3
|
def load_routes_with_spreadhead!
|
4
4
|
lib_path = File.dirname(__FILE__)
|
5
5
|
spreadhead_routes = File.join(lib_path, *%w[.. .. .. config spreadhead_routes.rb])
|
6
|
-
|
6
|
+
if configuration_files.include?(Rails.configuration.routes_configuration_file) and not configuration_files.include?(spreadhead_routes)
|
7
7
|
add_configuration_file(spreadhead_routes)
|
8
8
|
end
|
9
9
|
load_routes_without_spreadhead!
|
@@ -9,19 +9,19 @@ class PagesControllerTest < ActionController::TestCase
|
|
9
9
|
setup do
|
10
10
|
module Spreadhead::PagesAuth
|
11
11
|
def self.filter(controller); controller.send(:head, 403); end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
15
|
context "on GET to #new" do
|
16
16
|
setup { get :new }
|
17
17
|
should_respond_with 403
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
context "on GET to #show" do
|
21
21
|
setup do
|
22
22
|
page = Factory(:page)
|
23
23
|
get :show, :url => page.url
|
24
|
-
end
|
24
|
+
end
|
25
25
|
|
26
26
|
should_respond_with :success
|
27
27
|
should_render_template :show
|
@@ -33,9 +33,9 @@ class PagesControllerTest < ActionController::TestCase
|
|
33
33
|
setup do
|
34
34
|
module Spreadhead::PagesAuth
|
35
35
|
def self.filter(controller); true; end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
39
|
context "on GET to #new" do
|
40
40
|
setup { get :new }
|
41
41
|
|
@@ -56,7 +56,7 @@ class PagesControllerTest < ActionController::TestCase
|
|
56
56
|
setup do
|
57
57
|
page = Factory(:page)
|
58
58
|
get :show, :url => page.url
|
59
|
-
end
|
59
|
+
end
|
60
60
|
|
61
61
|
should_respond_with :success
|
62
62
|
should_render_template :show
|
@@ -67,7 +67,7 @@ class PagesControllerTest < ActionController::TestCase
|
|
67
67
|
setup do
|
68
68
|
page = Factory(:page)
|
69
69
|
get :edit, :id => page.id
|
70
|
-
end
|
70
|
+
end
|
71
71
|
|
72
72
|
should_respond_with :success
|
73
73
|
should_render_template :edit
|
@@ -79,29 +79,29 @@ class PagesControllerTest < ActionController::TestCase
|
|
79
79
|
page_attributes = Factory.attributes_for(:page)
|
80
80
|
post :create, :page => page_attributes
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
should_respond_with :redirect
|
84
84
|
should_not_set_the_flash
|
85
85
|
should_redirect_to("The list of pages") { pages_url }
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
context "on PUT to #update with valid attributes" do
|
89
89
|
setup do
|
90
|
-
page = Factory(:page)
|
90
|
+
page = Factory(:page)
|
91
91
|
put :update, :id => page.id, :page => page.attributes
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
should_respond_with :redirect
|
95
95
|
should_not_set_the_flash
|
96
96
|
should_redirect_to("The list of pages") { pages_url }
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
context "on DELETE to #destroy with valid attributes" do
|
100
100
|
setup do
|
101
101
|
page = Factory(:page)
|
102
102
|
delete :destroy, :id => page.id
|
103
103
|
end
|
104
|
-
|
104
|
+
|
105
105
|
should_respond_with :redirect
|
106
106
|
should_not_set_the_flash
|
107
107
|
should_redirect_to("The list of pages") { pages_url }
|
@@ -114,9 +114,14 @@ class PagesControllerTest < ActionController::TestCase
|
|
114
114
|
end
|
115
115
|
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
context "routes" do
|
119
|
-
|
119
|
+
|
120
|
+
should 'not load the routes file premeturely even if inflections is called' do
|
121
|
+
# ActiveSupport::Inflector::inflections
|
122
|
+
# I have no clue how to write a failing test for this
|
123
|
+
end
|
124
|
+
|
120
125
|
should "recognize the page resources" do
|
121
126
|
assert_recognizes({:controller => 'spreadhead/pages', :action => 'index'}, {:path => '/pages', :method => :get})
|
122
127
|
assert_recognizes({:controller => 'spreadhead/pages', :action => 'new'}, {:path => '/pages/new', :method => :get})
|
@@ -125,23 +130,23 @@ class PagesControllerTest < ActionController::TestCase
|
|
125
130
|
assert_recognizes({:controller => 'spreadhead/pages', :id => '1', :action => 'update'}, {:path => '/pages/1', :method => :put})
|
126
131
|
assert_recognizes({:controller => 'spreadhead/pages', :id => '1', :action => 'edit'}, {:path => '/pages/1/edit', :method => :get})
|
127
132
|
end
|
128
|
-
|
129
|
-
should "recognize the about path" do
|
133
|
+
|
134
|
+
should "recognize the about path" do
|
130
135
|
assert_recognizes({:controller => 'spreadhead/pages', :action => 'show', :url => ['about']}, {:path => '/about', :method => :get})
|
131
|
-
end
|
132
|
-
|
133
|
-
should "recognize the privacy path" do
|
136
|
+
end
|
137
|
+
|
138
|
+
should "recognize the privacy path" do
|
134
139
|
assert_recognizes({:controller => 'spreadhead/pages', :action => 'show', :url => ['about', 'privacy']}, {:path => '/about/privacy', :method => :get})
|
135
|
-
end
|
136
|
-
|
137
|
-
should "recognize the birthday path" do
|
140
|
+
end
|
141
|
+
|
142
|
+
should "recognize the birthday path" do
|
138
143
|
assert_recognizes({:controller => 'spreadhead/pages', :action => 'show', :url => ['2004', '09', '13', 'birthday']}, {:path => '/2004/09/13/birthday', :method => :get})
|
139
|
-
end
|
140
|
-
|
144
|
+
end
|
145
|
+
|
141
146
|
should "recognize the root path" do
|
142
147
|
assert_recognizes({:controller => 'spreadhead/pages', :action => 'show', :url => []}, {:path => '/', :method => :get})
|
143
148
|
end
|
144
|
-
|
149
|
+
|
145
150
|
should "not override the things" do
|
146
151
|
assert_recognizes({:controller => 'things', :action => 'index'}, {:path => '/things', :method => :get})
|
147
152
|
assert_recognizes({:controller => 'things', :action => 'new'}, {:path => '/things/new', :method => :get})
|
@@ -155,7 +160,7 @@ class PagesControllerTest < ActionController::TestCase
|
|
155
160
|
should "not override clearance paths" do
|
156
161
|
assert_recognizes({:controller => 'sessions', :action => 'new'}, {:path => '/session/new', :method => :get})
|
157
162
|
end
|
158
|
-
end
|
163
|
+
end
|
159
164
|
end
|
160
|
-
end
|
165
|
+
end
|
161
166
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadhead
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 1
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 3
|
10
|
+
version: 0.6.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Jeff Rafter
|
@@ -14,34 +20,52 @@ default_executable:
|
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: BlueCloth
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
23
34
|
version: 1.0.0
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
- !ruby/object:Gem::Dependency
|
26
38
|
name: RedCloth
|
27
|
-
|
28
|
-
|
29
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
30
42
|
requirements:
|
31
43
|
- - ">="
|
32
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 57
|
46
|
+
segments:
|
47
|
+
- 4
|
48
|
+
- 1
|
49
|
+
- 1
|
33
50
|
version: 4.1.1
|
34
|
-
version:
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rsl-stringex
|
37
51
|
type: :runtime
|
38
|
-
|
39
|
-
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: stringex
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
40
58
|
requirements:
|
41
59
|
- - ">="
|
42
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 19
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 0
|
65
|
+
- 2
|
43
66
|
version: 1.0.2
|
44
|
-
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
45
69
|
description: Rails content mangement for pages that shouldn't be views.
|
46
70
|
email: jeff@socialrange.org
|
47
71
|
executables: []
|
@@ -98,21 +122,27 @@ rdoc_options:
|
|
98
122
|
require_paths:
|
99
123
|
- lib
|
100
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
101
126
|
requirements:
|
102
127
|
- - ">="
|
103
128
|
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
104
132
|
version: "0"
|
105
|
-
version:
|
106
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
107
135
|
requirements:
|
108
136
|
- - ">="
|
109
137
|
- !ruby/object:Gem::Version
|
138
|
+
hash: 3
|
139
|
+
segments:
|
140
|
+
- 0
|
110
141
|
version: "0"
|
111
|
-
version:
|
112
142
|
requirements: []
|
113
143
|
|
114
144
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.3.
|
145
|
+
rubygems_version: 1.3.9.2
|
116
146
|
signing_key:
|
117
147
|
specification_version: 3
|
118
148
|
summary: Rails content mangement for pages that shouldn't be views.
|