spontaneous 0.2.0.beta1 → 0.2.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (335) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.locat +42 -0
  4. data/.travis/gemfiles/Gemfile.empty +7 -0
  5. data/.travis.yml +18 -0
  6. data/Gemfile +12 -8
  7. data/LICENSE +1 -1
  8. data/Rakefile +15 -157
  9. data/Readme.markdown +1 -1
  10. data/application/css/core.css.scss +22 -146
  11. data/application/css/definitions.css.scss +7 -3
  12. data/application/css/dialogue.css.scss +26 -1
  13. data/application/css/editing.css.scss +70 -28
  14. data/application/css/font.css.scss +1 -1
  15. data/application/css/popover.css.scss +2 -0
  16. data/application/css/top.css.scss +231 -0
  17. data/application/js/add_alias_dialogue.js +1 -1
  18. data/application/js/add_home_dialogue.js +1 -1
  19. data/application/js/ajax.js +61 -31
  20. data/application/js/box.js +4 -4
  21. data/application/js/conflicted_field_dialogue.js +1 -1
  22. data/application/js/content.js +5 -5
  23. data/application/js/dom.js +5 -0
  24. data/application/js/edit_panel.js +1 -0
  25. data/application/js/editing.js +1 -1
  26. data/application/js/extensions.js +8 -0
  27. data/application/js/field/boolean.js +31 -0
  28. data/application/js/field/file.js +32 -4
  29. data/application/js/field/image.js +24 -9
  30. data/application/js/field/markdown.js +87 -59
  31. data/application/js/field/select.js +1 -1
  32. data/application/js/field/webvideo.js +6 -1
  33. data/application/js/init.js +2 -2
  34. data/application/js/jquery-selection-position.js +130 -0
  35. data/application/js/location.js +4 -25
  36. data/application/js/meta_view/user_admin.js +2 -2
  37. data/application/js/metadata.js +2 -2
  38. data/application/js/page_browser.js +1 -1
  39. data/application/js/panel/root_menu.js +0 -1
  40. data/application/js/popover.js +27 -12
  41. data/application/js/popover_view.js +20 -4
  42. data/application/js/preview.js +31 -16
  43. data/application/js/progress.js +22 -21
  44. data/application/js/publish.js +18 -7
  45. data/application/js/sharded_upload.js +9 -6
  46. data/application/js/spontaneous.js +3 -1
  47. data/application/js/top_bar.js +264 -173
  48. data/application/js/upload.js +12 -5
  49. data/application/js/upload_manager.js +4 -3
  50. data/application/js/user.js +1 -2
  51. data/application/js/views/box_view.js +1 -1
  52. data/application/js/views/page_view.js +16 -5
  53. data/application/js/views/piece_view.js +5 -4
  54. data/application/static/font/fontawesome-webfont-1c66a4738b40ef0f6b1abca0ba9a796d.ttf +0 -0
  55. data/application/views/index.erb +6 -14
  56. data/application/views/login.erb +6 -25
  57. data/application/views/schema_modification_error.html.erb +3 -7
  58. data/db/migrations/20130114120000_create_revision_tables.rb +2 -2
  59. data/db/migrations/20130813111009_increase_path_length.rb +14 -0
  60. data/gem-public_cert.pem +20 -0
  61. data/lib/spontaneous/asset/app_compiler.rb +44 -0
  62. data/lib/spontaneous/asset/environment.rb +225 -0
  63. data/lib/spontaneous/asset.rb +2 -67
  64. data/lib/spontaneous/box.rb +0 -1
  65. data/lib/spontaneous/capistrano/deploy.rb +2 -2
  66. data/lib/spontaneous/capistrano/sync.rb +1 -1
  67. data/lib/spontaneous/cli/init.rb +36 -13
  68. data/lib/spontaneous/cli/server.rb +0 -1
  69. data/lib/spontaneous/cli/site.rb +2 -1
  70. data/lib/spontaneous/cli.rb +3 -1
  71. data/lib/spontaneous/collections/entry_set.rb +4 -12
  72. data/lib/spontaneous/collections/hash_with_fallback.rb +20 -0
  73. data/lib/spontaneous/collections/prototype_set.rb +6 -5
  74. data/lib/spontaneous/crypt.rb +2 -2
  75. data/lib/spontaneous/data_mapper/content_model/associations.rb +115 -63
  76. data/lib/spontaneous/data_mapper.rb +1 -1
  77. data/lib/spontaneous/errors.rb +6 -0
  78. data/lib/spontaneous/extensions/object_space.rb +6 -0
  79. data/lib/spontaneous/facet.rb +1 -0
  80. data/lib/spontaneous/field/base.rb +86 -13
  81. data/lib/spontaneous/field/boolean.rb +65 -0
  82. data/lib/spontaneous/field/file.rb +17 -6
  83. data/lib/spontaneous/field/html.rb +13 -0
  84. data/lib/spontaneous/field/image/size.rb +76 -0
  85. data/lib/spontaneous/field/image.rb +99 -414
  86. data/lib/spontaneous/field/tags.rb +36 -0
  87. data/lib/spontaneous/field/update.rb +1 -1
  88. data/lib/spontaneous/field/webvideo/fallback.rb +41 -0
  89. data/lib/spontaneous/field/webvideo/vimeo.rb +113 -0
  90. data/lib/spontaneous/field/webvideo/vine.rb +94 -0
  91. data/lib/spontaneous/field/webvideo/youtube.rb +133 -0
  92. data/lib/spontaneous/field/webvideo.rb +100 -250
  93. data/lib/spontaneous/field.rb +1 -1
  94. data/lib/spontaneous/generators/site/Gemfile.tt +5 -14
  95. data/lib/spontaneous/generators/site/assets/README.md +20 -0
  96. data/lib/spontaneous/generators/site/assets/css/site.scss +8 -0
  97. data/lib/spontaneous/generators/site/assets/js/site.js +6 -0
  98. data/lib/spontaneous/generators/site/config/deploy.rb.tt +9 -0
  99. data/lib/spontaneous/generators/site/config/user_levels.yml +14 -3
  100. data/lib/spontaneous/generators/site/public/README.md +12 -0
  101. data/lib/spontaneous/generators/site/templates/layouts/standard.html.cut.tt +2 -2
  102. data/lib/spontaneous/generators/site.rb +77 -35
  103. data/lib/spontaneous/layout.rb +6 -7
  104. data/lib/spontaneous/loader.rb +21 -13
  105. data/lib/spontaneous/media/file.rb +22 -9
  106. data/lib/spontaneous/media/image/attributes.rb +33 -0
  107. data/lib/spontaneous/media/image/format/gif.rb +4 -0
  108. data/lib/spontaneous/media/image/format/jpg.rb +17 -0
  109. data/lib/spontaneous/media/image/format/png.rb +4 -0
  110. data/lib/spontaneous/media/image/format/webp.rb +26 -0
  111. data/lib/spontaneous/media/image/format.rb +79 -0
  112. data/lib/spontaneous/media/image/optimizer.rb +69 -0
  113. data/lib/spontaneous/media/image/processor.rb +17 -0
  114. data/lib/spontaneous/media/image/renderable.rb +52 -0
  115. data/lib/spontaneous/media/image/skeptick.rb +70 -0
  116. data/lib/spontaneous/media/image.rb +50 -0
  117. data/lib/spontaneous/media/temp_file.rb +4 -0
  118. data/lib/spontaneous/media.rb +1 -0
  119. data/lib/spontaneous/model/core/aliases.rb +14 -8
  120. data/lib/spontaneous/model/core/boxes.rb +5 -2
  121. data/lib/spontaneous/model/core/entries.rb +4 -0
  122. data/lib/spontaneous/model/core/entry.rb +1 -0
  123. data/lib/spontaneous/model/core/fields.rb +5 -2
  124. data/lib/spontaneous/model/core/locks.rb +16 -0
  125. data/lib/spontaneous/model/core/media.rb +1 -15
  126. data/lib/spontaneous/model/core.rb +31 -1
  127. data/lib/spontaneous/model/page/controllers.rb +2 -2
  128. data/lib/spontaneous/model/page/formats.rb +1 -4
  129. data/lib/spontaneous/model/page/layouts.rb +6 -2
  130. data/lib/spontaneous/model/page/locks.rb +8 -2
  131. data/lib/spontaneous/model/page/page_tree.rb +2 -2
  132. data/lib/spontaneous/model/page/paths.rb +74 -9
  133. data/lib/spontaneous/model/page.rb +11 -3
  134. data/lib/spontaneous/model.rb +6 -6
  135. data/lib/spontaneous/output/context/render_cache.rb +23 -0
  136. data/lib/spontaneous/output/context.rb +56 -30
  137. data/lib/spontaneous/output/helpers/script_helper.rb +9 -53
  138. data/lib/spontaneous/output/helpers/stylesheet_helper.rb +8 -40
  139. data/lib/spontaneous/output/template/renderer.rb +17 -5
  140. data/lib/spontaneous/output.rb +0 -1
  141. data/lib/spontaneous/paths.rb +6 -2
  142. data/lib/spontaneous/permissions/access_key.rb +18 -0
  143. data/lib/spontaneous/permissions/user.rb +1 -1
  144. data/lib/spontaneous/permissions.rb +4 -1
  145. data/lib/spontaneous/plugins/application/state.rb +19 -12
  146. data/lib/spontaneous/prototypes/field_prototype.rb +14 -8
  147. data/lib/spontaneous/published_revision.rb +7 -0
  148. data/lib/spontaneous/publishing/immediate.rb +43 -34
  149. data/lib/spontaneous/publishing/revision.rb +9 -6
  150. data/lib/spontaneous/rack/asset_server.rb +20 -0
  151. data/lib/spontaneous/rack/back/alias.rb +46 -0
  152. data/lib/spontaneous/rack/back/application_assets.rb +28 -0
  153. data/lib/spontaneous/rack/back/base.rb +34 -0
  154. data/lib/spontaneous/rack/back/changes.rb +19 -0
  155. data/lib/spontaneous/rack/back/content.rb +54 -0
  156. data/lib/spontaneous/rack/back/events.rb +38 -0
  157. data/lib/spontaneous/rack/back/field.rb +37 -0
  158. data/lib/spontaneous/rack/back/file.rb +118 -0
  159. data/lib/spontaneous/rack/back/helpers.rb +71 -0
  160. data/lib/spontaneous/rack/back/index.rb +16 -0
  161. data/lib/spontaneous/rack/back/login.rb +47 -0
  162. data/lib/spontaneous/rack/back/map.rb +24 -0
  163. data/lib/spontaneous/rack/back/page.rb +46 -0
  164. data/lib/spontaneous/rack/back/preview.rb +43 -0
  165. data/lib/spontaneous/rack/back/schema.rb +30 -0
  166. data/lib/spontaneous/rack/back/site.rb +25 -0
  167. data/lib/spontaneous/rack/back/site_assets.rb +13 -0
  168. data/lib/spontaneous/rack/back/unsupported_browser.rb +7 -0
  169. data/lib/spontaneous/rack/{user_admin.rb → back/user_admin.rb} +2 -5
  170. data/lib/spontaneous/rack/back.rb +85 -764
  171. data/lib/spontaneous/rack/cacheable_file.rb +3 -3
  172. data/lib/spontaneous/rack/front.rb +16 -9
  173. data/lib/spontaneous/rack/middleware/authenticate.rb +65 -0
  174. data/lib/spontaneous/rack/middleware/csrf.rb +66 -0
  175. data/lib/spontaneous/rack/middleware/reloader.rb +52 -0
  176. data/lib/spontaneous/rack/middleware/scope.rb +60 -0
  177. data/lib/spontaneous/rack/middleware.rb +6 -0
  178. data/lib/spontaneous/rack/page_controller.rb +18 -5
  179. data/lib/spontaneous/rack/public.rb +17 -11
  180. data/lib/spontaneous/rack.rb +34 -24
  181. data/lib/spontaneous/revision.rb +29 -2
  182. data/lib/spontaneous/schema/uid.rb +4 -3
  183. data/lib/spontaneous/schema/uid_map.rb +5 -24
  184. data/lib/spontaneous/schema.rb +1 -0
  185. data/lib/spontaneous/search/database.rb +8 -0
  186. data/lib/spontaneous/search/field.rb +1 -1
  187. data/lib/spontaneous/search/index.rb +3 -5
  188. data/lib/spontaneous/server.rb +1 -1
  189. data/lib/spontaneous/simultaneous.rb +1 -1
  190. data/lib/spontaneous/site/features.rb +4 -5
  191. data/lib/spontaneous/site/helpers.rb +22 -5
  192. data/lib/spontaneous/site/instance.rb +2 -2
  193. data/lib/spontaneous/site/selectors.rb +22 -3
  194. data/lib/spontaneous/storage/cloud.rb +13 -9
  195. data/lib/spontaneous/storage/local.rb +11 -6
  196. data/lib/spontaneous/style.rb +40 -23
  197. data/lib/spontaneous/utils/database/mysql_dumper.rb +1 -1
  198. data/lib/spontaneous/utils/smush_it.rb +1 -1
  199. data/lib/spontaneous/version.rb +1 -1
  200. data/lib/spontaneous.rb +35 -33
  201. data/spontaneous.gemspec +53 -787
  202. data/test/experimental/test_crypt.rb +56 -56
  203. data/test/experimental/test_features.rb +16 -27
  204. data/test/fixtures/assets/public1/css/data.css.scss +3 -0
  205. data/test/fixtures/assets/public1/css/image1.css.scss +4 -0
  206. data/test/fixtures/assets/public1/css/import.css.scss +1 -0
  207. data/test/fixtures/assets/public1/css/urlhash.css.scss +3 -0
  208. data/test/fixtures/assets/public1/js/a.js +1 -1
  209. data/test/fixtures/assets/public1/js/all.js +4 -0
  210. data/test/fixtures/assets/public1/js/{m.coffee → m.js.coffee} +1 -0
  211. data/test/fixtures/assets/public1/x.js +1 -0
  212. data/test/fixtures/assets/public2/css/all.css +4 -0
  213. data/test/fixtures/assets/public2/css/missing.css.scss +3 -0
  214. data/test/fixtures/assets/public2/i/y.png +0 -0
  215. data/test/fixtures/assets/public2/js/b.js +1 -1
  216. data/test/fixtures/assets/public2/js/c.js +1 -1
  217. data/test/fixtures/images/size.extended.webp +0 -0
  218. data/test/fixtures/images/size.lossless.webp +0 -0
  219. data/test/fixtures/images/size.lossy.webp +0 -0
  220. data/test/fixtures/schema/before.yml +4 -4
  221. data/test/fixtures/schema/schema.yml +1 -1
  222. data/test/fixtures/templates/aliases/aaa.html.cut +0 -0
  223. data/test/fixtures/templates/extended/partial_with_renderer.html.cut +1 -0
  224. data/test/fixtures/templates/extended/with_includes_and_renderer.html.cut +2 -0
  225. data/test/functional/test_application.rb +108 -106
  226. data/test/functional/test_back.rb +924 -930
  227. data/test/functional/test_front.rb +285 -238
  228. data/test/functional/test_user_manager.rb +75 -100
  229. data/test/integration/test_installation.rb +1 -1
  230. data/test/support/matchers.rb +12 -0
  231. data/test/support/minitest.rb +121 -0
  232. data/test/support/rack.rb +45 -0
  233. data/test/support/test_start_finish.rb +103 -0
  234. data/test/test_helper.rb +21 -68
  235. data/test/test_integration_helper.rb +1 -3
  236. data/test/unit/test_alias.rb +432 -408
  237. data/test/unit/test_asset_bundler.rb +58 -58
  238. data/test/unit/test_assets.rb +485 -155
  239. data/test/unit/test_async.rb +16 -37
  240. data/test/unit/test_authentication.rb +425 -457
  241. data/test/unit/test_boxes.rb +191 -191
  242. data/test/unit/test_changesets.rb +244 -254
  243. data/test/unit/test_config.rb +128 -142
  244. data/test/unit/test_content.rb +313 -359
  245. data/test/unit/test_content_inheritance.rb +29 -30
  246. data/test/unit/test_datamapper.rb +1205 -1080
  247. data/test/unit/test_datamapper_content.rb +49 -51
  248. data/test/unit/test_extensions.rb +23 -23
  249. data/test/unit/test_fields.rb +1488 -1180
  250. data/test/unit/test_formats.rb +158 -158
  251. data/test/unit/test_generators.rb +98 -40
  252. data/test/unit/test_helpers.rb +73 -76
  253. data/test/unit/test_image_size.rb +53 -22
  254. data/test/unit/test_images.rb +164 -165
  255. data/test/unit/test_layouts.rb +133 -122
  256. data/test/unit/test_logger.rb +14 -17
  257. data/test/unit/test_media.rb +69 -84
  258. data/test/unit/test_modifications.rb +513 -525
  259. data/test/unit/test_page.rb +462 -361
  260. data/test/unit/test_permissions.rb +379 -364
  261. data/test/unit/test_piece.rb +67 -75
  262. data/test/unit/test_plugins.rb +82 -89
  263. data/test/unit/test_prototype_set.rb +215 -216
  264. data/test/unit/test_prototypes.rb +114 -124
  265. data/test/unit/test_publishing.rb +252 -289
  266. data/test/unit/test_render.rb +167 -115
  267. data/test/unit/test_revisions.rb +436 -444
  268. data/test/unit/test_schema.rb +339 -309
  269. data/test/unit/test_search.rb +577 -574
  270. data/test/unit/test_serialisation.rb +136 -147
  271. data/test/unit/test_site.rb +252 -227
  272. data/test/unit/test_skeptick.rb +130 -0
  273. data/test/unit/test_storage.rb +46 -40
  274. data/test/unit/test_structure.rb +57 -66
  275. data/test/unit/test_styles.rb +104 -104
  276. data/test/unit/test_templates.rb +72 -57
  277. data/test/unit/test_type_hierarchy.rb +15 -16
  278. data/test/unit/test_visibility.rb +239 -257
  279. metadata +455 -326
  280. data/application/js/vendor/JS.Class-2.1.5/CHANGELOG +0 -283
  281. data/application/js/vendor/JS.Class-2.1.5/MIT-LICENSE +0 -30
  282. data/application/js/vendor/JS.Class-2.1.5/README +0 -30
  283. data/application/js/vendor/JS.Class-2.1.5/min/command.js +0 -1
  284. data/application/js/vendor/JS.Class-2.1.5/min/comparable.js +0 -1
  285. data/application/js/vendor/JS.Class-2.1.5/min/constant_scope.js +0 -1
  286. data/application/js/vendor/JS.Class-2.1.5/min/decorator.js +0 -1
  287. data/application/js/vendor/JS.Class-2.1.5/min/enumerable.js +0 -1
  288. data/application/js/vendor/JS.Class-2.1.5/min/forwardable.js +0 -1
  289. data/application/js/vendor/JS.Class-2.1.5/min/hash.js +0 -1
  290. data/application/js/vendor/JS.Class-2.1.5/min/linked_list.js +0 -1
  291. data/application/js/vendor/JS.Class-2.1.5/min/loader.js +0 -1
  292. data/application/js/vendor/JS.Class-2.1.5/min/method_chain.js +0 -1
  293. data/application/js/vendor/JS.Class-2.1.5/min/observable.js +0 -1
  294. data/application/js/vendor/JS.Class-2.1.5/min/package.js +0 -1
  295. data/application/js/vendor/JS.Class-2.1.5/min/proxy.js +0 -1
  296. data/application/js/vendor/JS.Class-2.1.5/min/ruby.js +0 -1
  297. data/application/js/vendor/JS.Class-2.1.5/min/set.js +0 -1
  298. data/application/js/vendor/JS.Class-2.1.5/min/stack_trace.js +0 -1
  299. data/application/js/vendor/JS.Class-2.1.5/min/state.js +0 -1
  300. data/application/js/vendor/JS.Class-2.1.5/min/stdlib.js +0 -16
  301. data/application/js/vendor/jquery-1.6.2.min.js +0 -18
  302. data/application/js/vendor/jquery-ui-1.8.16.custom.min.js +0 -791
  303. data/application/js/vendor/jquery-ui-1.8.9.custom.min.js +0 -415
  304. data/application/static/font/fontawesome-webfont-5c5c21100a346972a82c34c5e96ffcfe.ttf +0 -0
  305. data/application/static/select-arrow-6e7dd3745b00e934b0d7a3250c46558b.png +0 -0
  306. data/bin/limit-upload +0 -5
  307. data/bin/unlimit-upload +0 -3
  308. data/lib/spontaneous/asset/file.rb +0 -25
  309. data/lib/spontaneous/asset/source.rb +0 -28
  310. data/lib/spontaneous/image_size.rb +0 -123
  311. data/lib/spontaneous/output/assets/compression.rb +0 -58
  312. data/lib/spontaneous/output/assets.rb +0 -32
  313. data/lib/spontaneous/rack/around_back.rb +0 -20
  314. data/lib/spontaneous/rack/around_front.rb +0 -27
  315. data/lib/spontaneous/rack/around_preview.rb +0 -22
  316. data/lib/spontaneous/rack/assets.rb +0 -126
  317. data/lib/spontaneous/rack/authentication.rb +0 -20
  318. data/lib/spontaneous/rack/cookie_authentication.rb +0 -38
  319. data/lib/spontaneous/rack/helpers.rb +0 -52
  320. data/lib/spontaneous/rack/http.rb +0 -18
  321. data/lib/spontaneous/rack/media.rb +0 -30
  322. data/lib/spontaneous/rack/query_authentication.rb +0 -35
  323. data/lib/spontaneous/rack/reloader.rb +0 -45
  324. data/lib/spontaneous/rack/user_helpers.rb +0 -28
  325. /data/{README → application/js/field/markdown/text_command.js} +0 -0
  326. /data/application/js/vendor/{JS.Class-2.1.5/min/core.js → js.class-2.1.5.min.js} +0 -0
  327. /data/test/fixtures/assets/public1/css/{a.scss → a.css.scss} +0 -0
  328. /data/{lib/spontaneous/generators/site/public/css/site.scss → test/fixtures/assets/public1/x.css} +0 -0
  329. /data/{lib/spontaneous/generators/site/public/js/.empty_directory → test/fixtures/assets/public1/x.png} +0 -0
  330. /data/test/fixtures/assets/public2/css/{b.scss → b.css.scss} +0 -0
  331. /data/test/fixtures/assets/public2/js/{n.coffee → n.js.coffee} +0 -0
  332. /data/test/fixtures/back/{public → assets}/css/sass_include.scss +0 -0
  333. /data/test/fixtures/back/{public → assets}/css/sass_template.scss +0 -0
  334. /data/test/fixtures/back/{public → assets}/js/coffeescript.coffee +0 -0
  335. /data/{lib/spontaneous/generators/site/public/js/site.js → test/fixtures/templates/aliases/aa_alias.html.cut} +0 -0
@@ -3,18 +3,18 @@
3
3
  require File.expand_path('../../test_helper', __FILE__)
4
4
 
5
5
 
6
- class BoxesTest < MiniTest::Spec
6
+ describe "Boxes" do
7
7
 
8
- def setup
8
+ before do
9
9
  @site = setup_site
10
10
  end
11
11
 
12
- def teardown
12
+ after do
13
13
  teardown_site
14
14
  end
15
15
 
16
- context "Box definitions" do
17
- setup do
16
+ describe "Box definitions" do
17
+ before do
18
18
 
19
19
  class ::MyBoxClass < Box; end
20
20
  class ::MyContentClass < Piece; end
@@ -22,147 +22,147 @@ class BoxesTest < MiniTest::Spec
22
22
  MyContentClass.field :description
23
23
  end
24
24
 
25
- teardown do
25
+ after do
26
26
  Object.send(:remove_const, :MyContentClass2) rescue nil
27
27
  Object.send(:remove_const, :MyContentClass) rescue nil
28
28
  Object.send(:remove_const, :MyBoxClass) rescue nil
29
29
  end
30
30
 
31
- should "start empty" do
32
- MyContentClass.boxes.length.should == 0
31
+ it "start empty" do
32
+ MyContentClass.boxes.length.must_equal 0
33
33
  end
34
34
 
35
- should "have a flag showing there are no defined boxes" do
36
- MyContentClass.has_boxes?.should be_false
35
+ it "have a flag showing there are no defined boxes" do
36
+ refute MyContentClass.has_boxes?
37
37
  end
38
38
 
39
- should "be definable with a name" do
39
+ it "be definable with a name" do
40
40
  MyContentClass.box :images0
41
- MyContentClass.boxes.length.should == 1
42
- MyContentClass.boxes.first.name.should == :images0
43
- MyContentClass.has_boxes?.should be_true
41
+ MyContentClass.boxes.length.must_equal 1
42
+ MyContentClass.boxes.first.name.must_equal :images0
43
+ assert MyContentClass.has_boxes?
44
44
  end
45
45
 
46
- should "have a boolean test for emptiness" do
46
+ it "have a boolean test for emptiness" do
47
47
  MyContentClass.box :images0
48
48
  instance = MyContentClass.new
49
- instance.images0.empty?.should be_true
49
+ assert instance.images0.empty?
50
50
  instance.images0 << MyContentClass.new
51
- instance.images0.empty?.should be_false
51
+ refute instance.images0.empty?
52
52
  end
53
53
 
54
- should "always return a symbol for the name" do
54
+ it "always return a symbol for the name" do
55
55
  MyContentClass.box 'images0'
56
- MyContentClass.boxes.first.name.should == :images0
56
+ MyContentClass.boxes.first.name.must_equal :images0
57
57
  end
58
58
 
59
- should "create a method of the same name" do
59
+ it "create a method of the same name" do
60
60
  MyContentClass.box :images1
61
61
  MyContentClass.box :images2, :type => :MyBoxClass
62
62
  instance = MyContentClass.new
63
- instance.images1.class.superclass.should == Box
64
- instance.images2.class.superclass.should == MyBoxClass
63
+ instance.images1.class.superclass.must_equal Box
64
+ instance.images2.class.superclass.must_equal MyBoxClass
65
65
  end
66
66
 
67
- should "be available by name" do
67
+ it "be available by name" do
68
68
  MyContentClass.box :images1
69
69
  MyContentClass.box :images2, :type => :MyBoxClass
70
- MyContentClass.boxes[:images1].should == MyContentClass.boxes.first
71
- MyContentClass.boxes[:images2].should == MyContentClass.boxes.last
70
+ MyContentClass.boxes[:images1].must_equal MyContentClass.boxes.first
71
+ MyContentClass.boxes[:images2].must_equal MyContentClass.boxes.last
72
72
  instance = MyContentClass.new
73
- instance.boxes[:images1].class.superclass.should == Box
74
- instance.boxes[:images2].class.superclass.should == MyBoxClass
73
+ instance.boxes[:images1].class.superclass.must_equal Box
74
+ instance.boxes[:images2].class.superclass.must_equal MyBoxClass
75
75
  end
76
76
 
77
- should "accept a custom instance class" do
77
+ it "accept a custom instance class" do
78
78
  MyContentClass.box :images1, :type => MyBoxClass
79
- MyContentClass.boxes.first.instance_class.superclass.should == MyBoxClass
79
+ MyContentClass.boxes.first.instance_class.superclass.must_equal MyBoxClass
80
80
  end
81
81
 
82
- should "accept a custom instance class as a string" do
82
+ it "accept a custom instance class as a string" do
83
83
  MyContentClass.box :images1, :type => 'MyBoxClass'
84
- MyContentClass.boxes.first.instance_class.superclass.should == MyBoxClass
84
+ MyContentClass.boxes.first.instance_class.superclass.must_equal MyBoxClass
85
85
  end
86
86
 
87
- should "accept a custom instance class as a symbol" do
87
+ it "accept a custom instance class as a symbol" do
88
88
  MyContentClass.box :images1, :type => :MyBoxClass
89
- MyContentClass.boxes.first.instance_class.superclass.should == MyBoxClass
89
+ MyContentClass.boxes.first.instance_class.superclass.must_equal MyBoxClass
90
90
  end
91
91
 
92
- should "Instantiate a box of the correct class" do
92
+ it "Instantiate a box of the correct class" do
93
93
  MyContentClass.box :images1
94
94
  MyContentClass.box :images2, :type => :MyBoxClass
95
95
  instance = MyContentClass.new
96
- instance.boxes.first.class.superclass.should == Box
97
- instance.boxes.last.class.superclass.should == MyBoxClass
96
+ instance.boxes.first.class.superclass.must_equal Box
97
+ instance.boxes.last.class.superclass.must_equal MyBoxClass
98
98
  end
99
99
 
100
- should "give access to the prototype within the instance" do
100
+ it "give access to the prototype within the instance" do
101
101
  MyContentClass.box :images1
102
102
  instance = MyContentClass.new
103
- instance.boxes[:images1]._prototype.should == MyContentClass.boxes[:images1]
103
+ instance.boxes[:images1]._prototype.must_equal MyContentClass.boxes[:images1]
104
104
  end
105
105
 
106
- should "Use the name as the title by default" do
106
+ it "Use the name as the title by default" do
107
107
  MyContentClass.box :band_and_band
108
108
  MyContentClass.box :related_items
109
- MyContentClass.boxes.first.title.should == "Band & Band"
110
- MyContentClass.boxes.last.title.should == "Related Items"
109
+ MyContentClass.boxes.first.title.must_equal "Band & Band"
110
+ MyContentClass.boxes.last.title.must_equal "Related Items"
111
111
  end
112
112
 
113
- should "have 'title' option" do
113
+ it "have 'title' option" do
114
114
  MyContentClass.box :images4, :title => "Custom Title"
115
- MyContentClass.boxes.first.title.should == "Custom Title"
115
+ MyContentClass.boxes.first.title.must_equal "Custom Title"
116
116
  end
117
117
 
118
- should "inherit boxes from superclass" do
118
+ it "inherit boxes from superclass" do
119
119
  MyContentClass.box :images1, :type => :MyBoxClass
120
120
  MyContentClass2.box :images2
121
- MyContentClass2.boxes.length.should == 2
121
+ MyContentClass2.boxes.length.must_equal 2
122
122
  instance = MyContentClass2.new
123
- instance.images1.class.superclass.should == MyBoxClass
124
- instance.images2.class.superclass.should == Box
125
- instance.boxes.length.should == 2
123
+ instance.images1.class.superclass.must_equal MyBoxClass
124
+ instance.images2.class.superclass.must_equal Box
125
+ instance.boxes.length.must_equal 2
126
126
  end
127
127
 
128
- should "know their ordering in the container" do
128
+ it "know their ordering in the container" do
129
129
  MyContentClass.box :box1
130
130
  MyContentClass.box :box2
131
131
  MyContentClass.box :box3
132
132
  MyContentClass.box_order :box3, :box2, :box1
133
- MyContentClass.boxes.box3.position.should == 0
134
- MyContentClass.boxes.box2.position.should == 1
135
- MyContentClass.boxes.box1.position.should == 2
133
+ MyContentClass.boxes.box3.position.must_equal 0
134
+ MyContentClass.boxes.box2.position.must_equal 1
135
+ MyContentClass.boxes.box1.position.must_equal 2
136
136
  instance = MyContentClass.new
137
- instance.box3.position.should == 0
138
- instance.box2.position.should == 1
139
- instance.box1.position.should == 2
137
+ instance.box3.position.must_equal 0
138
+ instance.box2.position.must_equal 1
139
+ instance.box1.position.must_equal 2
140
140
  end
141
141
 
142
- context "instances" do
143
- should "have a connection to their owner" do
142
+ describe "instances" do
143
+ it "have a connection to their owner" do
144
144
  MyContentClass.box :box1
145
145
  instance = MyContentClass.new
146
- instance.box1.owner.should == instance
147
- instance.box1.parent.should == instance
146
+ instance.box1.owner.must_equal instance
147
+ instance.box1.parent.must_equal instance
148
148
  end
149
149
 
150
- should "have a link to their container (which is their owner)" do
150
+ it "have a link to their container (which is their owner)" do
151
151
  MyContentClass.box :box1
152
152
  instance = MyContentClass.new
153
- instance.box1.container.should == instance
154
- instance.box1.container.should == instance
153
+ instance.box1.container.must_equal instance
154
+ instance.box1.container.must_equal instance
155
155
  end
156
156
 
157
- should "return their owner as content_instance" do
157
+ it "return their owner as content_instance" do
158
158
  MyContentClass.box :box1
159
159
  instance = MyContentClass.new
160
- instance.box1.content_instance.should == instance
160
+ instance.box1.content_instance.must_equal instance
161
161
  end
162
162
  end
163
163
 
164
- context "ranges" do
165
- setup do
164
+ describe "ranges" do
165
+ before do
166
166
  MyContentClass.box :images1
167
167
  MyContentClass.box :images2
168
168
  MyContentClass.box :images3
@@ -172,31 +172,23 @@ class BoxesTest < MiniTest::Spec
172
172
  @instance = MyContentClass.new
173
173
  @instance2 = MyContentClass2.new
174
174
  end
175
- should "allow access to groups of boxes through ranges" do
176
- @instance.boxes[1..-2].map { |b| b.box_name }.should == [:images2, :images3, :images4]
177
- @instance2.boxes[1..-2].map { |b| b.box_name }.should == [:images2, :images3, :images4, :images5]
175
+ it "allow access to groups of boxes through ranges" do
176
+ @instance.boxes[1..-2].map { |b| b.box_name }.must_equal [:images2, :images3, :images4]
177
+ @instance2.boxes[1..-2].map { |b| b.box_name }.must_equal [:images2, :images3, :images4, :images5]
178
178
  end
179
179
 
180
- should "allow you to pass a list of names" do
181
- @instance.boxes[:images1, :images4].map { |b| b.box_name }.should == [:images1, :images4]
182
- @instance2.boxes[:images1, :images6].map { |b| b.box_name }.should == [:images1, :images6]
180
+ it "allow you to pass a list of names" do
181
+ @instance.boxes[:images1, :images4].map { |b| b.box_name }.must_equal [:images1, :images4]
182
+ @instance2.boxes[:images1, :images6].map { |b| b.box_name }.must_equal [:images1, :images6]
183
183
  end
184
184
 
185
- should "allow a mix of names and indexes" do
186
- @instance.boxes[0..2, :images5].map { |b| b.box_name }.should == [:images1, :images2, :images3, :images5]
185
+ it "allow a mix of names and indexes" do
186
+ @instance.boxes[0..2, :images5].map { |b| b.box_name }.must_equal [:images1, :images2, :images3, :images5]
187
187
  end
188
- should "allow access to groups of boxes through tags"
189
- # MyContentClass.box :images5, :tag => :main
190
- # MyContentClass.box :posts, :tag => :main
191
- # MyContentClass.box :comments
192
- # MyContentClass.box :last, :tag => :main
193
- # @instance = MyBoxClass.new
194
- # @instance.boxes.tagged(:main).length.should == 3
195
- # @instance.boxes.tagged('main').map {|e| e.name }.should == [:images5, :posts, :last]
196
- # end
197
188
  end
198
- context "with superclasses" do
199
- setup do
189
+
190
+ describe "with superclasses" do
191
+ before do
200
192
  MyContentClass.box :images6, :tag => :main
201
193
 
202
194
  @subclass1 = Class.new(MyContentClass) do
@@ -207,36 +199,34 @@ class BoxesTest < MiniTest::Spec
207
199
  box :peanuts
208
200
  end
209
201
  end
210
- should "inherit boxes from its superclass" do
211
- @subclass2.boxes.length.should == 4
212
- @subclass2.boxes.map { |s| s.name }.should == [:images6, :monkeys, :apes, :peanuts]
213
- # @subclass2.boxes.tagged(:main).length.should == 2
202
+ it "inherit boxes from its superclass" do
203
+ @subclass2.boxes.length.must_equal 4
204
+ @subclass2.boxes.map { |s| s.name }.must_equal [:images6, :monkeys, :apes, :peanuts]
205
+ # @subclass2.boxes.tagged(:main).length.must_equal 2
214
206
  instance = @subclass2.new
215
- instance.boxes.length.should == 4
207
+ instance.boxes.length.must_equal 4
216
208
  end
217
209
 
218
- should "allow customisation of the box order" do
210
+ it "allow customisation of the box order" do
219
211
  new_order = [:peanuts, :apes, :images6, :monkeys]
220
212
  @subclass2.box_order *new_order
221
- @subclass2.boxes.map { |s| s.name }.should == new_order
213
+ @subclass2.boxes.map { |s| s.name }.must_equal new_order
222
214
  end
223
215
 
224
- should "take order of instance boxes from class defn" do
216
+ it "take order of instance boxes from class defn" do
225
217
  new_order = [:peanuts, :apes, :images6, :monkeys]
226
218
  @subclass2.box_order *new_order
227
219
  instance = @subclass2.new
228
- instance.boxes.map { |e| e.box_name.to_sym }.should == new_order
220
+ instance.boxes.map { |e| e.box_name.to_sym }.must_equal new_order
229
221
  end
230
222
  end
231
223
 
232
-
233
-
234
- should "accept values for the box's fields"
235
- should "allow overwriting of class definitions using a block"
224
+ it "accept values for the box's fields"
225
+ it "allow overwriting of class definitions using a block"
236
226
  end
237
227
 
238
- context "Box classes" do
239
- setup do
228
+ describe "Box classes" do
229
+ before do
240
230
  @site.stubs(:template_root).returns(File.expand_path('../../fixtures/templates/boxes', __FILE__))
241
231
  class ::MyContentClass < ::Piece; end
242
232
  class ::MyBoxClass < Box; end
@@ -249,35 +239,35 @@ class BoxesTest < MiniTest::Spec
249
239
  @content = MyContentClass.new
250
240
  end
251
241
 
252
- teardown do
242
+ after do
253
243
  Object.send(:remove_const, :MyContentClass) rescue nil
254
244
  Object.send(:remove_const, :MyBoxClass) rescue nil
255
245
  end
256
246
 
257
- should "have fields" do
258
- MyBoxClass.fields.length.should == 2
247
+ it "have fields" do
248
+ MyBoxClass.fields.length.must_equal 2
259
249
  MyBoxClass.field :another, :string
260
- MyBoxClass.fields.length.should == 3
250
+ MyBoxClass.fields.length.must_equal 3
261
251
  end
262
252
 
263
- context "with fields" do
253
+ describe "with fields" do
264
254
 
265
- should "save their field values" do
255
+ it "save their field values" do
266
256
  @content.images.title = "something"
267
257
  @content.images.description = "description here"
268
258
  @content.save
269
259
  @content.reload
270
- @content.images.title.value.should == "something"
271
- @content.images.description.value.should == "description here"
260
+ @content.images.title.value.must_equal "something"
261
+ @content.images.description.value.must_equal "description here"
272
262
  end
273
263
 
274
- should "take initial values from box definition" do
275
- @content.images.title.value.should == "Default Title"
276
- @content.images.description.value.should == "Default Description"
264
+ it "take initial values from box definition" do
265
+ @content.images.title.value.must_equal "Default Title"
266
+ @content.images.description.value.must_equal "Default Description"
277
267
  end
278
268
  end
279
269
 
280
- should "allow inline definition of fields" do
270
+ it "allow inline definition of fields" do
281
271
  MyContentClass.box :partners do
282
272
  field :name, :string
283
273
  field :logo, :image
@@ -289,16 +279,16 @@ class BoxesTest < MiniTest::Spec
289
279
  instance.partners.description = "Here is Howard"
290
280
  instance.save
291
281
  instance = Content[instance.id]
292
- instance.partners.name.value.should == "Howard"
293
- instance.partners.description.value.should == "Here is Howard"
282
+ instance.partners.name.value.must_equal "Howard"
283
+ instance.partners.description.value.must_equal "Here is Howard"
294
284
  end
295
285
 
296
286
  # true?
297
- should "default to template in root with the same name"
287
+ it "default to template in root with the same name"
298
288
  end
299
289
 
300
- context "Box content" do
301
- setup do
290
+ describe "Box content" do
291
+ before do
302
292
  class ::BlankContent < ::Piece; end
303
293
  class ::StyledContent < ::Piece; end
304
294
 
@@ -319,38 +309,38 @@ class BoxesTest < MiniTest::Spec
319
309
  @parent = BlankContent.new
320
310
  end
321
311
 
322
- teardown do
312
+ after do
323
313
  Object.send(:remove_const, :BlankContent) rescue nil
324
314
  Object.send(:remove_const, :StyledContent) rescue nil
325
315
  end
326
316
 
327
- should "be addable" do
317
+ it "be addable" do
328
318
  child1 = BlankContent.new
329
319
  child2 = BlankContent.new
330
320
  child3 = BlankContent.new
331
321
  @parent.images << child1
332
322
  @parent.words << child2
333
- child1.box.schema_id.should == @parent.images.schema_id
334
- child2.box.schema_id.should == @parent.words.schema_id
323
+ child1.box.schema_id.must_equal @parent.images.schema_id
324
+ child2.box.schema_id.must_equal @parent.words.schema_id
335
325
  @parent.save
336
326
  child1.images << child3
337
327
  child1.save
338
328
  @parent = Content[@parent.id]
339
329
  child1.reload; child2.reload; child3.reload
340
- @parent.images.contents.should == [child1]
341
- @parent.images.contents.should == [child1]
342
- @parent.words.contents.should == [child2]
343
- @parent.words.contents.should == [child2]
344
- @parent.contents.should == [child1, child2]
345
- child1.images.contents.should == [child3]
346
- child1.contents.should == [child3]
330
+ @parent.images.contents.must_equal [child1]
331
+ @parent.images.contents.must_equal [child1]
332
+ @parent.words.contents.must_equal [child2]
333
+ @parent.words.contents.must_equal [child2]
334
+ @parent.contents.to_a.must_equal [child1, child2]
335
+ child1.images.contents.must_equal [child3]
336
+ child1.contents.to_a.must_equal [child3]
347
337
 
348
- @parent.images.contents.first.box.should == @parent.images
349
- @parent.words.contents.first.box.should == @parent.words
350
- @parent.contents.first.box.should == @parent.images
338
+ @parent.images.contents.first.box.must_equal @parent.images
339
+ @parent.words.contents.first.box.must_equal @parent.words
340
+ @parent.contents.first.box.must_equal @parent.images
351
341
  end
352
342
 
353
- should "choose correct style" do
343
+ it "choose correct style" do
354
344
  styled = StyledContent.new
355
345
  child1 = BlankContent.new
356
346
  child2 = BlankContent.new
@@ -360,11 +350,11 @@ class BoxesTest < MiniTest::Spec
360
350
  styled.save
361
351
  styled = Content.get styled.id
362
352
 
363
- styled.one.contents.first.style.name.should == :blank2
364
- styled.two.contents.first.style.name.should == :blank3
353
+ styled.one.contents.first.style.name.must_equal :blank2
354
+ styled.two.contents.first.style.name.must_equal :blank3
365
355
  end
366
356
 
367
- should "be insertable at any position" do
357
+ it "be insertable at any position" do
368
358
  BlankContent.box :box3
369
359
  BlankContent.box :box4
370
360
  instance = BlankContent.new
@@ -373,18 +363,17 @@ class BoxesTest < MiniTest::Spec
373
363
  count.times { |n| box << StyledContent.new(:label => n)}
374
364
  end
375
365
  instance.box4.insert(1, StyledContent.new(:label => "a"))
376
- instance.box4.contents.map { |e| e.label }.should == ["0", "a", "1", "2", "3"]
366
+ instance.box4.contents.map { |e| e.label }.must_equal ["0", "a", "1", "2", "3"]
377
367
  instance.box4.insert(5, StyledContent.new(:label => "b"))
378
- instance.box4.contents.map { |e| e.label }.should == ["0", "a", "1", "2", "3", "b"]
368
+ instance.box4.contents.map { |e| e.label }.must_equal ["0", "a", "1", "2", "3", "b"]
379
369
  instance.box3.insert(2, StyledContent.new(:label => "c"))
380
- instance.box3.contents.map { |e| e.label }.should == ["0", "1", "c", "2", "3"]
370
+ instance.box3.contents.map { |e| e.label }.must_equal ["0", "1", "c", "2", "3"]
381
371
  end
382
372
 
383
- should "allow selection of subclasses"
384
373
  end
385
374
 
386
- context "Allowed types" do
387
- setup do
375
+ describe "Allowed types" do
376
+ before do
388
377
  class ::Allowed1 < Content
389
378
  style :frank
390
379
  style :freddy
@@ -424,59 +413,59 @@ class BoxesTest < MiniTest::Spec
424
413
 
425
414
  end
426
415
 
427
- teardown do
416
+ after do
428
417
  [:Parent, :Allowed1, :Allowed11, :Allowed111, :Allowed2, :Allowed3, :Allowed4, :ChildClass, :Allowable, :Mixed].each { |k| Object.send(:remove_const, k) } rescue nil
429
418
  end
430
419
 
431
- should "have a list of allowed types" do
432
- Parent.allowed.length.should == 3
420
+ it "have a list of allowed types" do
421
+ Parent.allowed.length.must_equal 3
433
422
  end
434
423
 
435
- should "have understood the type parameter" do
436
- Parent.allowed[0].instance_class.should == Allowed1
437
- Parent.allowed[1].instance_class.should == Allowed2
438
- Parent.allowed[2].instance_class.should == Allowed3
424
+ it "have understood the type parameter" do
425
+ Parent.allowed[0].instance_class.must_equal Allowed1
426
+ Parent.allowed[1].instance_class.must_equal Allowed2
427
+ Parent.allowed[2].instance_class.must_equal Allowed3
439
428
  end
440
429
 
441
430
  # TODO: decide on whether testing class definitions is a good idea
442
- # should "raise an error when given an invalid type name" do
431
+ # it "raise an error when given an invalid type name" do
443
432
  # lambda { Parent.allow :WhatTheHellIsThis }.must_raise(NameError)
444
433
  # end
445
434
 
446
- should "allow all styles by default" do
447
- Parent.allowed[2].styles(nil).should == Allowed3.styles
435
+ it "allow all styles by default" do
436
+ Parent.allowed[2].styles(nil).must_equal Allowed3.styles
448
437
  end
449
438
 
450
- should "have a list of allowable styles" do
451
- Parent.allowed[1].styles(nil).length.should == 2
452
- Parent.allowed[1].styles(nil).map { |s| s.name }.should == [:ringo, :george]
439
+ it "have a list of allowable styles" do
440
+ Parent.allowed[1].styles(nil).length.must_equal 2
441
+ Parent.allowed[1].styles(nil).map { |s| s.name }.must_equal [:ringo, :george]
453
442
  end
454
443
 
455
444
  # TODO: decide on whether verifying style names is a good idea
456
- # should "raise an error if we try to use an unknown style" do
445
+ # it "raise an error if we try to use an unknown style" do
457
446
  # lambda { Parent.allow :Allowed3, :styles => [:merlin, :arthur] }.must_raise(Spontaneous::UnknownStyleException)
458
447
  # end
459
448
 
460
- should "use a configured style when adding a defined allowed type" do
449
+ it "use a configured style when adding a defined allowed type" do
461
450
  a = Allowable.new
462
451
  b = Allowed2.new
463
452
  a.parents << b
464
- a.parents.contents.first.style.prototype.should == Allowed2.styles[:ringo]
453
+ a.parents.contents.first.style.prototype.must_equal Allowed2.styles[:ringo]
465
454
  end
466
455
 
467
- should "know what the available styles are for an entry" do
456
+ it "know what the available styles are for an entry" do
468
457
  a = Allowable.new
469
458
  b = Allowed2.new
470
459
  c = Allowed3.new
471
460
  a.parents << b
472
461
  a.parents << c
473
- a.parents.available_styles(b).map { |s| s.name }.should == [:ringo, :george]
474
- a.parents.available_styles(c).map { |s| s.name }.should == [:arthur, :lancelot]
462
+ a.parents.available_styles(b).map { |s| s.name }.must_equal [:ringo, :george]
463
+ a.parents.available_styles(c).map { |s| s.name }.must_equal [:arthur, :lancelot]
475
464
  end
476
465
 
477
- should "inherit allowed types from superclass" do
478
- ChildClass.allowed.should == Parent.allowed
479
- Allowable.boxes.parents.allowed_types(nil).should == [Allowed1, Allowed2, Allowed3]
466
+ it "inherit allowed types from superclass" do
467
+ ChildClass.allowed.must_equal Parent.allowed
468
+ Allowable.boxes.parents.allowed_types(nil).must_equal [Allowed1, Allowed2, Allowed3]
480
469
  class ::AChild < Allowable
481
470
  box :parents do
482
471
  allow :Allowed11
@@ -488,47 +477,47 @@ class BoxesTest < MiniTest::Spec
488
477
  end
489
478
  end
490
479
  box = AChild.boxes.parents
491
- box.allowed_types(nil).should == [Allowed1, Allowed2, Allowed3, Allowed11]
480
+ box.allowed_types(nil).must_equal [Allowed1, Allowed2, Allowed3, Allowed11]
492
481
  box = AChild2.boxes.parents
493
- box.title.should == "Things"
494
- box.allowed_types(nil).should == [Allowed1, Allowed2, Allowed3, Allowed11, Allowed111]
482
+ box.title.must_equal "Things"
483
+ box.allowed_types(nil).must_equal [Allowed1, Allowed2, Allowed3, Allowed11, Allowed111]
495
484
  Object.send(:remove_const, :AChild) rescue nil
496
485
  Object.send(:remove_const, :AChild2) rescue nil
497
486
  end
498
487
 
499
- should "include a subtype's allowed list as well as the supertype's" do
488
+ it "include a subtype's allowed list as well as the supertype's" do
500
489
  ChildClass.allow :Allowed4
501
- ChildClass.allowed.map {|a| a.instance_class }.should == (Parent.allowed.map {|a| a.instance_class } + [Allowed4])
490
+ ChildClass.allowed.map {|a| a.instance_class }.must_equal (Parent.allowed.map {|a| a.instance_class } + [Allowed4])
502
491
  end
503
492
 
504
- should "propagate allowed types to slots" do
493
+ it "propagate allowed types to slots" do
505
494
  instance = Allowable.new
506
- instance.parents.allowed_types.should == Parent.allowed_types
495
+ instance.parents.allowed_types.must_equal Parent.allowed_types
507
496
  end
508
497
 
509
- should "correctly allow addition of subclasses" do
510
- Mixed.allowed_types.should == [Allowed11, Allowed111]
498
+ it "correctly allow addition of subclasses" do
499
+ Mixed.allowed_types.must_equal [Allowed11, Allowed111]
511
500
  end
512
501
 
513
- should "create inline classes if passed a definition block" do
502
+ it "create inline classes if passed a definition block" do
514
503
  allowed = ChildClass.allow :InlineType do
515
504
  field :title
516
505
  end
517
506
  inline_type = allowed.instance_class
518
- inline_type.fields.length.should == 1
519
- inline_type.fields.first.name.should == :title
520
- inline_type.name.should == "ChildClass::InlineType"
507
+ inline_type.fields.length.must_equal 1
508
+ inline_type.fields.first.name.must_equal :title
509
+ inline_type.name.must_equal "ChildClass::InlineType"
521
510
  end
522
511
 
523
- should "use the given supertype for inline classes" do
512
+ it "use the given supertype for inline classes" do
524
513
  allowed = ChildClass.allow :InlineType, :supertype => :Allowed1 do
525
514
  field :title
526
515
  end
527
516
  inline_type = allowed.instance_class
528
- inline_type.ancestors[0..1].should == [ChildClass::InlineType, Allowed1]
517
+ inline_type.ancestors[0..1].must_equal [ChildClass::InlineType, Allowed1]
529
518
  end
530
519
 
531
- should "add the created class to the schema immediately" do
520
+ it "add the created class to the schema immediately" do
532
521
  allowed = ChildClass.allow :InlineType, :supertype => :Allowed1 do
533
522
  field :title
534
523
  end
@@ -536,8 +525,8 @@ class BoxesTest < MiniTest::Spec
536
525
  end
537
526
  end
538
527
 
539
- context "Box groups" do
540
- setup do
528
+ describe "Box groups" do
529
+ before do
541
530
  class ::A < ::Piece
542
531
  box_group :inner do
543
532
  box :a
@@ -573,25 +562,36 @@ class BoxesTest < MiniTest::Spec
573
562
  @c.boxes[:f].stubs(:render).with(anything).returns("[f]")
574
563
  end
575
564
 
576
- teardown do
565
+ after do
577
566
  Object.send(:remove_const, :A) rescue nil
578
567
  Object.send(:remove_const, :B) rescue nil
579
568
  Object.send(:remove_const, :C) rescue nil
580
569
  end
581
570
 
582
- should "successfully allocate boxes" do
583
- @a.boxes.inner.render.should == "[a][b]"
584
- @a.boxes.outer.render.should == "[c][d]"
571
+ it "successfully allocate boxes" do
572
+ @a.boxes.inner.must_equal [@a.boxes[:a], @a.boxes[:b]]
573
+ @a.boxes.outer.must_equal [@a.boxes[:c], @a.boxes[:d]]
574
+
575
+ @b.boxes.inner.must_equal [@b.boxes[:a], @b.boxes[:b]]
576
+ @b.boxes.outer.must_equal [@b.boxes[:c], @b.boxes[:d], @b.boxes[:e]]
577
+
578
+ @c.boxes.inner.must_equal [@c.boxes[:a], @c.boxes[:b], @c.boxes[:f]]
579
+ @c.boxes.outer.must_equal [@c.boxes[:c], @c.boxes[:d], @c.boxes[:e]]
580
+ end
581
+
582
+ it "successfully render groups" do
583
+ @a.boxes.inner.render.must_equal "[a][b]"
584
+ @a.boxes.outer.render.must_equal "[c][d]"
585
585
 
586
- @b.boxes.inner.render.should == "[a][b]"
587
- @b.boxes.outer.render.should == "[c][d][e]"
586
+ @b.boxes.inner.render.must_equal "[a][b]"
587
+ @b.boxes.outer.render.must_equal "[c][d][e]"
588
588
 
589
- @c.boxes.inner.render.should == "[a][b][f]"
590
- @c.boxes.outer.render.should == "[c][d][e]"
589
+ @c.boxes.inner.render.must_equal "[a][b][f]"
590
+ @c.boxes.outer.render.must_equal "[c][d][e]"
591
591
  end
592
592
 
593
- should "return an empty array when asking for an unknown box group" do
594
- @a.boxes.group(:nothing).should == []
593
+ it "return an empty array when asking for an unknown box group" do
594
+ @a.boxes.group(:nothing).must_equal []
595
595
  end
596
596
  end
597
597
  end