kuztuscms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. data/.gitignore +9 -0
  2. data/.rvmrc +55 -0
  3. data/Gemfile +18 -0
  4. data/Gemfile.lock +156 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.rdoc +12 -0
  7. data/Rakefile +29 -0
  8. data/app/assets/images/kuztuscms/.gitkeep +0 -0
  9. data/app/assets/images/kuztuscms/glyphicons-halflings-white.png +0 -0
  10. data/app/assets/images/kuztuscms/glyphicons-halflings.png +0 -0
  11. data/app/assets/javascripts/kuztuscms/.DS_Store +0 -0
  12. data/app/assets/javascripts/kuztuscms/application.js +15 -0
  13. data/app/assets/javascripts/kuztuscms/bootstrap.js +1720 -0
  14. data/app/assets/javascripts/kuztuscms/codemirror-compressed.js +1 -0
  15. data/app/assets/stylesheets/kuztuscms/.DS_Store +0 -0
  16. data/app/assets/stylesheets/kuztuscms/application.css.scss +16 -0
  17. data/app/assets/stylesheets/kuztuscms/bootstrap-responsive.css +581 -0
  18. data/app/assets/stylesheets/kuztuscms/bootstrap.css +3496 -0
  19. data/app/assets/stylesheets/kuztuscms/codemirror.css +115 -0
  20. data/app/controllers/kuztuscms/articles_controller.rb +53 -0
  21. data/app/controllers/kuztuscms/home_controller.rb +6 -0
  22. data/app/controllers/kuztuscms/layouts_controller.rb +75 -0
  23. data/app/controllers/kuztuscms/pages_controller.rb +73 -0
  24. data/app/controllers/kuztuscms/settings_controller.rb +48 -0
  25. data/app/controllers/kuztuscms/templates_controller.rb +72 -0
  26. data/app/controllers/kuztuscms/users_controller.rb +74 -0
  27. data/app/controllers/kuztuscms_controller.rb +23 -0
  28. data/app/helpers/kuztuscms/application_helper.rb +4 -0
  29. data/app/models/kuztuscms/article.rb +4 -0
  30. data/app/models/kuztuscms/layout.rb +14 -0
  31. data/app/models/kuztuscms/page.rb +8 -0
  32. data/app/models/kuztuscms/setting.rb +11 -0
  33. data/app/models/kuztuscms/template.rb +14 -0
  34. data/app/models/kuztuscms/user.rb +20 -0
  35. data/app/views/devise/_links.erb +27 -0
  36. data/app/views/devise/confirmations/new.html.erb +12 -0
  37. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  38. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  39. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  40. data/app/views/devise/passwords/edit.html.erb +16 -0
  41. data/app/views/devise/passwords/new.html.erb +18 -0
  42. data/app/views/devise/registrations/edit.html.erb +25 -0
  43. data/app/views/devise/registrations/new.html.erb +21 -0
  44. data/app/views/devise/sessions/new.html.erb +31 -0
  45. data/app/views/devise/unlocks/new.html.erb +19 -0
  46. data/app/views/kuztuscms/articles/_form.html.erb +35 -0
  47. data/app/views/kuztuscms/articles/edit.html.erb +1 -0
  48. data/app/views/kuztuscms/articles/index.html.erb +22 -0
  49. data/app/views/kuztuscms/articles/new.html.erb +1 -0
  50. data/app/views/kuztuscms/articles/show.html.erb +4 -0
  51. data/app/views/kuztuscms/home/index.html.erb +1 -0
  52. data/app/views/kuztuscms/layouts/_form.html.erb +58 -0
  53. data/app/views/kuztuscms/layouts/edit.html.erb +2 -0
  54. data/app/views/kuztuscms/layouts/index.html.erb +32 -0
  55. data/app/views/kuztuscms/layouts/new.html.erb +2 -0
  56. data/app/views/kuztuscms/pages/_form.html.erb +72 -0
  57. data/app/views/kuztuscms/pages/edit.html.erb +1 -0
  58. data/app/views/kuztuscms/pages/index.html.erb +28 -0
  59. data/app/views/kuztuscms/pages/new.html.erb +1 -0
  60. data/app/views/kuztuscms/pages/show.html.erb +1 -0
  61. data/app/views/kuztuscms/settings/_form.html.erb +35 -0
  62. data/app/views/kuztuscms/settings/edit.html.erb +1 -0
  63. data/app/views/kuztuscms/settings/index.html.erb +24 -0
  64. data/app/views/kuztuscms/settings/new.html.erb +1 -0
  65. data/app/views/kuztuscms/shared/_codemirror.html.erb +20 -0
  66. data/app/views/kuztuscms/templates/_form.html.erb +58 -0
  67. data/app/views/kuztuscms/templates/edit.html.erb +3 -0
  68. data/app/views/kuztuscms/templates/index.html.erb +28 -0
  69. data/app/views/kuztuscms/templates/new.html.erb +2 -0
  70. data/app/views/kuztuscms/users/_form.html.erb +56 -0
  71. data/app/views/kuztuscms/users/edit.html.erb +1 -0
  72. data/app/views/kuztuscms/users/index.html.erb +28 -0
  73. data/app/views/kuztuscms/users/new.html.erb +1 -0
  74. data/app/views/kuztuscms/users/show.html.erb +15 -0
  75. data/app/views/layouts/kuztuscms/application.html.erb +57 -0
  76. data/config/initializers/devise.rb +225 -0
  77. data/config/initializers/resolver.rb +65 -0
  78. data/config/locales/devise.en.yml +57 -0
  79. data/config/locales/en.yml +5 -0
  80. data/config/routes.rb +18 -0
  81. data/db/migrate/20120218074040_devise_create_kuztuscms_users.rb +52 -0
  82. data/db/migrate/20120218075211_create_kuztuscms_pages.rb +15 -0
  83. data/db/migrate/20120311080242_create_kuztuscms_templates.rb +38 -0
  84. data/db/migrate/20120311141419_create_kuztuscms_articles.rb +10 -0
  85. data/db/migrate/20120311173954_create_kuztuscms_layouts.rb +43 -0
  86. data/db/migrate/20120316081613_create_kuztuscms_settings.rb +10 -0
  87. data/kuztuscms.gemspec +33 -0
  88. data/lib/kuztuscms/engine.rb +13 -0
  89. data/lib/kuztuscms/settings.rb +26 -0
  90. data/lib/kuztuscms/version.rb +3 -0
  91. data/lib/kuztuscms.rb +7 -0
  92. data/lib/tasks/kuztuscms_tasks.rake +4 -0
  93. data/script/rails +8 -0
  94. data/spec/controllers/kuztuscms/articles_controller_spec.rb +164 -0
  95. data/spec/controllers/kuztuscms/languages_controller_spec.rb +164 -0
  96. data/spec/controllers/kuztuscms/layouts_controller_spec.rb +164 -0
  97. data/spec/controllers/kuztuscms/pages_controller_spec.rb +164 -0
  98. data/spec/controllers/kuztuscms/settings_controller_spec.rb +164 -0
  99. data/spec/controllers/kuztuscms/templates_controller_spec.rb +164 -0
  100. data/spec/controllers/kuztuscms/translations_controller_spec.rb +164 -0
  101. data/spec/dummy/README.rdoc +261 -0
  102. data/spec/dummy/Rakefile +7 -0
  103. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  104. data/spec/dummy/app/assets/javascripts/home.js +2 -0
  105. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  106. data/spec/dummy/app/assets/stylesheets/home.css +4 -0
  107. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  108. data/spec/dummy/app/controllers/home_controller.rb +4 -0
  109. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  110. data/spec/dummy/app/helpers/home_helper.rb +2 -0
  111. data/spec/dummy/app/mailers/.gitkeep +0 -0
  112. data/spec/dummy/app/models/.gitkeep +0 -0
  113. data/spec/dummy/app/views/home/index.html.erb +3 -0
  114. data/spec/dummy/app/views/layouts/application.html.erb +16 -0
  115. data/spec/dummy/config/application.rb +62 -0
  116. data/spec/dummy/config/boot.rb +10 -0
  117. data/spec/dummy/config/database.yml +25 -0
  118. data/spec/dummy/config/environment.rb +5 -0
  119. data/spec/dummy/config/environments/development.rb +38 -0
  120. data/spec/dummy/config/environments/production.rb +67 -0
  121. data/spec/dummy/config/environments/test.rb +37 -0
  122. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  123. data/spec/dummy/config/initializers/inflections.rb +15 -0
  124. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  125. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  126. data/spec/dummy/config/initializers/session_store.rb +8 -0
  127. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  128. data/spec/dummy/config/locales/en.yml +9 -0
  129. data/spec/dummy/config/locales/ru.yml +5 -0
  130. data/spec/dummy/config/routes.rb +8 -0
  131. data/spec/dummy/config.ru +4 -0
  132. data/spec/dummy/db/migrate/20120313083011_devise_create_kuztuscms_users.kuztuscms.rb +59 -0
  133. data/spec/dummy/db/migrate/20120313083012_create_kuztuscms_pages.kuztuscms.rb +16 -0
  134. data/spec/dummy/db/migrate/20120313083013_create_kuztuscms_templates.kuztuscms.rb +15 -0
  135. data/spec/dummy/db/migrate/20120313083014_create_kuztuscms_articles.kuztuscms.rb +11 -0
  136. data/spec/dummy/db/migrate/20120313083015_create_kuztuscms_layouts.kuztuscms.rb +41 -0
  137. data/spec/dummy/db/migrate/20120316084434_create_kuztuscms_settings.kuztuscms.rb +11 -0
  138. data/spec/dummy/db/schema.rb +90 -0
  139. data/spec/dummy/lib/assets/.gitkeep +0 -0
  140. data/spec/dummy/log/.gitkeep +0 -0
  141. data/spec/dummy/public/404.html +26 -0
  142. data/spec/dummy/public/422.html +26 -0
  143. data/spec/dummy/public/500.html +25 -0
  144. data/spec/dummy/public/favicon.ico +0 -0
  145. data/spec/dummy/script/rails +6 -0
  146. data/spec/helpers/kuztuscms/articles_helper_spec.rb +15 -0
  147. data/spec/helpers/kuztuscms/languages_helper_spec.rb +15 -0
  148. data/spec/helpers/kuztuscms/layouts_helper_spec.rb +15 -0
  149. data/spec/helpers/kuztuscms/pages_helper_spec.rb +15 -0
  150. data/spec/helpers/kuztuscms/settings_helper_spec.rb +15 -0
  151. data/spec/helpers/kuztuscms/templates_helper_spec.rb +15 -0
  152. data/spec/helpers/kuztuscms/translations_helper_spec.rb +15 -0
  153. data/spec/models/kuztuscms/article_spec.rb +5 -0
  154. data/spec/models/kuztuscms/language_spec.rb +5 -0
  155. data/spec/models/kuztuscms/layout_spec.rb +5 -0
  156. data/spec/models/kuztuscms/page_spec.rb +5 -0
  157. data/spec/models/kuztuscms/setting_spec.rb +5 -0
  158. data/spec/models/kuztuscms/template_spec.rb +5 -0
  159. data/spec/models/kuztuscms/translation_spec.rb +5 -0
  160. data/spec/models/kuztuscms/user_spec.rb +5 -0
  161. data/spec/routing/kuztuscms/articles_routing_spec.rb +35 -0
  162. data/spec/routing/kuztuscms/languages_routing_spec.rb +35 -0
  163. data/spec/routing/kuztuscms/layouts_routing_spec.rb +35 -0
  164. data/spec/routing/kuztuscms/pages_routing_spec.rb +35 -0
  165. data/spec/routing/kuztuscms/settings_routing_spec.rb +35 -0
  166. data/spec/routing/kuztuscms/templates_routing_spec.rb +35 -0
  167. data/spec/routing/kuztuscms/translations_routing_spec.rb +35 -0
  168. data/spec/views/kuztuscms/articles/edit.html.erb_spec.rb +20 -0
  169. data/spec/views/kuztuscms/articles/index.html.erb_spec.rb +24 -0
  170. data/spec/views/kuztuscms/articles/new.html.erb_spec.rb +20 -0
  171. data/spec/views/kuztuscms/articles/show.html.erb_spec.rb +18 -0
  172. data/spec/views/kuztuscms/languages/edit.html.erb_spec.rb +22 -0
  173. data/spec/views/kuztuscms/languages/index.html.erb_spec.rb +28 -0
  174. data/spec/views/kuztuscms/languages/new.html.erb_spec.rb +22 -0
  175. data/spec/views/kuztuscms/languages/show.html.erb_spec.rb +21 -0
  176. data/spec/views/kuztuscms/layouts/edit.html.erb_spec.rb +20 -0
  177. data/spec/views/kuztuscms/layouts/index.html.erb_spec.rb +24 -0
  178. data/spec/views/kuztuscms/layouts/new.html.erb_spec.rb +20 -0
  179. data/spec/views/kuztuscms/layouts/show.html.erb_spec.rb +18 -0
  180. data/spec/views/kuztuscms/pages/edit.html.erb_spec.rb +15 -0
  181. data/spec/views/kuztuscms/pages/index.html.erb_spec.rb +14 -0
  182. data/spec/views/kuztuscms/pages/new.html.erb_spec.rb +15 -0
  183. data/spec/views/kuztuscms/pages/show.html.erb_spec.rb +11 -0
  184. data/spec/views/kuztuscms/settings/edit.html.erb_spec.rb +20 -0
  185. data/spec/views/kuztuscms/settings/index.html.erb_spec.rb +24 -0
  186. data/spec/views/kuztuscms/settings/new.html.erb_spec.rb +20 -0
  187. data/spec/views/kuztuscms/settings/show.html.erb_spec.rb +18 -0
  188. data/spec/views/kuztuscms/templates/edit.html.erb_spec.rb +28 -0
  189. data/spec/views/kuztuscms/templates/index.html.erb_spec.rb +40 -0
  190. data/spec/views/kuztuscms/templates/new.html.erb_spec.rb +28 -0
  191. data/spec/views/kuztuscms/templates/show.html.erb_spec.rb +30 -0
  192. data/spec/views/kuztuscms/translations/edit.html.erb_spec.rb +28 -0
  193. data/spec/views/kuztuscms/translations/index.html.erb_spec.rb +40 -0
  194. data/spec/views/kuztuscms/translations/new.html.erb_spec.rb +28 -0
  195. data/spec/views/kuztuscms/translations/show.html.erb_spec.rb +30 -0
  196. data/test/integration/kuztuscms/setting_test.rb +7 -0
  197. metadata +351 -0
@@ -0,0 +1,164 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ describe PagesController do
22
+
23
+ # This should return the minimal set of attributes required to create a valid
24
+ # Page. As you add validations to Page, be sure to
25
+ # update the return value of this method accordingly.
26
+ def valid_attributes
27
+ {}
28
+ end
29
+
30
+ # This should return the minimal set of values that should be in the session
31
+ # in order to pass any filters (e.g. authentication) defined in
32
+ # PagesController. Be sure to keep this updated too.
33
+ def valid_session
34
+ {}
35
+ end
36
+
37
+ describe "GET index" do
38
+ it "assigns all pages as @pages" do
39
+ page = Page.create! valid_attributes
40
+ get :index, {}, valid_session
41
+ assigns(:pages).should eq([page])
42
+ end
43
+ end
44
+
45
+ describe "GET show" do
46
+ it "assigns the requested page as @page" do
47
+ page = Page.create! valid_attributes
48
+ get :show, {:id => page.to_param}, valid_session
49
+ assigns(:page).should eq(page)
50
+ end
51
+ end
52
+
53
+ describe "GET new" do
54
+ it "assigns a new page as @page" do
55
+ get :new, {}, valid_session
56
+ assigns(:page).should be_a_new(Page)
57
+ end
58
+ end
59
+
60
+ describe "GET edit" do
61
+ it "assigns the requested page as @page" do
62
+ page = Page.create! valid_attributes
63
+ get :edit, {:id => page.to_param}, valid_session
64
+ assigns(:page).should eq(page)
65
+ end
66
+ end
67
+
68
+ describe "POST create" do
69
+ describe "with valid params" do
70
+ it "creates a new Page" do
71
+ expect {
72
+ post :create, {:page => valid_attributes}, valid_session
73
+ }.to change(Page, :count).by(1)
74
+ end
75
+
76
+ it "assigns a newly created page as @page" do
77
+ post :create, {:page => valid_attributes}, valid_session
78
+ assigns(:page).should be_a(Page)
79
+ assigns(:page).should be_persisted
80
+ end
81
+
82
+ it "redirects to the created page" do
83
+ post :create, {:page => valid_attributes}, valid_session
84
+ response.should redirect_to(Page.last)
85
+ end
86
+ end
87
+
88
+ describe "with invalid params" do
89
+ it "assigns a newly created but unsaved page as @page" do
90
+ # Trigger the behavior that occurs when invalid params are submitted
91
+ Page.any_instance.stub(:save).and_return(false)
92
+ post :create, {:page => {}}, valid_session
93
+ assigns(:page).should be_a_new(Page)
94
+ end
95
+
96
+ it "re-renders the 'new' template" do
97
+ # Trigger the behavior that occurs when invalid params are submitted
98
+ Page.any_instance.stub(:save).and_return(false)
99
+ post :create, {:page => {}}, valid_session
100
+ response.should render_template("new")
101
+ end
102
+ end
103
+ end
104
+
105
+ describe "PUT update" do
106
+ describe "with valid params" do
107
+ it "updates the requested page" do
108
+ page = Page.create! valid_attributes
109
+ # Assuming there are no other pages in the database, this
110
+ # specifies that the Page created on the previous line
111
+ # receives the :update_attributes message with whatever params are
112
+ # submitted in the request.
113
+ Page.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
114
+ put :update, {:id => page.to_param, :page => {'these' => 'params'}}, valid_session
115
+ end
116
+
117
+ it "assigns the requested page as @page" do
118
+ page = Page.create! valid_attributes
119
+ put :update, {:id => page.to_param, :page => valid_attributes}, valid_session
120
+ assigns(:page).should eq(page)
121
+ end
122
+
123
+ it "redirects to the page" do
124
+ page = Page.create! valid_attributes
125
+ put :update, {:id => page.to_param, :page => valid_attributes}, valid_session
126
+ response.should redirect_to(page)
127
+ end
128
+ end
129
+
130
+ describe "with invalid params" do
131
+ it "assigns the page as @page" do
132
+ page = Page.create! valid_attributes
133
+ # Trigger the behavior that occurs when invalid params are submitted
134
+ Page.any_instance.stub(:save).and_return(false)
135
+ put :update, {:id => page.to_param, :page => {}}, valid_session
136
+ assigns(:page).should eq(page)
137
+ end
138
+
139
+ it "re-renders the 'edit' template" do
140
+ page = Page.create! valid_attributes
141
+ # Trigger the behavior that occurs when invalid params are submitted
142
+ Page.any_instance.stub(:save).and_return(false)
143
+ put :update, {:id => page.to_param, :page => {}}, valid_session
144
+ response.should render_template("edit")
145
+ end
146
+ end
147
+ end
148
+
149
+ describe "DELETE destroy" do
150
+ it "destroys the requested page" do
151
+ page = Page.create! valid_attributes
152
+ expect {
153
+ delete :destroy, {:id => page.to_param}, valid_session
154
+ }.to change(Page, :count).by(-1)
155
+ end
156
+
157
+ it "redirects to the pages list" do
158
+ page = Page.create! valid_attributes
159
+ delete :destroy, {:id => page.to_param}, valid_session
160
+ response.should redirect_to(pages_url)
161
+ end
162
+ end
163
+
164
+ end
@@ -0,0 +1,164 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ describe SettingsController do
22
+
23
+ # This should return the minimal set of attributes required to create a valid
24
+ # Setting. As you add validations to Setting, be sure to
25
+ # update the return value of this method accordingly.
26
+ def valid_attributes
27
+ {}
28
+ end
29
+
30
+ # This should return the minimal set of values that should be in the session
31
+ # in order to pass any filters (e.g. authentication) defined in
32
+ # SettingsController. Be sure to keep this updated too.
33
+ def valid_session
34
+ {}
35
+ end
36
+
37
+ describe "GET index" do
38
+ it "assigns all settings as @settings" do
39
+ setting = Setting.create! valid_attributes
40
+ get :index, {}, valid_session
41
+ assigns(:settings).should eq([setting])
42
+ end
43
+ end
44
+
45
+ describe "GET show" do
46
+ it "assigns the requested setting as @setting" do
47
+ setting = Setting.create! valid_attributes
48
+ get :show, {:id => setting.to_param}, valid_session
49
+ assigns(:setting).should eq(setting)
50
+ end
51
+ end
52
+
53
+ describe "GET new" do
54
+ it "assigns a new setting as @setting" do
55
+ get :new, {}, valid_session
56
+ assigns(:setting).should be_a_new(Setting)
57
+ end
58
+ end
59
+
60
+ describe "GET edit" do
61
+ it "assigns the requested setting as @setting" do
62
+ setting = Setting.create! valid_attributes
63
+ get :edit, {:id => setting.to_param}, valid_session
64
+ assigns(:setting).should eq(setting)
65
+ end
66
+ end
67
+
68
+ describe "POST create" do
69
+ describe "with valid params" do
70
+ it "creates a new Setting" do
71
+ expect {
72
+ post :create, {:setting => valid_attributes}, valid_session
73
+ }.to change(Setting, :count).by(1)
74
+ end
75
+
76
+ it "assigns a newly created setting as @setting" do
77
+ post :create, {:setting => valid_attributes}, valid_session
78
+ assigns(:setting).should be_a(Setting)
79
+ assigns(:setting).should be_persisted
80
+ end
81
+
82
+ it "redirects to the created setting" do
83
+ post :create, {:setting => valid_attributes}, valid_session
84
+ response.should redirect_to(Setting.last)
85
+ end
86
+ end
87
+
88
+ describe "with invalid params" do
89
+ it "assigns a newly created but unsaved setting as @setting" do
90
+ # Trigger the behavior that occurs when invalid params are submitted
91
+ Setting.any_instance.stub(:save).and_return(false)
92
+ post :create, {:setting => {}}, valid_session
93
+ assigns(:setting).should be_a_new(Setting)
94
+ end
95
+
96
+ it "re-renders the 'new' template" do
97
+ # Trigger the behavior that occurs when invalid params are submitted
98
+ Setting.any_instance.stub(:save).and_return(false)
99
+ post :create, {:setting => {}}, valid_session
100
+ response.should render_template("new")
101
+ end
102
+ end
103
+ end
104
+
105
+ describe "PUT update" do
106
+ describe "with valid params" do
107
+ it "updates the requested setting" do
108
+ setting = Setting.create! valid_attributes
109
+ # Assuming there are no other settings in the database, this
110
+ # specifies that the Setting created on the previous line
111
+ # receives the :update_attributes message with whatever params are
112
+ # submitted in the request.
113
+ Setting.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
114
+ put :update, {:id => setting.to_param, :setting => {'these' => 'params'}}, valid_session
115
+ end
116
+
117
+ it "assigns the requested setting as @setting" do
118
+ setting = Setting.create! valid_attributes
119
+ put :update, {:id => setting.to_param, :setting => valid_attributes}, valid_session
120
+ assigns(:setting).should eq(setting)
121
+ end
122
+
123
+ it "redirects to the setting" do
124
+ setting = Setting.create! valid_attributes
125
+ put :update, {:id => setting.to_param, :setting => valid_attributes}, valid_session
126
+ response.should redirect_to(setting)
127
+ end
128
+ end
129
+
130
+ describe "with invalid params" do
131
+ it "assigns the setting as @setting" do
132
+ setting = Setting.create! valid_attributes
133
+ # Trigger the behavior that occurs when invalid params are submitted
134
+ Setting.any_instance.stub(:save).and_return(false)
135
+ put :update, {:id => setting.to_param, :setting => {}}, valid_session
136
+ assigns(:setting).should eq(setting)
137
+ end
138
+
139
+ it "re-renders the 'edit' template" do
140
+ setting = Setting.create! valid_attributes
141
+ # Trigger the behavior that occurs when invalid params are submitted
142
+ Setting.any_instance.stub(:save).and_return(false)
143
+ put :update, {:id => setting.to_param, :setting => {}}, valid_session
144
+ response.should render_template("edit")
145
+ end
146
+ end
147
+ end
148
+
149
+ describe "DELETE destroy" do
150
+ it "destroys the requested setting" do
151
+ setting = Setting.create! valid_attributes
152
+ expect {
153
+ delete :destroy, {:id => setting.to_param}, valid_session
154
+ }.to change(Setting, :count).by(-1)
155
+ end
156
+
157
+ it "redirects to the settings list" do
158
+ setting = Setting.create! valid_attributes
159
+ delete :destroy, {:id => setting.to_param}, valid_session
160
+ response.should redirect_to(settings_url)
161
+ end
162
+ end
163
+
164
+ end
@@ -0,0 +1,164 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ describe TemplatesController do
22
+
23
+ # This should return the minimal set of attributes required to create a valid
24
+ # Template. As you add validations to Template, be sure to
25
+ # update the return value of this method accordingly.
26
+ def valid_attributes
27
+ {}
28
+ end
29
+
30
+ # This should return the minimal set of values that should be in the session
31
+ # in order to pass any filters (e.g. authentication) defined in
32
+ # TemplatesController. Be sure to keep this updated too.
33
+ def valid_session
34
+ {}
35
+ end
36
+
37
+ describe "GET index" do
38
+ it "assigns all templates as @templates" do
39
+ template = Template.create! valid_attributes
40
+ get :index, {}, valid_session
41
+ assigns(:templates).should eq([template])
42
+ end
43
+ end
44
+
45
+ describe "GET show" do
46
+ it "assigns the requested template as @template" do
47
+ template = Template.create! valid_attributes
48
+ get :show, {:id => template.to_param}, valid_session
49
+ assigns(:template).should eq(template)
50
+ end
51
+ end
52
+
53
+ describe "GET new" do
54
+ it "assigns a new template as @template" do
55
+ get :new, {}, valid_session
56
+ assigns(:template).should be_a_new(Template)
57
+ end
58
+ end
59
+
60
+ describe "GET edit" do
61
+ it "assigns the requested template as @template" do
62
+ template = Template.create! valid_attributes
63
+ get :edit, {:id => template.to_param}, valid_session
64
+ assigns(:template).should eq(template)
65
+ end
66
+ end
67
+
68
+ describe "POST create" do
69
+ describe "with valid params" do
70
+ it "creates a new Template" do
71
+ expect {
72
+ post :create, {:template => valid_attributes}, valid_session
73
+ }.to change(Template, :count).by(1)
74
+ end
75
+
76
+ it "assigns a newly created template as @template" do
77
+ post :create, {:template => valid_attributes}, valid_session
78
+ assigns(:template).should be_a(Template)
79
+ assigns(:template).should be_persisted
80
+ end
81
+
82
+ it "redirects to the created template" do
83
+ post :create, {:template => valid_attributes}, valid_session
84
+ response.should redirect_to(Template.last)
85
+ end
86
+ end
87
+
88
+ describe "with invalid params" do
89
+ it "assigns a newly created but unsaved template as @template" do
90
+ # Trigger the behavior that occurs when invalid params are submitted
91
+ Template.any_instance.stub(:save).and_return(false)
92
+ post :create, {:template => {}}, valid_session
93
+ assigns(:template).should be_a_new(Template)
94
+ end
95
+
96
+ it "re-renders the 'new' template" do
97
+ # Trigger the behavior that occurs when invalid params are submitted
98
+ Template.any_instance.stub(:save).and_return(false)
99
+ post :create, {:template => {}}, valid_session
100
+ response.should render_template("new")
101
+ end
102
+ end
103
+ end
104
+
105
+ describe "PUT update" do
106
+ describe "with valid params" do
107
+ it "updates the requested template" do
108
+ template = Template.create! valid_attributes
109
+ # Assuming there are no other templates in the database, this
110
+ # specifies that the Template created on the previous line
111
+ # receives the :update_attributes message with whatever params are
112
+ # submitted in the request.
113
+ Template.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
114
+ put :update, {:id => template.to_param, :template => {'these' => 'params'}}, valid_session
115
+ end
116
+
117
+ it "assigns the requested template as @template" do
118
+ template = Template.create! valid_attributes
119
+ put :update, {:id => template.to_param, :template => valid_attributes}, valid_session
120
+ assigns(:template).should eq(template)
121
+ end
122
+
123
+ it "redirects to the template" do
124
+ template = Template.create! valid_attributes
125
+ put :update, {:id => template.to_param, :template => valid_attributes}, valid_session
126
+ response.should redirect_to(template)
127
+ end
128
+ end
129
+
130
+ describe "with invalid params" do
131
+ it "assigns the template as @template" do
132
+ template = Template.create! valid_attributes
133
+ # Trigger the behavior that occurs when invalid params are submitted
134
+ Template.any_instance.stub(:save).and_return(false)
135
+ put :update, {:id => template.to_param, :template => {}}, valid_session
136
+ assigns(:template).should eq(template)
137
+ end
138
+
139
+ it "re-renders the 'edit' template" do
140
+ template = Template.create! valid_attributes
141
+ # Trigger the behavior that occurs when invalid params are submitted
142
+ Template.any_instance.stub(:save).and_return(false)
143
+ put :update, {:id => template.to_param, :template => {}}, valid_session
144
+ response.should render_template("edit")
145
+ end
146
+ end
147
+ end
148
+
149
+ describe "DELETE destroy" do
150
+ it "destroys the requested template" do
151
+ template = Template.create! valid_attributes
152
+ expect {
153
+ delete :destroy, {:id => template.to_param}, valid_session
154
+ }.to change(Template, :count).by(-1)
155
+ end
156
+
157
+ it "redirects to the templates list" do
158
+ template = Template.create! valid_attributes
159
+ delete :destroy, {:id => template.to_param}, valid_session
160
+ response.should redirect_to(templates_url)
161
+ end
162
+ end
163
+
164
+ end
@@ -0,0 +1,164 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ describe TranslationsController do
22
+
23
+ # This should return the minimal set of attributes required to create a valid
24
+ # Translation. As you add validations to Translation, be sure to
25
+ # update the return value of this method accordingly.
26
+ def valid_attributes
27
+ {}
28
+ end
29
+
30
+ # This should return the minimal set of values that should be in the session
31
+ # in order to pass any filters (e.g. authentication) defined in
32
+ # TranslationsController. Be sure to keep this updated too.
33
+ def valid_session
34
+ {}
35
+ end
36
+
37
+ describe "GET index" do
38
+ it "assigns all translations as @translations" do
39
+ translation = Translation.create! valid_attributes
40
+ get :index, {}, valid_session
41
+ assigns(:translations).should eq([translation])
42
+ end
43
+ end
44
+
45
+ describe "GET show" do
46
+ it "assigns the requested translation as @translation" do
47
+ translation = Translation.create! valid_attributes
48
+ get :show, {:id => translation.to_param}, valid_session
49
+ assigns(:translation).should eq(translation)
50
+ end
51
+ end
52
+
53
+ describe "GET new" do
54
+ it "assigns a new translation as @translation" do
55
+ get :new, {}, valid_session
56
+ assigns(:translation).should be_a_new(Translation)
57
+ end
58
+ end
59
+
60
+ describe "GET edit" do
61
+ it "assigns the requested translation as @translation" do
62
+ translation = Translation.create! valid_attributes
63
+ get :edit, {:id => translation.to_param}, valid_session
64
+ assigns(:translation).should eq(translation)
65
+ end
66
+ end
67
+
68
+ describe "POST create" do
69
+ describe "with valid params" do
70
+ it "creates a new Translation" do
71
+ expect {
72
+ post :create, {:translation => valid_attributes}, valid_session
73
+ }.to change(Translation, :count).by(1)
74
+ end
75
+
76
+ it "assigns a newly created translation as @translation" do
77
+ post :create, {:translation => valid_attributes}, valid_session
78
+ assigns(:translation).should be_a(Translation)
79
+ assigns(:translation).should be_persisted
80
+ end
81
+
82
+ it "redirects to the created translation" do
83
+ post :create, {:translation => valid_attributes}, valid_session
84
+ response.should redirect_to(Translation.last)
85
+ end
86
+ end
87
+
88
+ describe "with invalid params" do
89
+ it "assigns a newly created but unsaved translation as @translation" do
90
+ # Trigger the behavior that occurs when invalid params are submitted
91
+ Translation.any_instance.stub(:save).and_return(false)
92
+ post :create, {:translation => {}}, valid_session
93
+ assigns(:translation).should be_a_new(Translation)
94
+ end
95
+
96
+ it "re-renders the 'new' template" do
97
+ # Trigger the behavior that occurs when invalid params are submitted
98
+ Translation.any_instance.stub(:save).and_return(false)
99
+ post :create, {:translation => {}}, valid_session
100
+ response.should render_template("new")
101
+ end
102
+ end
103
+ end
104
+
105
+ describe "PUT update" do
106
+ describe "with valid params" do
107
+ it "updates the requested translation" do
108
+ translation = Translation.create! valid_attributes
109
+ # Assuming there are no other translations in the database, this
110
+ # specifies that the Translation created on the previous line
111
+ # receives the :update_attributes message with whatever params are
112
+ # submitted in the request.
113
+ Translation.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
114
+ put :update, {:id => translation.to_param, :translation => {'these' => 'params'}}, valid_session
115
+ end
116
+
117
+ it "assigns the requested translation as @translation" do
118
+ translation = Translation.create! valid_attributes
119
+ put :update, {:id => translation.to_param, :translation => valid_attributes}, valid_session
120
+ assigns(:translation).should eq(translation)
121
+ end
122
+
123
+ it "redirects to the translation" do
124
+ translation = Translation.create! valid_attributes
125
+ put :update, {:id => translation.to_param, :translation => valid_attributes}, valid_session
126
+ response.should redirect_to(translation)
127
+ end
128
+ end
129
+
130
+ describe "with invalid params" do
131
+ it "assigns the translation as @translation" do
132
+ translation = Translation.create! valid_attributes
133
+ # Trigger the behavior that occurs when invalid params are submitted
134
+ Translation.any_instance.stub(:save).and_return(false)
135
+ put :update, {:id => translation.to_param, :translation => {}}, valid_session
136
+ assigns(:translation).should eq(translation)
137
+ end
138
+
139
+ it "re-renders the 'edit' template" do
140
+ translation = Translation.create! valid_attributes
141
+ # Trigger the behavior that occurs when invalid params are submitted
142
+ Translation.any_instance.stub(:save).and_return(false)
143
+ put :update, {:id => translation.to_param, :translation => {}}, valid_session
144
+ response.should render_template("edit")
145
+ end
146
+ end
147
+ end
148
+
149
+ describe "DELETE destroy" do
150
+ it "destroys the requested translation" do
151
+ translation = Translation.create! valid_attributes
152
+ expect {
153
+ delete :destroy, {:id => translation.to_param}, valid_session
154
+ }.to change(Translation, :count).by(-1)
155
+ end
156
+
157
+ it "redirects to the translations list" do
158
+ translation = Translation.create! valid_attributes
159
+ delete :destroy, {:id => translation.to_param}, valid_session
160
+ response.should redirect_to(translations_url)
161
+ end
162
+ end
163
+
164
+ end