deluxe_publisher 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +29 -0
  4. data/LICENSE +20 -0
  5. data/README.rdoc +127 -0
  6. data/Rakefile +61 -0
  7. data/VERSION +1 -0
  8. data/app/controllers/deluxe_publisher/comments_controller.rb +93 -0
  9. data/app/controllers/deluxe_publisher/page_types_controller.rb +115 -0
  10. data/app/controllers/deluxe_publisher/pages_controller.rb +191 -0
  11. data/app/controllers/deluxe_publisher/presenter_controller.rb +185 -0
  12. data/app/controllers/deluxe_publisher/redirects_controller.rb +90 -0
  13. data/app/controllers/deluxe_publisher/sitemap_controller.rb +10 -0
  14. data/app/helpers/application_helper.rb +2 -0
  15. data/app/helpers/deluxe_publisher/comments_helper.rb +2 -0
  16. data/app/helpers/deluxe_publisher/page_types_helper.rb +13 -0
  17. data/app/helpers/deluxe_publisher/pages_helper.rb +41 -0
  18. data/app/helpers/deluxe_publisher/presenter_helper.rb +111 -0
  19. data/app/helpers/deluxe_publisher/redirects_helper.rb +2 -0
  20. data/app/helpers/deluxe_publisher/sitemap_helper.rb +2 -0
  21. data/app/models/ckeditor/asset.rb +88 -0
  22. data/app/models/ckeditor/attachment_file.rb +40 -0
  23. data/app/models/ckeditor/picture.rb +23 -0
  24. data/app/models/deluxe_publisher/comment.rb +6 -0
  25. data/app/models/deluxe_publisher/content.rb +6 -0
  26. data/app/models/deluxe_publisher/content_descriptor.rb +4 -0
  27. data/app/models/deluxe_publisher/page.rb +206 -0
  28. data/app/models/deluxe_publisher/page_type.rb +55 -0
  29. data/app/models/deluxe_publisher/redirect.rb +6 -0
  30. data/app/models/deluxe_publisher.rb +5 -0
  31. data/app/views/deluxe_publisher/comments/_form.html.erb +31 -0
  32. data/app/views/deluxe_publisher/comments/edit.html.erb +6 -0
  33. data/app/views/deluxe_publisher/comments/index.html.erb +31 -0
  34. data/app/views/deluxe_publisher/comments/new.html.erb +6 -0
  35. data/app/views/deluxe_publisher/comments/show.html.erb +30 -0
  36. data/app/views/deluxe_publisher/page_types/_content_descriptors.html.erb +15 -0
  37. data/app/views/deluxe_publisher/page_types/_form.html.erb +59 -0
  38. data/app/views/deluxe_publisher/page_types/content_areas_change.js.erb +3 -0
  39. data/app/views/deluxe_publisher/page_types/edit.html.erb +8 -0
  40. data/app/views/deluxe_publisher/page_types/index.html.erb +29 -0
  41. data/app/views/deluxe_publisher/page_types/new.html.erb +7 -0
  42. data/app/views/deluxe_publisher/page_types/show.html.erb +45 -0
  43. data/app/views/deluxe_publisher/pages/_form.html.erb +39 -0
  44. data/app/views/deluxe_publisher/pages/_general.html.erb +108 -0
  45. data/app/views/deluxe_publisher/pages/_page.html.erb +23 -0
  46. data/app/views/deluxe_publisher/pages/_page_content.html.erb +16 -0
  47. data/app/views/deluxe_publisher/pages/_page_links.html.erb +9 -0
  48. data/app/views/deluxe_publisher/pages/_seo.html.erb +27 -0
  49. data/app/views/deluxe_publisher/pages/edit.html.erb +5 -0
  50. data/app/views/deluxe_publisher/pages/index.html.erb +11 -0
  51. data/app/views/deluxe_publisher/pages/new.html.erb +6 -0
  52. data/app/views/deluxe_publisher/pages/page_type_change.js.erb +3 -0
  53. data/app/views/deluxe_publisher/pages/show.html.erb +115 -0
  54. data/app/views/deluxe_publisher/presenter/create_comment.js.erb +3 -0
  55. data/app/views/deluxe_publisher/presenter/create_comment_failed.js.erb +1 -0
  56. data/app/views/deluxe_publisher/presenter/new_comment.js.erb +7 -0
  57. data/app/views/deluxe_publisher/presenter/preview.html.erb +2 -0
  58. data/app/views/deluxe_publisher/redirects/_form.html.erb +29 -0
  59. data/app/views/deluxe_publisher/redirects/edit.html.erb +6 -0
  60. data/app/views/deluxe_publisher/redirects/index.html.erb +27 -0
  61. data/app/views/deluxe_publisher/redirects/new.html.erb +5 -0
  62. data/app/views/deluxe_publisher/redirects/show.html.erb +20 -0
  63. data/app/views/deluxe_publisher/sitemap/index.xml.builder +12 -0
  64. data/app/views/deluxe_publisher/templates/simple_blog.html.erb +19 -0
  65. data/app/views/deluxe_publisher/templates/simple_blog.rss.builder +23 -0
  66. data/app/views/deluxe_publisher/templates/simple_blog_story.html.erb +9 -0
  67. data/app/views/deluxe_publisher/templates/simple_page.html.erb +4 -0
  68. data/app/views/layouts/_deluxe_publisher_comment_form.html.erb +29 -0
  69. data/app/views/layouts/_deluxe_publisher_comments_list.html.erb +8 -0
  70. data/app/views/layouts/application.html.erb +14 -0
  71. data/app/views/layouts/deluxe_publisher.html.erb +36 -0
  72. data/app/views/layouts/deluxe_publisher_blog.html.erb +63 -0
  73. data/app/views/layouts/deluxe_publisher_simple.html.erb +30 -0
  74. data/config/routes.rb +49 -0
  75. data/deluxe_publisher.gemspec +466 -0
  76. data/lib/deluxe_publisher/deluxe_publisher_authentication.rb +37 -0
  77. data/lib/deluxe_publisher/engine.rb +5 -0
  78. data/lib/deluxe_publisher.rb +40 -0
  79. data/lib/generators/deluxe_publisher/base/USAGE +8 -0
  80. data/lib/generators/deluxe_publisher/base/base_generator.rb +45 -0
  81. data/lib/generators/deluxe_publisher/base/templates/images/add.png +0 -0
  82. data/lib/generators/deluxe_publisher/base/templates/images/btn_addNewPage.gif +0 -0
  83. data/lib/generators/deluxe_publisher/base/templates/images/btn_cancel.gif +0 -0
  84. data/lib/generators/deluxe_publisher/base/templates/images/btn_preview.gif +0 -0
  85. data/lib/generators/deluxe_publisher/base/templates/images/btn_save.gif +0 -0
  86. data/lib/generators/deluxe_publisher/base/templates/images/bullet.gif +0 -0
  87. data/lib/generators/deluxe_publisher/base/templates/images/content_bg.jpg +0 -0
  88. data/lib/generators/deluxe_publisher/base/templates/images/delete.png +0 -0
  89. data/lib/generators/deluxe_publisher/base/templates/images/edit.png +0 -0
  90. data/lib/generators/deluxe_publisher/base/templates/images/header_background.jpg +0 -0
  91. data/lib/generators/deluxe_publisher/base/templates/images/icon_published.gif +0 -0
  92. data/lib/generators/deluxe_publisher/base/templates/images/icon_unpublished.gif +0 -0
  93. data/lib/generators/deluxe_publisher/base/templates/images/logo.gif +0 -0
  94. data/lib/generators/deluxe_publisher/base/templates/images/minus.gif +0 -0
  95. data/lib/generators/deluxe_publisher/base/templates/images/plus.gif +0 -0
  96. data/lib/generators/deluxe_publisher/base/templates/images/show.png +0 -0
  97. data/lib/generators/deluxe_publisher/base/templates/images/tab_bg.gif +0 -0
  98. data/lib/generators/deluxe_publisher/base/templates/images/tabs_bg.jpg +0 -0
  99. data/lib/generators/deluxe_publisher/base/templates/initializer.rb +23 -0
  100. data/lib/generators/deluxe_publisher/base/templates/javascripts/deluxe_presenter.js +25 -0
  101. data/lib/generators/deluxe_publisher/base/templates/javascripts/deluxe_publisher.js +86 -0
  102. data/lib/generators/deluxe_publisher/base/templates/javascripts/jquery-rails.js +158 -0
  103. data/lib/generators/deluxe_publisher/base/templates/layouts/_deluxe_publisher_comment_form.html.erb +29 -0
  104. data/lib/generators/deluxe_publisher/base/templates/layouts/_deluxe_publisher_comments_list.html.erb +8 -0
  105. data/lib/generators/deluxe_publisher/base/templates/layouts/deluxe_publisher_blog.html.erb +74 -0
  106. data/lib/generators/deluxe_publisher/base/templates/layouts/deluxe_publisher_simple.html.erb +47 -0
  107. data/lib/generators/deluxe_publisher/base/templates/stylesheets/deluxe_presenter.css +458 -0
  108. data/lib/generators/deluxe_publisher/base/templates/stylesheets/deluxe_publisher.css +202 -0
  109. data/lib/generators/deluxe_publisher/base/templates/templates/simple_blog.html.erb +19 -0
  110. data/lib/generators/deluxe_publisher/base/templates/templates/simple_blog.rss.builder +23 -0
  111. data/lib/generators/deluxe_publisher/base/templates/templates/simple_blog_story.html.erb +12 -0
  112. data/lib/generators/deluxe_publisher/base/templates/templates/simple_page.html.erb +4 -0
  113. data/lib/generators/deluxe_publisher/migration/USAGE +0 -0
  114. data/lib/generators/deluxe_publisher/migration/migration_generator.rb +18 -0
  115. data/lib/generators/deluxe_publisher/migration/templates/migration.rb +98 -0
  116. data/lib/generators/deluxe_publisher/sample_site/sample_site_generator.rb +316 -0
  117. data/spec/controllers/deluxe_publisher/comments_controller_spec.rb +129 -0
  118. data/spec/controllers/deluxe_publisher/page_types_controller_spec.rb +125 -0
  119. data/spec/controllers/deluxe_publisher/pages_controller_spec.rb +129 -0
  120. data/spec/controllers/deluxe_publisher/presenter_controller_spec.rb +19 -0
  121. data/spec/controllers/deluxe_publisher/redirects_controller_spec.rb +118 -0
  122. data/spec/deluxe_publisher_spec.rb +7 -0
  123. data/spec/dummy/Rakefile +7 -0
  124. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  125. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  126. data/spec/dummy/app/views/deluxe_publisher/comments/_form.html.erb +31 -0
  127. data/spec/dummy/app/views/deluxe_publisher/comments/edit.html.erb +6 -0
  128. data/spec/dummy/app/views/deluxe_publisher/comments/index.html.erb +31 -0
  129. data/spec/dummy/app/views/deluxe_publisher/comments/new.html.erb +6 -0
  130. data/spec/dummy/app/views/deluxe_publisher/comments/show.html.erb +30 -0
  131. data/spec/dummy/app/views/deluxe_publisher/page_types/_content_descriptors.html.erb +15 -0
  132. data/spec/dummy/app/views/deluxe_publisher/page_types/_form.html.erb +59 -0
  133. data/spec/dummy/app/views/deluxe_publisher/page_types/content_areas_change.js.erb +3 -0
  134. data/spec/dummy/app/views/deluxe_publisher/page_types/edit.html.erb +8 -0
  135. data/spec/dummy/app/views/deluxe_publisher/page_types/index.html.erb +29 -0
  136. data/spec/dummy/app/views/deluxe_publisher/page_types/new.html.erb +7 -0
  137. data/spec/dummy/app/views/deluxe_publisher/page_types/show.html.erb +45 -0
  138. data/spec/dummy/app/views/deluxe_publisher/pages/_form.html.erb +36 -0
  139. data/spec/dummy/app/views/deluxe_publisher/pages/_general.html.erb +108 -0
  140. data/spec/dummy/app/views/deluxe_publisher/pages/_page.html.erb +23 -0
  141. data/spec/dummy/app/views/deluxe_publisher/pages/_page_content.html.erb +16 -0
  142. data/spec/dummy/app/views/deluxe_publisher/pages/_page_links.html.erb +9 -0
  143. data/spec/dummy/app/views/deluxe_publisher/pages/_seo.html.erb +27 -0
  144. data/spec/dummy/app/views/deluxe_publisher/pages/edit.html.erb +7 -0
  145. data/spec/dummy/app/views/deluxe_publisher/pages/index.html.erb +10 -0
  146. data/spec/dummy/app/views/deluxe_publisher/pages/new.html.erb +7 -0
  147. data/spec/dummy/app/views/deluxe_publisher/pages/page_type_change.js.erb +3 -0
  148. data/spec/dummy/app/views/deluxe_publisher/pages/show.html.erb +115 -0
  149. data/spec/dummy/app/views/deluxe_publisher/presenter/create_comment.js.erb +3 -0
  150. data/spec/dummy/app/views/deluxe_publisher/presenter/create_comment_failed.js.erb +1 -0
  151. data/spec/dummy/app/views/deluxe_publisher/presenter/new_comment.js.erb +7 -0
  152. data/spec/dummy/app/views/deluxe_publisher/presenter/preview.html.erb +2 -0
  153. data/spec/dummy/app/views/deluxe_publisher/templates/simple_blog.html.erb +19 -0
  154. data/spec/dummy/app/views/deluxe_publisher/templates/simple_blog.rss.builder +23 -0
  155. data/spec/dummy/app/views/deluxe_publisher/templates/simple_blog_story.html.erb +9 -0
  156. data/spec/dummy/app/views/deluxe_publisher/templates/simple_page.html.erb +4 -0
  157. data/spec/dummy/app/views/layouts/_deluxe_publisher_comment_form.html.erb +29 -0
  158. data/spec/dummy/app/views/layouts/_deluxe_publisher_comments_list.html.erb +8 -0
  159. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  160. data/spec/dummy/app/views/layouts/deluxe_publisher.html.erb +31 -0
  161. data/spec/dummy/app/views/layouts/deluxe_publisher_blog.html.erb +63 -0
  162. data/spec/dummy/app/views/layouts/deluxe_publisher_simple.html.erb +30 -0
  163. data/spec/dummy/config/application.rb +45 -0
  164. data/spec/dummy/config/boot.rb +10 -0
  165. data/spec/dummy/config/database.yml +22 -0
  166. data/spec/dummy/config/environment.rb +5 -0
  167. data/spec/dummy/config/environments/development.rb +26 -0
  168. data/spec/dummy/config/environments/production.rb +49 -0
  169. data/spec/dummy/config/environments/test.rb +35 -0
  170. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  171. data/spec/dummy/config/initializers/deluxe_publisher.rb +23 -0
  172. data/spec/dummy/config/initializers/inflections.rb +10 -0
  173. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  174. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  175. data/spec/dummy/config/initializers/session_store.rb +8 -0
  176. data/spec/dummy/config/locales/en.yml +5 -0
  177. data/spec/dummy/config/routes.rb +104 -0
  178. data/spec/dummy/config.ru +4 -0
  179. data/spec/dummy/db/migrate/20110405190943_create_deluxe_publisher.rb +135 -0
  180. data/spec/dummy/db/schema.rb +130 -0
  181. data/spec/dummy/public/404.html +26 -0
  182. data/spec/dummy/public/422.html +26 -0
  183. data/spec/dummy/public/500.html +26 -0
  184. data/spec/dummy/public/favicon.ico +0 -0
  185. data/spec/dummy/public/javascripts/application.js +2 -0
  186. data/spec/dummy/public/javascripts/controls.js +965 -0
  187. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  188. data/spec/dummy/public/javascripts/effects.js +1123 -0
  189. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  190. data/spec/dummy/public/javascripts/rails.js +191 -0
  191. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  192. data/spec/dummy/script/rails +6 -0
  193. data/spec/factories/comment_factory.rb +4 -0
  194. data/spec/factories/content_descriptor_factory.rb +5 -0
  195. data/spec/factories/content_factory.rb +24 -0
  196. data/spec/factories/page_factory.rb +26 -0
  197. data/spec/factories/page_type_factory.rb +10 -0
  198. data/spec/factories/redirect_factory.rb +4 -0
  199. data/spec/helpers/deluxe_publisher/comments_helper_spec.rb +15 -0
  200. data/spec/helpers/deluxe_publisher/page_types_helper_spec.rb +26 -0
  201. data/spec/helpers/deluxe_publisher/pages_helper_spec.rb +65 -0
  202. data/spec/helpers/deluxe_publisher/presenter_helper_spec.rb +19 -0
  203. data/spec/helpers/deluxe_publisher/redirects_helper_spec.rb +15 -0
  204. data/spec/integration/navigation_spec.rb +9 -0
  205. data/spec/models/deluxe_publisher/comment_spec.rb +5 -0
  206. data/spec/models/deluxe_publisher/content_descriptor_spec.rb +5 -0
  207. data/spec/models/deluxe_publisher/content_spec.rb +5 -0
  208. data/spec/models/deluxe_publisher/page_spec.rb +358 -0
  209. data/spec/models/deluxe_publisher/page_type_spec.rb +62 -0
  210. data/spec/models/deluxe_publisher/redirect_spec.rb +17 -0
  211. data/spec/requests/deluxe_publisher/deluxe_publisher_comments_spec.rb +11 -0
  212. data/spec/requests/deluxe_publisher/deluxe_publisher_page_types_spec.rb +11 -0
  213. data/spec/requests/deluxe_publisher/deluxe_publisher_redirects_spec.rb +11 -0
  214. data/spec/requests/deluxe_publisher/pages_spec.rb +11 -0
  215. data/spec/routing/deluxe_publisher/comments_routing_spec.rb +35 -0
  216. data/spec/routing/deluxe_publisher/page_types_routing_spec.rb +47 -0
  217. data/spec/routing/deluxe_publisher/pages_routing_spec.rb +47 -0
  218. data/spec/routing/deluxe_publisher/presenter_routing_spec.rb +66 -0
  219. data/spec/routing/deluxe_publisher/redirects_routing_spec.rb +35 -0
  220. data/spec/spec_helper.rb +234 -0
  221. data/spec/views/deluxe_publisher/comments/edit.html.erb_spec.rb +24 -0
  222. data/spec/views/deluxe_publisher/comments/index.html.erb_spec.rb +32 -0
  223. data/spec/views/deluxe_publisher/comments/new.html.erb_spec.rb +24 -0
  224. data/spec/views/deluxe_publisher/comments/show.html.erb_spec.rb +24 -0
  225. data/spec/views/deluxe_publisher/page_types/edit.html.erb_spec.rb +32 -0
  226. data/spec/views/deluxe_publisher/page_types/index.html.erb_spec.rb +48 -0
  227. data/spec/views/deluxe_publisher/page_types/new.html.erb_spec.rb +32 -0
  228. data/spec/views/deluxe_publisher/page_types/show.html.erb_spec.rb +36 -0
  229. data/spec/views/deluxe_publisher/pages/edit.html.erb_spec.rb +58 -0
  230. data/spec/views/deluxe_publisher/pages/index.html.erb_spec.rb +100 -0
  231. data/spec/views/deluxe_publisher/pages/new.html.erb_spec.rb +81 -0
  232. data/spec/views/deluxe_publisher/pages/show.html.erb_spec.rb +75 -0
  233. data/spec/views/deluxe_publisher/presenter/present.html.erb_spec.rb +5 -0
  234. data/spec/views/deluxe_publisher/presenter/preview.html.erb_spec.rb +5 -0
  235. data/spec/views/deluxe_publisher/redirects/edit.html.erb_spec.rb +22 -0
  236. data/spec/views/deluxe_publisher/redirects/index.html.erb_spec.rb +28 -0
  237. data/spec/views/deluxe_publisher/redirects/new.html.erb_spec.rb +22 -0
  238. data/spec/views/deluxe_publisher/redirects/show.html.erb_spec.rb +21 -0
  239. metadata +1006 -0
@@ -0,0 +1,66 @@
1
+ require "spec_helper"
2
+
3
+ describe DeluxePublisher::PresenterController do
4
+ describe "routing" do
5
+ it "route all unknown paths to the presenter" do
6
+ { :get => "/awesome/co/telling/the/truth" }.should route_to(:controller => "deluxe_publisher/presenter",
7
+ :action => "present",
8
+ "page_path" => "awesome/co/telling/the/truth")
9
+ end
10
+
11
+ it "route all unknown paths to the presenter with format" do
12
+ { :get => "/awesome/co/telling/the/truth.htm" }.should route_to(:controller => "deluxe_publisher/presenter",
13
+ :action => "present",
14
+ "page_path" => "awesome/co/telling/the/truth",
15
+ :format => "htm")
16
+ end
17
+
18
+ it "route all unknown paths to the presenter ending in /" do
19
+ { :get => "/awesome/co/telling/the/truth/" }.should route_to(:controller => "deluxe_publisher/presenter",
20
+ :action => "present",
21
+ "page_path" => "awesome/co/telling/the/truth")
22
+ end
23
+
24
+ it "route all unknown paths to the presenter with index.format" do
25
+ { :get => "/awesome/co/telling/the/truth/index.htm" }.should route_to(:controller => "deluxe_publisher/presenter",
26
+ :action => "present",
27
+ "page_path" => "awesome/co/telling/the/truth",
28
+ :format => "htm")
29
+ end
30
+
31
+ it "root should route to presenter" do
32
+ { :get => "" }.should route_to(:controller => "deluxe_publisher/presenter", :action => "home")
33
+ end
34
+
35
+ it "should not match paths that are not :get"do
36
+ { :post => "/awesome/co/telling/the/truth" }.should raise_error
37
+ end
38
+
39
+ it "should route blog archives to presenter#blog_archives" do
40
+ { :get => "/bloging/the/truth/blog-archive/2001/10/26"}.should route_to(:controller => "deluxe_publisher/presenter",
41
+ :action => "blog_archives",
42
+ "page_path" => "bloging/the/truth",
43
+ :year => "2001",
44
+ :month => "10",
45
+ :day => "26"
46
+ )
47
+ end
48
+ it "should route blog archives to presenter#blog_archives" do
49
+ { :get => "/bloging/the/truth/blog-archive/2001/10"}.should route_to(:controller => "deluxe_publisher/presenter",
50
+ :action => "blog_archives",
51
+ "page_path" => "bloging/the/truth",
52
+ :year => "2001",
53
+ :month => "10"
54
+ )
55
+ end
56
+
57
+ it "should route blog archives to presenter#blog_archives" do
58
+ { :get => "/bloging/the/truth/blog-archive/2001"}.should route_to(:controller => "deluxe_publisher/presenter",
59
+ :action => "blog_archives",
60
+ "page_path" => "bloging/the/truth",
61
+ :year => "2001"
62
+ )
63
+ end
64
+
65
+ end
66
+ end
@@ -0,0 +1,35 @@
1
+ require "spec_helper"
2
+
3
+ describe DeluxePublisher::RedirectsController do
4
+ describe "routing" do
5
+
6
+ it "recognizes and generates #index" do
7
+ { :get => "/deluxe_publisher/redirects" }.should route_to(:controller => "deluxe_publisher/redirects", :action => "index")
8
+ end
9
+
10
+ it "recognizes and generates #new" do
11
+ { :get => "/deluxe_publisher/redirects/new" }.should route_to(:controller => "deluxe_publisher/redirects", :action => "new")
12
+ end
13
+
14
+ it "recognizes and generates #show" do
15
+ { :get => "/deluxe_publisher/redirects/1" }.should route_to(:controller => "deluxe_publisher/redirects", :action => "show", :id => "1")
16
+ end
17
+
18
+ it "recognizes and generates #edit" do
19
+ { :get => "/deluxe_publisher/redirects/1/edit" }.should route_to(:controller => "deluxe_publisher/redirects", :action => "edit", :id => "1")
20
+ end
21
+
22
+ it "recognizes and generates #create" do
23
+ { :post => "/deluxe_publisher/redirects" }.should route_to(:controller => "deluxe_publisher/redirects", :action => "create")
24
+ end
25
+
26
+ it "recognizes and generates #update" do
27
+ { :put => "/deluxe_publisher/redirects/1" }.should route_to(:controller => "deluxe_publisher/redirects", :action => "update", :id => "1")
28
+ end
29
+
30
+ it "recognizes and generates #destroy" do
31
+ { :delete => "/deluxe_publisher/redirects/1" }.should route_to(:controller => "deluxe_publisher/redirects", :action => "destroy", :id => "1")
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,234 @@
1
+ # Configure Rails Envinronment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ # require "rails/test_help"
6
+ require "rspec/rails"
7
+ require 'factory_girl'
8
+
9
+ Factory.find_definitions
10
+
11
+ # Requires supporting ruby files with custom matchers and macros, etc,
12
+ # in spec/support/ and its subdirectories.
13
+ # Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
14
+
15
+ ActionMailer::Base.delivery_method = :test
16
+ ActionMailer::Base.perform_deliveries = true
17
+ ActionMailer::Base.default_url_options[:host] = "test.com"
18
+
19
+ Rails.backtrace_cleaner.remove_silencers!
20
+
21
+ # Configure capybara for integration testing
22
+ require "capybara/rails"
23
+ Capybara.default_driver = :rack_test
24
+ Capybara.default_selector = :css
25
+
26
+ # Run any available migration
27
+ ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
28
+
29
+
30
+
31
+ RSpec.configure do |config|
32
+ # == Mock Framework
33
+ #
34
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
35
+ #
36
+ # config.mock_with :mocha
37
+ # config.mock_with :flexmock
38
+ # config.mock_with :rr
39
+ config.mock_with :rspec
40
+
41
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
42
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
43
+
44
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
45
+ # examples within a transaction, remove the following line or assign false
46
+ # instead of true.
47
+ config.use_transactional_fixtures = true
48
+ end
49
+
50
+
51
+ module AwesomeCo
52
+ def load_awesome_co
53
+ @simple_page_type = Factory(:page_type,
54
+ :name => "Simple Page"
55
+ )
56
+ Factory(:content_descriptor, :page_type => @simple_page_type,
57
+ :title => "Bitch'n Content", :position => 0)
58
+
59
+ @two_column_page = Factory(:page_type,
60
+ :name => "Two Column Page",
61
+ :number_of_content_areas => 2)
62
+ Factory(:content_descriptor, :page_type => @two_column_page, :position => 0)
63
+ Factory(:content_descriptor, :page_type => @two_column_page, :position => 1)
64
+
65
+ @three_column_page = Factory(:page_type,
66
+ :name => "Three Column Page",
67
+ :number_of_content_areas => 3)
68
+ Factory(:content_descriptor, :page_type => @three_column_page, :position => 0)
69
+ Factory(:content_descriptor, :page_type => @three_column_page, :position => 1)
70
+ Factory(:content_descriptor, :page_type => @three_column_page, :position => 2)
71
+
72
+ @blog_page_type = Factory(:page_type,
73
+ :name => "Awesome Blog",
74
+ :function_as => "blog_page",
75
+ :number_of_content_areas => 1)
76
+ Factory(:content_descriptor, :page_type => @blog_page_type, :position => 0)
77
+
78
+ @story_page_type = Factory(:page_type,
79
+ :name => "Great Story",
80
+ :function_as => "blog_story",
81
+ :number_of_content_areas => 2)
82
+ Factory(:content_descriptor, :page_type => @story_page_type, :position => 0)
83
+ Factory(:content_descriptor, :page_type => @story_page_type, :position => 1)
84
+
85
+
86
+
87
+ @root_page = Factory(:root_page)
88
+
89
+ @homepage = Factory(:page,
90
+ :page_type => @three_column_page,
91
+ :parent_id => @root_page.id,
92
+ :site_id=>1,
93
+ :position=>10,
94
+ :menu_title=>"Home",
95
+ :browser_title=>"Awesome Co.",
96
+ :page_title=>"Awesome Co. Making the World More Awesome!",
97
+ :file_name=>"home",
98
+ :is_published=> true,
99
+ :is_shown_in_main_navigation=>false,
100
+ :is_included_in_sitemap=>true,
101
+ :is_shown_in_secondary_navigation=>false,
102
+ :footer_position=> 10 )
103
+ Factory(:content, :html => "<p>Awesome Co. takes being awesome seriously! It what we are and who we are.</p>",
104
+ :position => 0,
105
+ :page => @homepage)
106
+ Factory(:content, :html => "<p>Its a lot of work being this awesome</p>",
107
+ :position => 1,
108
+ :page => @homepage)
109
+ Factory(:content, :html => "<p>We only work with Awesome clients. How do you ensure you awesome enough for us, get out your checkbook.</p>",
110
+ :position => 2,
111
+ :page => @homepage)
112
+
113
+ @about_us = Factory(:page,
114
+ :page_type => @two_column_page,
115
+ :site_id=>1,
116
+ :parent_id => @root_page.id,
117
+ :position=>20,
118
+ :menu_title=>"About Us",
119
+ :browser_title=>"About Us.",
120
+ :page_title=>"We're Awesome",
121
+ :file_name=>"about_us",
122
+ :is_published=> true,
123
+ :is_shown_in_main_navigation=>true,
124
+ :is_included_in_sitemap=>true,
125
+ :is_shown_in_secondary_navigation=>true,
126
+ :footer_position=> 60 )
127
+ Factory(:content, :html => "<p>Awesome is as awesome does.</p>",
128
+ :position => 0,
129
+ :page => @about_us)
130
+ Factory(:content, :html => "<p>We is awesome.</p>",
131
+ :position => 1,
132
+ :page => @about_us)
133
+
134
+ @who_we_are = Factory(:page,
135
+ :page_type => @simple_page_type,
136
+ :site_id=>1,
137
+ :parent_id => @about_us.id,
138
+ :position=>10,
139
+ :menu_title=>"Who We Are",
140
+ :browser_title=>"Awesome People that we are",
141
+ :page_title=>"Awesome People that work here",
142
+ :file_name=>"who_we_are",
143
+ :is_published=> true,
144
+ :is_included_in_sitemap=>true,
145
+ :is_shown_in_main_navigation=>true,
146
+ :is_shown_in_secondary_navigation=>true,
147
+ :footer_position=> 0 )
148
+ Factory(:content, :position => 0)
149
+
150
+ @what_we_do = Factory(:page,
151
+ :page_type => @simple_page_type,
152
+ :site_id=>1,
153
+ :parent_id => @root_page.id,
154
+ :position=>30,
155
+ :menu_title=>"What we do",
156
+ :browser_title=>"Awesome Stuff we Do",
157
+ :page_title=>"We've done lots of Awesome stuff! We about to do more.",
158
+ :file_name=>"what_we_do",
159
+ :is_published=> true,
160
+ :is_shown_in_main_navigation=>true,
161
+ :is_included_in_sitemap=>true,
162
+ :is_shown_in_secondary_navigation=>true,
163
+ :footer_position=> 30 )
164
+ Factory(:content, :position => 0)
165
+
166
+
167
+ end
168
+
169
+
170
+ def unload_awesome_co
171
+ DeluxePublisher::PageType.delete_all
172
+ DeluxePublisher::Page.delete_all
173
+ end
174
+
175
+ def reload_awesome_co
176
+ unload_awesome_co
177
+ load_awesome_co
178
+ end
179
+
180
+ class ValidRecord
181
+
182
+ def initialize
183
+
184
+ end
185
+
186
+ def matches?(target)
187
+ @target = target
188
+ return target.valid?
189
+ end
190
+
191
+ def failure_message
192
+ "expected target to be valid but was not. errors = #{@target.errors}"
193
+ end
194
+
195
+ def negative_failure_message
196
+ "expected target to not be valid but it was. errors = #{@target.errors}"
197
+ end
198
+
199
+ end
200
+
201
+ def be_a_valid_record
202
+ ValidRecord.new
203
+ end
204
+ end
205
+
206
+
207
+
208
+
209
+ #ActionMailer::Base.delivery_method = :test
210
+ #ActionMailer::Base.perform_deliveries = true
211
+ #ActionMailer::Base.default_url_options[:host] = "test.com"
212
+ #
213
+ #Rails.backtrace_cleaner.remove_silencers!
214
+ #
215
+ ## Configure capybara for integration testing
216
+ #require "capybara/rails"
217
+ #Capybara.default_driver = :rack_test
218
+ #Capybara.default_selector = :css
219
+ #
220
+ ## Run any available migration
221
+ #ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
222
+ #
223
+ ## Load support files
224
+ #Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
225
+ #
226
+ #RSpec.configure do |config|
227
+ # # Remove this line if you don't want RSpec's should and should_not
228
+ # # methods or matchers
229
+ # require 'rspec/expectations'
230
+ # config.include RSpec::Matchers
231
+ #
232
+ # # == Mock Framework
233
+ # config.mock_with :rspec
234
+ #end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher_comments/edit.html.erb" do
4
+ before(:each) do
5
+ @comment = assign(:comment, stub_model(DeluxePublisher::Comment,
6
+ :page_id => 1,
7
+ :author => "MyString",
8
+ :body => "MyString",
9
+ :status => "MyString"
10
+ ))
11
+ end
12
+
13
+ # it "renders the edit comment form" do
14
+ # render
15
+ #
16
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
17
+ # assert_select "form", :action => deluxe_publisher_comments_path(@comment), :method => "post" do
18
+ # assert_select "input#comment_page_id", :name => "comment[page_id]"
19
+ # assert_select "input#comment_author", :name => "comment[author]"
20
+ # assert_select "input#comment_body", :name => "comment[body]"
21
+ # assert_select "input#comment_status", :name => "comment[status]"
22
+ # end
23
+ # end
24
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher_comments/index.html.erb" do
4
+ before(:each) do
5
+ assign(:deluxe_publisher_comments, [
6
+ stub_model(DeluxePublisher::Comment,
7
+ :page_id => 1,
8
+ :author => "Author",
9
+ :body => "Body",
10
+ :status => "Status"
11
+ ),
12
+ stub_model(DeluxePublisher::Comment,
13
+ :page_id => 1,
14
+ :author => "Author",
15
+ :body => "Body",
16
+ :status => "Status"
17
+ )
18
+ ])
19
+ end
20
+
21
+ # it "renders a list of deluxe_publisher_comments" do
22
+ # render
23
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
24
+ # assert_select "tr>td", :text => 1.to_s, :count => 2
25
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
26
+ # assert_select "tr>td", :text => "Author".to_s, :count => 2
27
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
28
+ # assert_select "tr>td", :text => "Body".to_s, :count => 2
29
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
30
+ # assert_select "tr>td", :text => "Status".to_s, :count => 2
31
+ # end
32
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher/comments/new.html.erb" do
4
+ before(:each) do
5
+ assign(:comment, stub_model(DeluxePublisher::Comment,
6
+ :page_id => 1,
7
+ :author => "MyString",
8
+ :body => "MyString",
9
+ :status => "MyString"
10
+ ).as_new_record)
11
+ end
12
+
13
+ # it "renders new comment form" do
14
+ # render
15
+ #
16
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
17
+ # assert_select "form", :action => deluxe_publisher_comments_path, :method => "post" do
18
+ # assert_select "input#comment_page_id", :name => "comment[page_id]"
19
+ # assert_select "input#comment_author", :name => "comment[author]"
20
+ # assert_select "input#comment_body", :name => "comment[body]"
21
+ # assert_select "input#comment_status", :name => "comment[status]"
22
+ # end
23
+ # end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher_comments/show.html.erb" do
4
+ before(:each) do
5
+ @comment = assign(:comment, stub_model(DeluxePublisher::Comment,
6
+ :page_id => 1,
7
+ :author => "Author",
8
+ :body => "Body",
9
+ :status => "Status"
10
+ ))
11
+ end
12
+
13
+ # it "renders attributes in <p>" do
14
+ # render
15
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
16
+ # rendered.should match(/1/)
17
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
18
+ # rendered.should match(/Author/)
19
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
20
+ # rendered.should match(/Body/)
21
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
22
+ # rendered.should match(/Status/)
23
+ # end
24
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher_page_types/edit.html.erb" do
4
+ before(:each) do
5
+ @page_type = assign(:page_type, stub_model(DeluxePublisher::PageType,
6
+ :name => "MyString",
7
+ :description => "MyText",
8
+ :is_published => false,
9
+ :position => 1,
10
+ :function_as => "MyString",
11
+ :number_of_content_areas => 1,
12
+ :template => "MyString",
13
+ :layout => "MyString"
14
+ ))
15
+ end
16
+
17
+ # it "renders the edit page_type form" do
18
+ # render
19
+ #
20
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
21
+ # assert_select "form", :action => deluxe_publisher_page_types_path(@page_type), :method => "post" do
22
+ # assert_select "input#page_type_name", :name => "page_type[name]"
23
+ # assert_select "textarea#page_type_description", :name => "page_type[description]"
24
+ # assert_select "input#page_type_is_published", :name => "page_type[is_published]"
25
+ # assert_select "input#page_type_position", :name => "page_type[position]"
26
+ # assert_select "input#page_type_function_as", :name => "page_type[function_as]"
27
+ # assert_select "input#page_type_number_of_content_areas", :name => "page_type[number_of_content_areas]"
28
+ # assert_select "input#page_type_template", :name => "page_type[template]"
29
+ # assert_select "input#page_type_layout", :name => "page_type[layout]"
30
+ # end
31
+ # end
32
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher_page_types/index.html.erb" do
4
+ before(:each) do
5
+ assign(:deluxe_publisher_page_types, [
6
+ stub_model(DeluxePublisher::PageType,
7
+ :name => "Name",
8
+ :description => "MyText",
9
+ :is_published => false,
10
+ :position => 1,
11
+ :function_as => "Function As",
12
+ :number_of_content_areas => 1,
13
+ :template => "Template",
14
+ :layout => "Layout"
15
+ ),
16
+ stub_model(DeluxePublisher::PageType,
17
+ :name => "Name",
18
+ :description => "MyText",
19
+ :is_published => false,
20
+ :position => 1,
21
+ :function_as => "Function As",
22
+ :number_of_content_areas => 1,
23
+ :template => "Template",
24
+ :layout => "Layout"
25
+ )
26
+ ])
27
+ end
28
+
29
+ # it "renders a list of deluxe_publisher_page_types" do
30
+ # render
31
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
32
+ # assert_select "tr>td", :text => "Name".to_s, :count => 2
33
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
34
+ # assert_select "tr>td", :text => "MyText".to_s, :count => 2
35
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
36
+ # assert_select "tr>td", :text => false.to_s, :count => 2
37
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
38
+ # assert_select "tr>td", :text => 1.to_s, :count => 2
39
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
40
+ # assert_select "tr>td", :text => "Function As".to_s, :count => 2
41
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
42
+ # assert_select "tr>td", :text => 1.to_s, :count => 2
43
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
44
+ # assert_select "tr>td", :text => "Template".to_s, :count => 2
45
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
46
+ # assert_select "tr>td", :text => "Layout".to_s, :count => 2
47
+ # end
48
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher_page_types/new.html.erb" do
4
+ before(:each) do
5
+ assign(:page_type, stub_model(DeluxePublisher::PageType,
6
+ :name => "MyString",
7
+ :description => "MyText",
8
+ :is_published => false,
9
+ :position => 1,
10
+ :function_as => "MyString",
11
+ :number_of_content_areas => 1,
12
+ :template => "MyString",
13
+ :layout => "MyString"
14
+ ).as_new_record)
15
+ end
16
+
17
+ # it "renders new page_type form" do
18
+ # render
19
+ #
20
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
21
+ # assert_select "form", :action => deluxe_publisher_page_types_path, :method => "post" do
22
+ # assert_select "input#page_type_name", :name => "page_type[name]"
23
+ # assert_select "textarea#page_type_description", :name => "page_type[description]"
24
+ # assert_select "input#page_type_is_published", :name => "page_type[is_published]"
25
+ # assert_select "input#page_type_position", :name => "page_type[position]"
26
+ # assert_select "input#page_type_function_as", :name => "page_type[function_as]"
27
+ # assert_select "input#page_type_number_of_content_areas", :name => "page_type[number_of_content_areas]"
28
+ # assert_select "input#page_type_template", :name => "page_type[template]"
29
+ # assert_select "input#page_type_layout", :name => "page_type[layout]"
30
+ # end
31
+ # end
32
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher_page_types/show.html.erb" do
4
+ before(:each) do
5
+ @page_type = assign(:page_type, stub_model(DeluxePublisher::PageType,
6
+ :name => "Name",
7
+ :description => "MyText",
8
+ :is_published => false,
9
+ :position => 1,
10
+ :function_as => "Function As",
11
+ :number_of_content_areas => 1,
12
+ :template => "Template",
13
+ :layout => "Layout"
14
+ ))
15
+ end
16
+
17
+ # it "renders attributes in <p>" do
18
+ # render
19
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
20
+ # rendered.should match(/Name/)
21
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
22
+ # rendered.should match(/MyText/)
23
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
24
+ # rendered.should match(/false/)
25
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
26
+ # rendered.should match(/1/)
27
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
28
+ # rendered.should match(/Function As/)
29
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
30
+ # rendered.should match(/1/)
31
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
32
+ # rendered.should match(/Template/)
33
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
34
+ # rendered.should match(/Layout/)
35
+ # end
36
+ end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ describe "deluxe_publisher/pages/edit.html.erb" do
4
+ before(:each) do
5
+ @page = assign(:page, stub_model(DeluxePublisher::Page,
6
+ :merchant_id => 1,
7
+ :parent_id => 1,
8
+ :alias_page_id => 1,
9
+ :page_type_id => 1,
10
+ :position => 1,
11
+ :footer_position => 1,
12
+ :browser_title => "MyString",
13
+ :page_title => "MyString",
14
+ :menu_title => "MyString",
15
+ :file_name => "MyString",
16
+ :path => "MyString",
17
+ :is_shown_in_main_navigation => false,
18
+ :is_shown_in_secondary_navigation => false,
19
+ :is_published => false,
20
+ :is_navigation_locked => false,
21
+ :is_content_locked => false,
22
+ :meta_keywords => "MyText",
23
+ :meta_description => "MyText",
24
+ :is_included_in_sitemap => false,
25
+ :sitemap_priority => 1.5,
26
+ :sitemap_change_freq => "MyString"
27
+ ))
28
+ end
29
+
30
+ # it "renders the edit page form" do
31
+ # render
32
+ #
33
+ # # Run the generator again with the --webrat flag if you want to use webrat matchers
34
+ # assert_select "form", :action => pages_path(@page), :method => "post" do
35
+ # assert_select "input#page_merchant_id", :name => "page[merchant_id]"
36
+ # assert_select "input#page_parent_id", :name => "page[parent_id]"
37
+ # assert_select "input#page_alias_page_id", :name => "page[alias_page_id]"
38
+ # assert_select "input#page_page_type_id", :name => "page[page_type_id]"
39
+ # assert_select "input#page_position", :name => "page[position]"
40
+ # assert_select "input#page_footer_position", :name => "page[footer_position]"
41
+ # assert_select "input#page_browser_title", :name => "page[browser_title]"
42
+ # assert_select "input#page_page_title", :name => "page[page_title]"
43
+ # assert_select "input#page_menu_title", :name => "page[menu_title]"
44
+ # assert_select "input#page_file_name", :name => "page[file_name]"
45
+ # assert_select "input#page_path", :name => "page[path]"
46
+ # assert_select "input#page_is_shown_in_main_navigation", :name => "page[is_shown_in_main_navigation]"
47
+ # assert_select "input#page_is_shown_in_secondary_navigation", :name => "page[is_shown_in_secondary_navigation]"
48
+ # assert_select "input#page_is_published", :name => "page[is_published]"
49
+ # assert_select "input#page_is_navigation_locked", :name => "page[is_navigation_locked]"
50
+ # assert_select "input#page_is_content_locked", :name => "page[is_content_locked]"
51
+ # assert_select "textarea#page_meta_keywords", :name => "page[meta_keywords]"
52
+ # assert_select "textarea#page_meta_description", :name => "page[meta_description]"
53
+ # assert_select "input#page_is_included_in_sitemap", :name => "page[is_included_in_sitemap]"
54
+ # assert_select "input#page_sitemap_priority", :name => "page[sitemap_priority]"
55
+ # assert_select "input#page_sitemap_change_freq", :name => "page[sitemap_change_freq]"
56
+ # end
57
+ # end
58
+ end