restspec 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +21 -0
  3. data/.gitignore +23 -0
  4. data/.rspec +4 -0
  5. data/Gemfile +4 -0
  6. data/Guardfile +6 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +188 -0
  9. data/ROADMAP.md +11 -0
  10. data/Rakefile +20 -0
  11. data/bin/restspec +54 -0
  12. data/bin/templates/Gemfile +3 -0
  13. data/bin/templates/custom_macros.rb +3 -0
  14. data/bin/templates/restspec_config.rb +10 -0
  15. data/bin/templates/spec_helper.rb +19 -0
  16. data/docs/endpoints.md +200 -0
  17. data/docs/helpers.md +40 -0
  18. data/docs/macros.md +140 -0
  19. data/docs/matchers.md +38 -0
  20. data/docs/schemas.md +28 -0
  21. data/docs/tutorial.md +477 -0
  22. data/docs/types.md +134 -0
  23. data/examples/store-api-tests/.rspec +3 -0
  24. data/examples/store-api-tests/Gemfile +4 -0
  25. data/examples/store-api-tests/Gemfile.lock +70 -0
  26. data/examples/store-api-tests/spec/api/category_spec.rb +23 -0
  27. data/examples/store-api-tests/spec/api/product_spec.rb +55 -0
  28. data/examples/store-api-tests/spec/api/restspec/endpoints.rb +39 -0
  29. data/examples/store-api-tests/spec/api/restspec/requirements.rb +0 -0
  30. data/examples/store-api-tests/spec/api/restspec/restspec_config.rb +6 -0
  31. data/examples/store-api-tests/spec/api/restspec/schemas.rb +11 -0
  32. data/examples/store-api-tests/spec/spec_helper.rb +19 -0
  33. data/examples/store-api-tests/spec/support/custom_macros.rb +3 -0
  34. data/examples/store-api-tests/spec/support/custom_matchers.rb +0 -0
  35. data/examples/store-api/.editorconfig +24 -0
  36. data/examples/store-api/.rbenv-vars.example +3 -0
  37. data/examples/store-api/.rspec +4 -0
  38. data/examples/store-api/.ruby-version +1 -0
  39. data/examples/store-api/Gemfile +58 -0
  40. data/examples/store-api/Gemfile.lock +216 -0
  41. data/examples/store-api/Guardfile +39 -0
  42. data/examples/store-api/README.md +1 -0
  43. data/examples/store-api/Rakefile +6 -0
  44. data/examples/store-api/app/assets/images/.keep +0 -0
  45. data/examples/store-api/app/assets/javascripts/application.js +16 -0
  46. data/examples/store-api/app/assets/javascripts/categories.js.coffee +3 -0
  47. data/examples/store-api/app/assets/javascripts/products.js.coffee +3 -0
  48. data/examples/store-api/app/assets/stylesheets/application.css +15 -0
  49. data/examples/store-api/app/assets/stylesheets/categories.css.scss +3 -0
  50. data/examples/store-api/app/assets/stylesheets/products.css.scss +3 -0
  51. data/examples/store-api/app/assets/stylesheets/scaffolds.css.scss +69 -0
  52. data/examples/store-api/app/controllers/application_controller.rb +5 -0
  53. data/examples/store-api/app/controllers/categories_controller.rb +74 -0
  54. data/examples/store-api/app/controllers/concerns/.keep +0 -0
  55. data/examples/store-api/app/controllers/products_controller.rb +74 -0
  56. data/examples/store-api/app/helpers/application_helper.rb +2 -0
  57. data/examples/store-api/app/helpers/categories_helper.rb +2 -0
  58. data/examples/store-api/app/helpers/products_helper.rb +2 -0
  59. data/examples/store-api/app/mailers/.keep +0 -0
  60. data/examples/store-api/app/models/.keep +0 -0
  61. data/examples/store-api/app/models/category.rb +2 -0
  62. data/examples/store-api/app/models/concerns/.keep +0 -0
  63. data/examples/store-api/app/models/product.rb +3 -0
  64. data/examples/store-api/app/views/categories/_form.html.erb +21 -0
  65. data/examples/store-api/app/views/categories/edit.html.erb +6 -0
  66. data/examples/store-api/app/views/categories/index.html.erb +25 -0
  67. data/examples/store-api/app/views/categories/index.json.jbuilder +4 -0
  68. data/examples/store-api/app/views/categories/new.html.erb +5 -0
  69. data/examples/store-api/app/views/categories/show.html.erb +9 -0
  70. data/examples/store-api/app/views/categories/show.json.jbuilder +1 -0
  71. data/examples/store-api/app/views/layouts/application.html.erb +14 -0
  72. data/examples/store-api/app/views/products/_form.html.erb +29 -0
  73. data/examples/store-api/app/views/products/edit.html.erb +6 -0
  74. data/examples/store-api/app/views/products/index.html.erb +29 -0
  75. data/examples/store-api/app/views/products/index.json.jbuilder +4 -0
  76. data/examples/store-api/app/views/products/new.html.erb +5 -0
  77. data/examples/store-api/app/views/products/show.html.erb +19 -0
  78. data/examples/store-api/app/views/products/show.json.jbuilder +6 -0
  79. data/examples/store-api/bin/bundle +3 -0
  80. data/examples/store-api/bin/guard +16 -0
  81. data/examples/store-api/bin/rails +8 -0
  82. data/examples/store-api/bin/rake +8 -0
  83. data/examples/store-api/bin/spring +18 -0
  84. data/examples/store-api/config.ru +4 -0
  85. data/examples/store-api/config/application.rb +30 -0
  86. data/examples/store-api/config/boot.rb +4 -0
  87. data/examples/store-api/config/database.yml +25 -0
  88. data/examples/store-api/config/environment.rb +5 -0
  89. data/examples/store-api/config/environments/development.rb +37 -0
  90. data/examples/store-api/config/environments/production.rb +78 -0
  91. data/examples/store-api/config/environments/test.rb +39 -0
  92. data/examples/store-api/config/initializers/assets.rb +8 -0
  93. data/examples/store-api/config/initializers/backtrace_silencers.rb +7 -0
  94. data/examples/store-api/config/initializers/cookies_serializer.rb +3 -0
  95. data/examples/store-api/config/initializers/filter_parameter_logging.rb +4 -0
  96. data/examples/store-api/config/initializers/inflections.rb +16 -0
  97. data/examples/store-api/config/initializers/mime_types.rb +4 -0
  98. data/examples/store-api/config/initializers/session_store.rb +3 -0
  99. data/examples/store-api/config/initializers/wrap_parameters.rb +14 -0
  100. data/examples/store-api/config/locales/en.yml +23 -0
  101. data/examples/store-api/config/routes.rb +59 -0
  102. data/examples/store-api/config/secrets.yml +22 -0
  103. data/examples/store-api/db/migrate/20141205154816_create_products.rb +11 -0
  104. data/examples/store-api/db/migrate/20141205171104_create_categories.rb +9 -0
  105. data/examples/store-api/db/migrate/20141205171140_add_category_id_to_products.rb +5 -0
  106. data/examples/store-api/db/schema.rb +31 -0
  107. data/examples/store-api/db/seeds.rb +7 -0
  108. data/examples/store-api/lib/assets/.keep +0 -0
  109. data/examples/store-api/lib/tasks/.keep +0 -0
  110. data/examples/store-api/log/.keep +0 -0
  111. data/examples/store-api/public/404.html +67 -0
  112. data/examples/store-api/public/422.html +67 -0
  113. data/examples/store-api/public/500.html +66 -0
  114. data/examples/store-api/public/favicon.ico +0 -0
  115. data/examples/store-api/public/robots.txt +5 -0
  116. data/examples/store-api/spec/controllers/categories_controller_spec.rb +159 -0
  117. data/examples/store-api/spec/controllers/products_controller_spec.rb +159 -0
  118. data/examples/store-api/spec/factories/categories.rb +6 -0
  119. data/examples/store-api/spec/factories/products.rb +8 -0
  120. data/examples/store-api/spec/helpers/categories_helper_spec.rb +15 -0
  121. data/examples/store-api/spec/helpers/products_helper_spec.rb +15 -0
  122. data/examples/store-api/spec/models/category_spec.rb +5 -0
  123. data/examples/store-api/spec/models/product_spec.rb +5 -0
  124. data/examples/store-api/spec/rails_helper.rb +50 -0
  125. data/examples/store-api/spec/requests/categories_spec.rb +10 -0
  126. data/examples/store-api/spec/requests/products_spec.rb +10 -0
  127. data/examples/store-api/spec/routing/categories_routing_spec.rb +35 -0
  128. data/examples/store-api/spec/routing/products_routing_spec.rb +35 -0
  129. data/examples/store-api/spec/spec_helper.rb +85 -0
  130. data/examples/store-api/spec/views/categories/edit.html.erb_spec.rb +18 -0
  131. data/examples/store-api/spec/views/categories/index.html.erb_spec.rb +19 -0
  132. data/examples/store-api/spec/views/categories/new.html.erb_spec.rb +18 -0
  133. data/examples/store-api/spec/views/categories/show.html.erb_spec.rb +14 -0
  134. data/examples/store-api/spec/views/products/edit.html.erb_spec.rb +24 -0
  135. data/examples/store-api/spec/views/products/index.html.erb_spec.rb +25 -0
  136. data/examples/store-api/spec/views/products/new.html.erb_spec.rb +24 -0
  137. data/examples/store-api/spec/views/products/show.html.erb_spec.rb +18 -0
  138. data/examples/store-api/vendor/assets/javascripts/.keep +0 -0
  139. data/examples/store-api/vendor/assets/stylesheets/.keep +0 -0
  140. data/lib/restspec.rb +38 -0
  141. data/lib/restspec/configuration.rb +43 -0
  142. data/lib/restspec/endpoints/dsl.rb +142 -0
  143. data/lib/restspec/endpoints/endpoint.rb +135 -0
  144. data/lib/restspec/endpoints/namespace.rb +89 -0
  145. data/lib/restspec/endpoints/network.rb +39 -0
  146. data/lib/restspec/endpoints/request.rb +11 -0
  147. data/lib/restspec/endpoints/response.rb +53 -0
  148. data/lib/restspec/requirements/dsl.rb +10 -0
  149. data/lib/restspec/requirements/requirement.rb +59 -0
  150. data/lib/restspec/rspec/api_helpers.rb +64 -0
  151. data/lib/restspec/rspec/api_macros.rb +126 -0
  152. data/lib/restspec/rspec/extras.rb +2 -0
  153. data/lib/restspec/rspec/matchers/api_matchers.rb +6 -0
  154. data/lib/restspec/rspec/matchers/be_like_schema.rb +18 -0
  155. data/lib/restspec/rspec/matchers/be_like_schema_array.rb +18 -0
  156. data/lib/restspec/rspec/matchers/have_header.rb +47 -0
  157. data/lib/restspec/rspec/matchers/have_status.rb +17 -0
  158. data/lib/restspec/rspec/matchers/include_where.rb +14 -0
  159. data/lib/restspec/rspec/shared_examples.rb +12 -0
  160. data/lib/restspec/schema/attribute.rb +31 -0
  161. data/lib/restspec/schema/attribute_example.rb +21 -0
  162. data/lib/restspec/schema/checker.rb +73 -0
  163. data/lib/restspec/schema/dsl.rb +36 -0
  164. data/lib/restspec/schema/schema.rb +21 -0
  165. data/lib/restspec/schema/schema_example.rb +28 -0
  166. data/lib/restspec/schema/types.rb +35 -0
  167. data/lib/restspec/schema/types/array_type.rb +34 -0
  168. data/lib/restspec/schema/types/basic_type.rb +35 -0
  169. data/lib/restspec/schema/types/boolean_type.rb +11 -0
  170. data/lib/restspec/schema/types/decimal_string_type.rb +32 -0
  171. data/lib/restspec/schema/types/decimal_type.rb +14 -0
  172. data/lib/restspec/schema/types/embedded_schema_type.rb +28 -0
  173. data/lib/restspec/schema/types/hash_type.rb +25 -0
  174. data/lib/restspec/schema/types/integer_type.rb +11 -0
  175. data/lib/restspec/schema/types/null_type.rb +11 -0
  176. data/lib/restspec/schema/types/one_of_type.rb +21 -0
  177. data/lib/restspec/schema/types/schema_id_type.rb +88 -0
  178. data/lib/restspec/schema/types/string_type.rb +11 -0
  179. data/lib/restspec/shortcuts.rb +8 -0
  180. data/lib/restspec/stores/endpoint_store.rb +25 -0
  181. data/lib/restspec/stores/namespace_store.rb +20 -0
  182. data/lib/restspec/stores/schema_store.rb +19 -0
  183. data/lib/restspec/values/status_code.rb +13 -0
  184. data/lib/restspec/values/super_hash.rb +12 -0
  185. data/lib/restspec/version.rb +3 -0
  186. data/restspec.gemspec +37 -0
  187. data/spec/restspec/endpoints/dsl_spec.rb +269 -0
  188. data/spec/restspec/endpoints/endpoint_spec.rb +146 -0
  189. data/spec/restspec/endpoints/namespace_spec.rb +143 -0
  190. data/spec/restspec/endpoints/response_spec.rb +49 -0
  191. data/spec/restspec/schema/attribute_example_spec.rb +35 -0
  192. data/spec/restspec/schema/dsl_spec.rb +78 -0
  193. data/spec/restspec/schema/schema_example_spec.rb +40 -0
  194. data/spec/restspec/schema/schema_spec.rb +11 -0
  195. data/spec/restspec/schema/types/array_type_spec.rb +56 -0
  196. data/spec/restspec/schema/types/basic_type_spec.rb +62 -0
  197. data/spec/restspec/schema/types/boolean_type_spec.rb +26 -0
  198. data/spec/restspec/schema/types/null_type_spec.rb +25 -0
  199. data/spec/restspec/schema/types/string_type_spec.rb +26 -0
  200. data/spec/restspec/values/status_code_spec.rb +13 -0
  201. data/spec/spec_helper.rb +23 -0
  202. metadata +484 -0
@@ -0,0 +1,216 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actionmailer (4.1.6)
5
+ actionpack (= 4.1.6)
6
+ actionview (= 4.1.6)
7
+ mail (~> 2.5, >= 2.5.4)
8
+ actionpack (4.1.6)
9
+ actionview (= 4.1.6)
10
+ activesupport (= 4.1.6)
11
+ rack (~> 1.5.2)
12
+ rack-test (~> 0.6.2)
13
+ actionview (4.1.6)
14
+ activesupport (= 4.1.6)
15
+ builder (~> 3.1)
16
+ erubis (~> 2.7.0)
17
+ activemodel (4.1.6)
18
+ activesupport (= 4.1.6)
19
+ builder (~> 3.1)
20
+ activerecord (4.1.6)
21
+ activemodel (= 4.1.6)
22
+ activesupport (= 4.1.6)
23
+ arel (~> 5.0.0)
24
+ activesupport (4.1.6)
25
+ i18n (~> 0.6, >= 0.6.9)
26
+ json (~> 1.7, >= 1.7.7)
27
+ minitest (~> 5.1)
28
+ thread_safe (~> 0.1)
29
+ tzinfo (~> 1.1)
30
+ arel (5.0.1.20140414130214)
31
+ better_errors (2.0.0)
32
+ coderay (>= 1.0.0)
33
+ erubis (>= 2.6.6)
34
+ rack (>= 0.9.0)
35
+ binding_of_caller (0.7.2)
36
+ debug_inspector (>= 0.0.1)
37
+ builder (3.2.2)
38
+ byebug (3.5.1)
39
+ columnize (~> 0.8)
40
+ debugger-linecache (~> 1.2)
41
+ slop (~> 3.6)
42
+ celluloid (0.16.0)
43
+ timers (~> 4.0.0)
44
+ coderay (1.1.0)
45
+ coffee-rails (4.0.1)
46
+ coffee-script (>= 2.2.0)
47
+ railties (>= 4.0.0, < 5.0)
48
+ coffee-script (2.3.0)
49
+ coffee-script-source
50
+ execjs
51
+ coffee-script-source (1.8.0)
52
+ columnize (0.8.9)
53
+ debug_inspector (0.0.2)
54
+ debugger-linecache (1.2.0)
55
+ diff-lcs (1.2.5)
56
+ erubis (2.7.0)
57
+ execjs (2.2.2)
58
+ factory_girl (4.5.0)
59
+ activesupport (>= 3.0.0)
60
+ factory_girl_rails (4.5.0)
61
+ factory_girl (~> 4.5.0)
62
+ railties (>= 3.0.0)
63
+ faker (1.4.3)
64
+ i18n (~> 0.5)
65
+ ffi (1.9.6)
66
+ formatador (0.2.5)
67
+ guard (2.10.1)
68
+ formatador (>= 0.2.4)
69
+ listen (~> 2.7)
70
+ lumberjack (~> 1.0)
71
+ pry (>= 0.9.12)
72
+ thor (>= 0.18.1)
73
+ guard-rspec (4.3.1)
74
+ guard (~> 2.1)
75
+ rspec (>= 2.14, < 4.0)
76
+ hike (1.2.3)
77
+ hitimes (1.2.2)
78
+ i18n (0.6.11)
79
+ jbuilder (2.2.5)
80
+ activesupport (>= 3.0.0, < 5)
81
+ multi_json (~> 1.2)
82
+ jquery-rails (3.1.2)
83
+ railties (>= 3.0, < 5.0)
84
+ thor (>= 0.14, < 2.0)
85
+ json (1.8.1)
86
+ listen (2.8.3)
87
+ celluloid (>= 0.15.2)
88
+ rb-fsevent (>= 0.9.3)
89
+ rb-inotify (>= 0.9)
90
+ lumberjack (1.0.9)
91
+ mail (2.6.3)
92
+ mime-types (>= 1.16, < 3)
93
+ method_source (0.8.2)
94
+ mime-types (2.4.3)
95
+ minitest (5.4.3)
96
+ multi_json (1.10.1)
97
+ pry (0.10.1)
98
+ coderay (~> 1.1.0)
99
+ method_source (~> 0.8.1)
100
+ slop (~> 3.4)
101
+ pry-rails (0.3.2)
102
+ pry (>= 0.9.10)
103
+ quiet_assets (1.0.3)
104
+ railties (>= 3.1, < 5.0)
105
+ rack (1.5.2)
106
+ rack-test (0.6.2)
107
+ rack (>= 1.0)
108
+ rails (4.1.6)
109
+ actionmailer (= 4.1.6)
110
+ actionpack (= 4.1.6)
111
+ actionview (= 4.1.6)
112
+ activemodel (= 4.1.6)
113
+ activerecord (= 4.1.6)
114
+ activesupport (= 4.1.6)
115
+ bundler (>= 1.3.0, < 2.0)
116
+ railties (= 4.1.6)
117
+ sprockets-rails (~> 2.0)
118
+ railties (4.1.6)
119
+ actionpack (= 4.1.6)
120
+ activesupport (= 4.1.6)
121
+ rake (>= 0.8.7)
122
+ thor (>= 0.18.1, < 2.0)
123
+ rake (10.4.2)
124
+ rb-fsevent (0.9.4)
125
+ rb-inotify (0.9.5)
126
+ ffi (>= 0.5.0)
127
+ rdoc (4.1.2)
128
+ json (~> 1.4)
129
+ rspec (3.1.0)
130
+ rspec-core (~> 3.1.0)
131
+ rspec-expectations (~> 3.1.0)
132
+ rspec-mocks (~> 3.1.0)
133
+ rspec-core (3.1.7)
134
+ rspec-support (~> 3.1.0)
135
+ rspec-expectations (3.1.2)
136
+ diff-lcs (>= 1.2.0, < 2.0)
137
+ rspec-support (~> 3.1.0)
138
+ rspec-mocks (3.1.3)
139
+ rspec-support (~> 3.1.0)
140
+ rspec-nc (0.2.0)
141
+ rspec (>= 2.9)
142
+ terminal-notifier (>= 1.4)
143
+ rspec-rails (3.1.0)
144
+ actionpack (>= 3.0)
145
+ activesupport (>= 3.0)
146
+ railties (>= 3.0)
147
+ rspec-core (~> 3.1.0)
148
+ rspec-expectations (~> 3.1.0)
149
+ rspec-mocks (~> 3.1.0)
150
+ rspec-support (~> 3.1.0)
151
+ rspec-support (3.1.2)
152
+ sass (3.2.19)
153
+ sass-rails (4.0.5)
154
+ railties (>= 4.0.0, < 5.0)
155
+ sass (~> 3.2.2)
156
+ sprockets (~> 2.8, < 3.0)
157
+ sprockets-rails (~> 2.0)
158
+ sdoc (0.4.1)
159
+ json (~> 1.7, >= 1.7.7)
160
+ rdoc (~> 4.0)
161
+ shoulda-matchers (2.7.0)
162
+ activesupport (>= 3.0.0)
163
+ slop (3.6.0)
164
+ spring (1.2.0)
165
+ sprockets (2.12.3)
166
+ hike (~> 1.2)
167
+ multi_json (~> 1.0)
168
+ rack (~> 1.0)
169
+ tilt (~> 1.1, != 1.3.0)
170
+ sprockets-rails (2.2.2)
171
+ actionpack (>= 3.0)
172
+ activesupport (>= 3.0)
173
+ sprockets (>= 2.8, < 4.0)
174
+ sqlite3 (1.3.10)
175
+ terminal-notifier (1.6.2)
176
+ thor (0.19.1)
177
+ thread_safe (0.3.4)
178
+ tilt (1.4.1)
179
+ timers (4.0.1)
180
+ hitimes
181
+ turbolinks (2.5.2)
182
+ coffee-rails
183
+ tzinfo (1.2.2)
184
+ thread_safe (~> 0.1)
185
+ uglifier (2.5.3)
186
+ execjs (>= 0.3.0)
187
+ json (>= 1.8.0)
188
+ zeus (0.15.3)
189
+ method_source (>= 0.6.7)
190
+
191
+ PLATFORMS
192
+ ruby
193
+
194
+ DEPENDENCIES
195
+ better_errors
196
+ binding_of_caller
197
+ byebug
198
+ coffee-rails (~> 4.0.0)
199
+ factory_girl_rails
200
+ faker
201
+ guard-rspec
202
+ jbuilder (~> 2.0)
203
+ jquery-rails
204
+ pry-rails
205
+ quiet_assets
206
+ rails (= 4.1.6)
207
+ rspec-nc
208
+ rspec-rails
209
+ sass-rails (~> 4.0.3)
210
+ sdoc (~> 0.4.0)
211
+ shoulda-matchers
212
+ spring
213
+ sqlite3
214
+ turbolinks
215
+ uglifier (>= 1.3.0)
216
+ zeus
@@ -0,0 +1,39 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %(app lib config test spec feature)
6
+
7
+ ## Uncomment to clear the screen before every task
8
+ # clearing :on
9
+
10
+ # Note: The cmd option is now required due to the increasing number of ways
11
+ # rspec may be run, below are examples of the most common uses.
12
+ # * bundler: 'bundle exec rspec'
13
+ # * bundler binstubs: 'bin/rspec'
14
+ # * spring: 'bin/rsspec' (This will use spring if running and you have
15
+ # installed the spring binstubs per the docs)
16
+ # * zeus: 'zeus rspec' (requires the server to be started separetly)
17
+ # * 'just' rspec: 'rspec'
18
+ guard :rspec, cmd: 'bundle exec rspec' do
19
+ watch(%r{^spec/.+_spec\.rb$})
20
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
21
+ watch('spec/spec_helper.rb') { "spec" }
22
+
23
+ # Rails example
24
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
25
+ watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
26
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
27
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
28
+ watch('config/routes.rb') { "spec/routing" }
29
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
30
+ watch('spec/rails_helper.rb') { "spec" }
31
+
32
+ # Capybara features specs
33
+ watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
34
+
35
+ # Turnip features and steps
36
+ watch(%r{^spec/acceptance/(.+)\.feature$})
37
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
38
+ end
39
+
@@ -0,0 +1 @@
1
+ TODO: write an awesome README file
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Categories controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Products controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,69 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ p, ol, ul, td {
10
+ font-family: verdana, arial, helvetica, sans-serif;
11
+ font-size: 13px;
12
+ line-height: 18px;
13
+ }
14
+
15
+ pre {
16
+ background-color: #eee;
17
+ padding: 10px;
18
+ font-size: 11px;
19
+ }
20
+
21
+ a {
22
+ color: #000;
23
+ &:visited {
24
+ color: #666;
25
+ }
26
+ &:hover {
27
+ color: #fff;
28
+ background-color: #000;
29
+ }
30
+ }
31
+
32
+ div {
33
+ &.field, &.actions {
34
+ margin-bottom: 10px;
35
+ }
36
+ }
37
+
38
+ #notice {
39
+ color: green;
40
+ }
41
+
42
+ .field_with_errors {
43
+ padding: 2px;
44
+ background-color: red;
45
+ display: table;
46
+ }
47
+
48
+ #error_explanation {
49
+ width: 450px;
50
+ border: 2px solid red;
51
+ padding: 7px;
52
+ padding-bottom: 0;
53
+ margin-bottom: 20px;
54
+ background-color: #f0f0f0;
55
+ h2 {
56
+ text-align: left;
57
+ font-weight: bold;
58
+ padding: 5px 5px 5px 15px;
59
+ font-size: 12px;
60
+ margin: -7px;
61
+ margin-bottom: 0px;
62
+ background-color: #c00;
63
+ color: #fff;
64
+ }
65
+ ul li {
66
+ font-size: 12px;
67
+ list-style: square;
68
+ }
69
+ }
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ # protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,74 @@
1
+ class CategoriesController < ApplicationController
2
+ before_action :set_category, only: [:show, :edit, :update, :destroy]
3
+
4
+ # GET /categories
5
+ # GET /categories.json
6
+ def index
7
+ @categories = Category.all
8
+ end
9
+
10
+ # GET /categories/1
11
+ # GET /categories/1.json
12
+ def show
13
+ end
14
+
15
+ # GET /categories/new
16
+ def new
17
+ @category = Category.new
18
+ end
19
+
20
+ # GET /categories/1/edit
21
+ def edit
22
+ end
23
+
24
+ # POST /categories
25
+ # POST /categories.json
26
+ def create
27
+ @category = Category.new(category_params)
28
+
29
+ respond_to do |format|
30
+ if @category.save
31
+ format.html { redirect_to @category, notice: 'Category was successfully created.' }
32
+ format.json { render :show, status: :created, location: @category }
33
+ else
34
+ format.html { render :new }
35
+ format.json { render json: @category.errors, status: :unprocessable_entity }
36
+ end
37
+ end
38
+ end
39
+
40
+ # PATCH/PUT /categories/1
41
+ # PATCH/PUT /categories/1.json
42
+ def update
43
+ respond_to do |format|
44
+ if @category.update(category_params)
45
+ format.html { redirect_to @category, notice: 'Category was successfully updated.' }
46
+ format.json { render :show, status: :ok, location: @category }
47
+ else
48
+ format.html { render :edit }
49
+ format.json { render json: @category.errors, status: :unprocessable_entity }
50
+ end
51
+ end
52
+ end
53
+
54
+ # DELETE /categories/1
55
+ # DELETE /categories/1.json
56
+ def destroy
57
+ @category.destroy
58
+ respond_to do |format|
59
+ format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }
60
+ format.json { head :no_content }
61
+ end
62
+ end
63
+
64
+ private
65
+ # Use callbacks to share common setup or constraints between actions.
66
+ def set_category
67
+ @category = Category.find(params[:id])
68
+ end
69
+
70
+ # Never trust parameters from the scary internet, only allow the white list through.
71
+ def category_params
72
+ params.require(:category).permit(:name)
73
+ end
74
+ end