spontaneous 0.2.0.alpha7 → 0.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. data/Gemfile +10 -4
  2. data/Readme.markdown +1 -1
  3. data/application/css/definitions.css.scss +5 -0
  4. data/application/css/dialogue.css.scss +62 -0
  5. data/application/js/content.js +1 -1
  6. data/application/js/dom.js +1 -1
  7. data/application/js/event_source.js +3 -0
  8. data/application/js/{field_types/date_field.js → field/date.js} +2 -2
  9. data/application/js/{field_types/file_field.js → field/file.js} +2 -2
  10. data/application/js/{field_types/image_field.js → field/image.js} +54 -20
  11. data/application/js/{field_types/long_string_field.js → field/long_string.js} +2 -2
  12. data/application/js/{field_types/markdown_field.js → field/markdown.js} +2 -2
  13. data/application/js/{field_types/select_field.js → field/select.js} +2 -2
  14. data/application/js/{field_types/string_field.js → field/string.js} +21 -7
  15. data/application/js/{field_types/webvideo_field.js → field/webvideo.js} +2 -2
  16. data/application/js/field.js +2 -2
  17. data/application/js/publish.js +99 -19
  18. data/application/js/spontaneous.js +8 -8
  19. data/application/js/top_bar.js +6 -4
  20. data/db/migrations/20130109125023_add_page_publish_lock.rb +17 -0
  21. data/db/migrations/20130111161934_convert_bcrypt_passwords.rb +22 -0
  22. data/db/migrations/20130114120000_create_revision_tables.rb +106 -0
  23. data/db/migrations/20130116220423_add_index_to_archive.rb +9 -0
  24. data/lib/spontaneous/box.rb +53 -18
  25. data/lib/spontaneous/box_style.rb +2 -3
  26. data/lib/spontaneous/change.rb +39 -13
  27. data/lib/spontaneous/cli/fields.rb +29 -0
  28. data/lib/spontaneous/cli/init.rb +2 -2
  29. data/lib/spontaneous/cli/migrate.rb +0 -1
  30. data/lib/spontaneous/cli/server.rb +14 -10
  31. data/lib/spontaneous/cli/site.rb +20 -9
  32. data/lib/spontaneous/cli.rb +8 -6
  33. data/lib/spontaneous/collections/box_set.rb +11 -0
  34. data/lib/spontaneous/collections/field_set.rb +24 -1
  35. data/lib/spontaneous/concern.rb +37 -0
  36. data/lib/spontaneous/config.rb +3 -4
  37. data/lib/spontaneous/crypt/version.rb +130 -0
  38. data/lib/spontaneous/crypt.rb +84 -0
  39. data/lib/spontaneous/data_mapper/content_model/associations.rb +199 -0
  40. data/lib/spontaneous/data_mapper/content_model/column_accessors.rb +52 -0
  41. data/lib/spontaneous/data_mapper/content_model/instance_hooks.rb +34 -0
  42. data/lib/spontaneous/data_mapper/content_model/serialization.rb +54 -0
  43. data/lib/spontaneous/data_mapper/content_model/timestamps.rb +39 -0
  44. data/lib/spontaneous/data_mapper/content_model.rb +343 -0
  45. data/lib/spontaneous/data_mapper/content_table.rb +103 -0
  46. data/lib/spontaneous/data_mapper/dataset.rb +194 -0
  47. data/lib/spontaneous/data_mapper/scope.rb +195 -0
  48. data/lib/spontaneous/data_mapper.rb +161 -0
  49. data/lib/spontaneous/facet.rb +2 -2
  50. data/lib/spontaneous/field/base.rb +418 -0
  51. data/lib/spontaneous/field/date.rb +54 -0
  52. data/lib/spontaneous/{field_version.rb → field/field_version.rb} +1 -1
  53. data/lib/spontaneous/field/file.rb +100 -0
  54. data/lib/spontaneous/{field_types/image_field.rb → field/image.rb} +33 -33
  55. data/lib/spontaneous/{field_types/location_field.rb → field/location.rb} +2 -2
  56. data/lib/spontaneous/{field_types/long_string_field.rb → field/long_string.rb} +3 -3
  57. data/lib/spontaneous/field/markdown.rb +36 -0
  58. data/lib/spontaneous/{field_types/select_field.rb → field/select.rb} +4 -5
  59. data/lib/spontaneous/field/string.rb +17 -0
  60. data/lib/spontaneous/field/update.rb +156 -0
  61. data/lib/spontaneous/field/webvideo.rb +310 -0
  62. data/lib/spontaneous/field.rb +80 -0
  63. data/lib/spontaneous/generators/site/Gemfile.tt +2 -2
  64. data/lib/spontaneous/generators/site/config/environments/development.rb.tt +1 -1
  65. data/lib/spontaneous/generators/site/config/environments/production.rb.tt +1 -1
  66. data/lib/spontaneous/generators/site/lib/content.rb.tt +6 -0
  67. data/lib/spontaneous/generators/site/schema/box.rb.tt +3 -2
  68. data/lib/spontaneous/generators/site/schema/page.rb.tt +3 -1
  69. data/lib/spontaneous/generators/site/schema/piece.rb.tt +3 -1
  70. data/lib/spontaneous/generators/site/templates/layouts/standard.html.cut.tt +3 -1
  71. data/lib/spontaneous/generators/site.rb +4 -3
  72. data/lib/spontaneous/image_size.rb +8 -1
  73. data/lib/spontaneous/layout.rb +5 -1
  74. data/lib/spontaneous/loader.rb +2 -5
  75. data/lib/spontaneous/media/file.rb +11 -2
  76. data/lib/spontaneous/media/temp_file.rb +23 -0
  77. data/lib/spontaneous/media.rb +20 -39
  78. data/lib/spontaneous/{plugins → model/box}/allowed_types.rb +38 -17
  79. data/lib/spontaneous/model/box.rb +18 -0
  80. data/lib/spontaneous/{plugins → model/core}/aliases.rb +10 -14
  81. data/lib/spontaneous/{plugins → model/core}/boxes.rb +2 -2
  82. data/lib/spontaneous/{plugins → model/core}/content_groups.rb +2 -2
  83. data/lib/spontaneous/model/core/editor_class.rb +4 -0
  84. data/lib/spontaneous/{plugins → model/core}/entries.rb +19 -7
  85. data/lib/spontaneous/{plugins → model/core}/entry.rb +3 -3
  86. data/lib/spontaneous/{plugins → model/core}/fields.rb +38 -5
  87. data/lib/spontaneous/{plugins → model/core}/instance_code.rb +2 -2
  88. data/lib/spontaneous/{plugins → model/core}/media.rb +2 -12
  89. data/lib/spontaneous/{plugins → model/core}/modifications.rb +7 -6
  90. data/lib/spontaneous/model/core/page_search.rb +36 -0
  91. data/lib/spontaneous/{plugins → model/core}/permissions.rb +4 -4
  92. data/lib/spontaneous/{plugins → model/core}/prototypes.rb +4 -4
  93. data/lib/spontaneous/{plugins → model/core}/publishing.rb +93 -115
  94. data/lib/spontaneous/{plugins → model/core}/render.rb +2 -2
  95. data/lib/spontaneous/{plugins → model/core}/schema_hierarchy.rb +7 -11
  96. data/lib/spontaneous/model/core/schema_id.rb +65 -0
  97. data/lib/spontaneous/{plugins → model/core}/schema_title.rb +2 -2
  98. data/lib/spontaneous/{plugins → model/core}/serialisation.rb +2 -2
  99. data/lib/spontaneous/{plugins → model/core}/styles.rb +2 -2
  100. data/lib/spontaneous/{plugins → model/core}/supertype.rb +2 -2
  101. data/lib/spontaneous/{plugins → model/core}/visibility.rb +7 -48
  102. data/lib/spontaneous/model/core.rb +143 -0
  103. data/lib/spontaneous/{plugins → model/page}/controllers.rb +3 -3
  104. data/lib/spontaneous/{plugins → model}/page/formats.rb +2 -2
  105. data/lib/spontaneous/{plugins → model/page}/layouts.rb +2 -2
  106. data/lib/spontaneous/model/page/locks.rb +14 -0
  107. data/lib/spontaneous/{plugins → model/page}/page_tree.rb +3 -3
  108. data/lib/spontaneous/{plugins → model/page}/paths.rb +30 -12
  109. data/lib/spontaneous/{plugins → model}/page/request.rb +2 -2
  110. data/lib/spontaneous/{plugins → model/page}/site_map.rb +2 -2
  111. data/lib/spontaneous/model/page/site_timestamps.rb +44 -0
  112. data/lib/spontaneous/{page.rb → model/page.rb} +49 -28
  113. data/lib/spontaneous/{piece.rb → model/piece.rb} +7 -6
  114. data/lib/spontaneous/model.rb +97 -0
  115. data/lib/spontaneous/output/context.rb +1 -1
  116. data/lib/spontaneous/output/format.rb +4 -0
  117. data/lib/spontaneous/output/template/renderer.rb +2 -2
  118. data/lib/spontaneous/output.rb +2 -2
  119. data/lib/spontaneous/page_lock.rb +62 -0
  120. data/lib/spontaneous/page_piece.rb +1 -1
  121. data/lib/spontaneous/permissions/access_key.rb +9 -4
  122. data/lib/spontaneous/permissions/user.rb +19 -9
  123. data/lib/spontaneous/permissions.rb +2 -5
  124. data/lib/spontaneous/plugins/application/facets.rb +1 -2
  125. data/lib/spontaneous/plugins/application/features.rb +1 -1
  126. data/lib/spontaneous/plugins/application/paths.rb +1 -1
  127. data/lib/spontaneous/plugins/application/render.rb +1 -1
  128. data/lib/spontaneous/plugins/application/serialisation.rb +1 -1
  129. data/lib/spontaneous/plugins/application/state.rb +30 -1
  130. data/lib/spontaneous/plugins/application/system.rb +12 -12
  131. data/lib/spontaneous/prototypes/box_prototype.rb +1 -1
  132. data/lib/spontaneous/prototypes/field_prototype.rb +3 -6
  133. data/lib/spontaneous/prototypes/style_prototype.rb +1 -1
  134. data/lib/spontaneous/publishing/immediate.rb +77 -49
  135. data/lib/spontaneous/publishing/revision.rb +355 -0
  136. data/lib/spontaneous/publishing/simultaneous.rb +10 -49
  137. data/lib/spontaneous/publishing.rb +1 -0
  138. data/lib/spontaneous/rack/around_back.rb +1 -1
  139. data/lib/spontaneous/rack/around_front.rb +2 -4
  140. data/lib/spontaneous/rack/around_preview.rb +1 -1
  141. data/lib/spontaneous/rack/back.rb +80 -63
  142. data/lib/spontaneous/rack/cacheable_file.rb +2 -2
  143. data/lib/spontaneous/rack/cookie_authentication.rb +1 -1
  144. data/lib/spontaneous/rack/front.rb +1 -1
  145. data/lib/spontaneous/rack/helpers.rb +8 -9
  146. data/lib/spontaneous/{page_controller.rb → rack/page_controller.rb} +1 -1
  147. data/lib/spontaneous/rack/public.rb +3 -3
  148. data/lib/spontaneous/rack.rb +15 -15
  149. data/lib/spontaneous/schema/uid.rb +4 -1
  150. data/lib/spontaneous/schema.rb +57 -24
  151. data/lib/spontaneous/search/database.rb +12 -1
  152. data/lib/spontaneous/search/index.rb +34 -6
  153. data/lib/spontaneous/search/results.rb +1 -1
  154. data/lib/spontaneous/server.rb +3 -3
  155. data/lib/spontaneous/simultaneous.rb +53 -0
  156. data/lib/spontaneous/{plugins/site → site}/features.rb +2 -2
  157. data/lib/spontaneous/{plugins/site → site}/helpers.rb +2 -3
  158. data/lib/spontaneous/{plugins/site → site}/hooks.rb +2 -2
  159. data/lib/spontaneous/{plugins/site → site}/instance.rb +4 -6
  160. data/lib/spontaneous/{plugins/site → site}/level.rb +2 -2
  161. data/lib/spontaneous/{plugins/site → site}/map.rb +4 -4
  162. data/lib/spontaneous/{plugins/site → site}/paths.rb +2 -2
  163. data/lib/spontaneous/site/publishing.rb +89 -0
  164. data/lib/spontaneous/{plugins/site → site}/schema.rb +4 -4
  165. data/lib/spontaneous/{plugins/site → site}/search.rb +2 -2
  166. data/lib/spontaneous/{plugins/site → site}/selectors.rb +15 -7
  167. data/lib/spontaneous/{plugins/site → site}/state.rb +2 -2
  168. data/lib/spontaneous/{plugins/site → site}/storage.rb +2 -2
  169. data/lib/spontaneous/{plugins/site → site}/url.rb +2 -2
  170. data/lib/spontaneous/site.rb +31 -14
  171. data/lib/spontaneous/state.rb +5 -6
  172. data/lib/spontaneous/style.rb +3 -2
  173. data/lib/spontaneous/utils/database/mysql_dumper.rb +13 -0
  174. data/lib/spontaneous/utils/database/postgres_dumper.rb +5 -0
  175. data/lib/spontaneous/version.rb +1 -1
  176. data/lib/spontaneous.rb +34 -89
  177. data/spontaneous.gemspec +112 -114
  178. data/test/experimental/test_crypt.rb +158 -0
  179. data/test/experimental/test_features.rb +3 -3
  180. data/test/fixtures/example_application/config/environments/development.rb +1 -1
  181. data/test/fixtures/example_application/lib/content.rb +5 -0
  182. data/test/fixtures/example_application/schema/page.rb +2 -1
  183. data/test/fixtures/example_application/schema/piece.rb +3 -2
  184. data/test/fixtures/serialisation/class_hash.yaml.erb +5 -5
  185. data/test/fixtures/serialisation/root_hash.yaml.erb +8 -0
  186. data/test/functional/test_application.rb +12 -1
  187. data/test/functional/test_back.rb +80 -48
  188. data/test/functional/test_front.rb +39 -46
  189. data/test/functional/test_user_manager.rb +3 -9
  190. data/test/javascript/test_markdown.rb +2 -2
  191. data/test/test_helper.rb +78 -23
  192. data/test/unit/test_alias.rb +21 -15
  193. data/test/unit/test_asset_bundler.rb +3 -3
  194. data/test/unit/test_assets.rb +2 -2
  195. data/test/unit/test_async.rb +7 -6
  196. data/test/unit/test_authentication.rb +43 -37
  197. data/test/unit/test_boxes.rb +46 -21
  198. data/test/unit/test_changesets.rb +65 -20
  199. data/test/unit/test_config.rb +9 -9
  200. data/test/unit/test_content.rb +50 -51
  201. data/test/unit/test_content_inheritance.rb +6 -20
  202. data/test/unit/test_datamapper.rb +1330 -0
  203. data/test/unit/test_datamapper_content.rb +214 -0
  204. data/test/unit/test_fields.rb +543 -54
  205. data/test/unit/test_formats.rb +2 -3
  206. data/test/unit/test_generators.rb +6 -6
  207. data/test/unit/test_helpers.rb +1 -1
  208. data/test/unit/test_image_size.rb +10 -5
  209. data/test/unit/test_images.rb +17 -18
  210. data/test/unit/test_layouts.rb +18 -3
  211. data/test/unit/test_media.rb +74 -49
  212. data/test/unit/test_modifications.rb +43 -43
  213. data/test/unit/test_page.rb +7 -10
  214. data/test/unit/test_permissions.rb +3 -10
  215. data/test/unit/test_piece.rb +5 -6
  216. data/test/unit/test_plugins.rb +7 -14
  217. data/test/unit/test_prototypes.rb +3 -3
  218. data/test/unit/test_publishing.rb +49 -27
  219. data/test/unit/test_render.rb +46 -15
  220. data/test/unit/test_revisions.rb +124 -127
  221. data/test/unit/test_schema.rb +53 -58
  222. data/test/unit/test_search.rb +64 -16
  223. data/test/unit/test_serialisation.rb +4 -11
  224. data/test/unit/test_site.rb +11 -12
  225. data/test/unit/test_structure.rb +2 -5
  226. data/test/unit/test_styles.rb +22 -24
  227. data/test/unit/test_type_hierarchy.rb +7 -5
  228. data/test/unit/test_visibility.rb +79 -55
  229. metadata +128 -102
  230. data/lib/sequel/plugins/content_table_inheritance.rb +0 -203
  231. data/lib/sequel/plugins/scoped_table_name.rb +0 -54
  232. data/lib/spontaneous/content.rb +0 -129
  233. data/lib/spontaneous/field_types/date_field.rb +0 -56
  234. data/lib/spontaneous/field_types/field.rb +0 -302
  235. data/lib/spontaneous/field_types/file_field.rb +0 -68
  236. data/lib/spontaneous/field_types/markdown_field.rb +0 -38
  237. data/lib/spontaneous/field_types/string_field.rb +0 -19
  238. data/lib/spontaneous/field_types/webvideo_field.rb +0 -313
  239. data/lib/spontaneous/field_types.rb +0 -38
  240. data/lib/spontaneous/generators/site/lib/site.rb.tt +0 -4
  241. data/lib/spontaneous/plugins/field/editor_class.rb +0 -13
  242. data/lib/spontaneous/plugins/page/site_timestamps.rb +0 -28
  243. data/lib/spontaneous/plugins/page_search.rb +0 -63
  244. data/lib/spontaneous/plugins/schema_id.rb +0 -68
  245. data/lib/spontaneous/plugins/site/publishing.rb +0 -75
  246. data/lib/spontaneous/rack/fiber_pool.rb +0 -26
  247. data/test/unit/test_table_scoping.rb +0 -80
@@ -7,12 +7,11 @@ class FormatsTest < MiniTest::Spec
7
7
  setup do
8
8
  @site = setup_site
9
9
  @site.paths.add :templates, File.expand_path('../../fixtures/outputs/templates', __FILE__)
10
- class Page < Spontaneous::Page; end
11
- class FPage < Page; end
10
+ # class Page < ::Page; end
11
+ class FPage < ::Page; end
12
12
  end
13
13
 
14
14
  teardown do
15
- self.class.send(:remove_const, :Page) rescue nil
16
15
  self.class.send(:remove_const, :FPage) rescue nil
17
16
  teardown_site
18
17
  end
@@ -62,15 +62,16 @@ class GeneratorsTest < MiniTest::Spec
62
62
  end
63
63
  assert_file_exists(site_root, 'schema')
64
64
  assert_file_exists(site_root, 'schema/page.rb')
65
- assert File.read(site_root / 'schema/page.rb') =~ /class Page < Spontaneous::Page/
65
+ assert File.read(site_root / 'schema/page.rb') =~ /class Page < Content::Page/
66
66
  assert_file_exists(site_root, 'schema/piece.rb')
67
67
  assert_file_exists(site_root, 'schema/box.rb')
68
- assert File.read(site_root / 'schema/piece.rb') =~ /class Piece < Spontaneous::Piece/
68
+ assert File.read(site_root / 'schema/piece.rb') =~ /class Piece < Content::Piece/
69
69
  assert_file_exists(site_root, 'public/js')
70
70
  assert_file_exists(site_root, 'public/css')
71
- assert_file_exists(site_root, 'lib/tasks/example_com.rake')
72
- assert_file_exists(site_root, 'lib/site.rb')
73
- assert File.read(site_root / 'lib/site.rb') =~ /class Site < Spontaneous::Site/
71
+ content_rb = File.read(site_root / 'lib/content.rb')
72
+ assert content_rb =~ /class Content < Spontaneous::Model\(:content\)/
73
+ assert content_rb =~ /^Site = Spontaneous\.site\(Content\)/
74
+ assert_file_exists(site_root, 'lib/tasks/site.rake')
74
75
  assert_file_exists(site_root, 'log')
75
76
  assert_file_exists(site_root, 'tmp')
76
77
  assert_file_exists(site_root, 'cache/media')
@@ -78,7 +79,6 @@ class GeneratorsTest < MiniTest::Spec
78
79
  assert_file_exists(site_root, 'cache/revisions')
79
80
  assert_file_exists(site_root, '.gitignore')
80
81
  assert File.read(site_root / '.gitignore') =~ /cache\/\*/
81
- assert File.read(site_root / 'schema/piece.rb') =~ /class Piece < Spontaneous::Piece/
82
82
  end
83
83
 
84
84
  should "specify the current version of spontaneous as the dependency" do
@@ -51,7 +51,7 @@ class HelpersTest < MiniTest::Spec
51
51
  end
52
52
 
53
53
  should "be available during the render step" do
54
- class Page < Spontaneous::Page
54
+ class Page < Content::Page
55
55
  add_output :mobile
56
56
  end
57
57
 
@@ -8,18 +8,23 @@ class ImageSizeTest < MiniTest::Spec
8
8
  @base_dir = File.expand_path(File.join(File.dirname(__FILE__), '../fixtures/images'))
9
9
  @dimensions = [50, 67]
10
10
  end
11
+
11
12
  should "work for PNG24" do
12
- ImageSize.read(File.join(@base_dir, "size.png24")).should == @dimensions
13
+ S::ImageSize.read(File.join(@base_dir, "size.png24")).should == @dimensions
13
14
  end
14
15
  should "work for PNG8" do
15
- ImageSize.read(File.join(@base_dir, "size.png8")).should == @dimensions
16
+ S::ImageSize.read(File.join(@base_dir, "size.png8")).should == @dimensions
16
17
  end
17
18
  should "work for JPG" do
18
- ImageSize.read(File.join(@base_dir, "size.jpg")).should == @dimensions
19
+ S::ImageSize.read(File.join(@base_dir, "size.jpg")).should == @dimensions
19
20
  end
20
21
  should "work for GIF" do
21
- ImageSize.read(File.join(@base_dir, "size.gif")).should == @dimensions
22
+ S::ImageSize.read(File.join(@base_dir, "size.gif")).should == @dimensions
23
+ end
24
+ should "return 0x0 for empty files" do
25
+ Tempfile.open("imagesize") do |file|
26
+ S::ImageSize.read(file).should == [0,0]
27
+ end
22
28
  end
23
29
  end
24
30
  end
25
-
@@ -5,7 +5,7 @@ require File.expand_path('../../test_helper', __FILE__)
5
5
  require 'fog'
6
6
 
7
7
  class ImagesTest < MiniTest::Spec
8
- include Spontaneous
8
+
9
9
  def setup
10
10
  @site = setup_site
11
11
  end
@@ -16,7 +16,7 @@ class ImagesTest < MiniTest::Spec
16
16
 
17
17
  context "Image fields set using absolute values" do
18
18
  setup do
19
- @image = FieldTypes::ImageField.new(:name => "image")
19
+ @image = S::Field::Image.new(:name => "image")
20
20
  end
21
21
  should "accept and not alter URL values" do
22
22
  url = "http://example.com/image.png"
@@ -44,15 +44,14 @@ class ImagesTest < MiniTest::Spec
44
44
  @upload_dir.mkpath
45
45
 
46
46
  @revision = 10
47
- Site.stubs(:working_revision).returns(@revision)
47
+ S::Site.stubs(:working_revision).returns(@revision)
48
48
 
49
49
  @src_image = Pathname.new(File.join(File.dirname(__FILE__), "../fixtures/images/rose.jpg")).realpath
50
50
  @origin_image = @upload_dir + "rose.jpg"
51
- # @origin_image.make_link(@src_image.to_s) unless @origin_image.exist?
52
51
  FileUtils.cp(@src_image.to_s, @origin_image.to_s)
53
52
  @origin_image = @origin_image.realpath.to_s
54
53
 
55
- class ::ResizingImageField < FieldTypes::ImageField
54
+ class ::ResizingImageField < S::Field::Image
56
55
  size :preview do
57
56
  width 200
58
57
  optimize!
@@ -78,7 +77,7 @@ class ImagesTest < MiniTest::Spec
78
77
 
79
78
  ResizingImageField.register
80
79
 
81
- class ::ContentWithImage < Content
80
+ class ::ContentWithImage < ::Content::Piece
82
81
  field :photo, :resizing_image
83
82
  end
84
83
 
@@ -103,11 +102,11 @@ class ImagesTest < MiniTest::Spec
103
102
  end
104
103
 
105
104
  should "create resized versions of the input image" do
106
- ImageSize.read(@image.preview.filepath).should == [200, 267]
107
- ImageSize.read(@image.tall.filepath).should == [150, 200]
108
- ImageSize.read(@image.thumbnail.filepath).should == [38, 50]
109
- ImageSize.read(@image.icon.filepath).should == [50, 50]
110
- ImageSize.read(@image.greyscale.filepath).should == [38, 50]
105
+ S::ImageSize.read(@image.preview.filepath).should == [200, 267]
106
+ S::ImageSize.read(@image.tall.filepath).should == [150, 200]
107
+ S::ImageSize.read(@image.thumbnail.filepath).should == [38, 50]
108
+ S::ImageSize.read(@image.icon.filepath).should == [50, 50]
109
+ S::ImageSize.read(@image.greyscale.filepath).should == [38, 50]
111
110
  end
112
111
 
113
112
  should "preserve new format if processing has altered it" do
@@ -115,7 +114,7 @@ class ImagesTest < MiniTest::Spec
115
114
  end
116
115
  end
117
116
 
118
- context "with optimization xxx" do
117
+ context "with optimization" do
119
118
  should "run jpegoptim" do
120
119
  Spontaneous.expects(:system).with(regexp_matches(/jpegoptim/)).at_least_once
121
120
  Spontaneous.expects(:system).with(regexp_matches(/jpegtran/)).at_least_once
@@ -177,7 +176,7 @@ class ImagesTest < MiniTest::Spec
177
176
  @image.height.should == 533
178
177
  end
179
178
 
180
- should "have access to the original uploaded file through field.original" do
179
+ should "have access to the original uploaded file through field.original xxx" do
181
180
  @image.src.should == "/media/00234/0010/rose.jpg"
182
181
  @image.original.width.should == @image.width
183
182
  @image.original.height.should == @image.height
@@ -187,11 +186,11 @@ class ImagesTest < MiniTest::Spec
187
186
 
188
187
 
189
188
  should "have a 'sizes' config option that generates resized versions" do
190
- assert_same_elements ResizingImageField.size_definitions.keys, [:preview, :thumbnail, :icon, :tall, :greyscale, :reformatted]
189
+ assert_same_elements ResizingImageField.size_definitions.keys, [:__ui__, :preview, :thumbnail, :icon, :tall, :greyscale, :reformatted]
191
190
  end
192
191
 
193
192
  should "serialise attributes" do
194
- serialised = S::FieldTypes.deserialize_field(@image.serialize_db)[:processed_values]
193
+ serialised = S::Field.deserialize_field(@image.serialize_db)[:processed_values]
195
194
  [:preview, :thumbnail, :icon, :tall].each do |size|
196
195
  serialised.key?(size).should be_true
197
196
  serialised[size][:src].should == "/media/00234/0010/rose.#{size}.jpg"
@@ -232,12 +231,12 @@ class ImagesTest < MiniTest::Spec
232
231
  @image.original.filesize.should == @image.filesize
233
232
  end
234
233
  should "have a 'sizes' config option that generates resized versions" do
235
- assert_same_elements @image.class.size_definitions.keys, [:preview, :thumbnail, :icon, :tall, :greyscale, :reformatted]
236
- assert_same_elements @image.class.sizes.keys, [:preview, :thumbnail, :icon, :tall, :greyscale, :reformatted]
234
+ assert_same_elements @image.class.size_definitions.keys, [:__ui__, :preview, :thumbnail, :icon, :tall, :greyscale, :reformatted]
235
+ assert_same_elements @image.class.sizes.keys, [:__ui__, :preview, :thumbnail, :icon, :tall, :greyscale, :reformatted]
237
236
  end
238
237
 
239
238
  should "serialise attributes" do
240
- serialised = S::FieldTypes.deserialize_field(@image.serialize_db)[:processed_values]
239
+ serialised = S::Field.deserialize_field(@image.serialize_db)[:processed_values]
241
240
  [:preview, :thumbnail, :icon, :tall].each do |size|
242
241
  serialised.key?(size).should be_true
243
242
  serialised[size][:src].should == "/media/00234/0010/rose.#{size}.jpg"
@@ -17,13 +17,13 @@ class LayoutsTest < MiniTest::Spec
17
17
  context "layouts" do
18
18
 
19
19
  setup do
20
- class ::LayoutPage < Spontaneous::Page; end
21
- class ::ABoxClass < Spontaneous::Box; end
20
+ class ::LayoutPage < ::Page; end
21
+ class ::ABoxClass < ::Box; end
22
22
  class ::SubPage < LayoutPage; end
23
23
  ABoxClass.style :monkey
24
24
  ABoxClass.style :crazy
25
25
 
26
- class ::SomeContent < Spontaneous::Piece; end
26
+ class ::SomeContent < ::Piece; end
27
27
  end
28
28
 
29
29
  teardown do
@@ -41,6 +41,20 @@ class LayoutsTest < MiniTest::Spec
41
41
  page.render.should == "layouts/standard.html.cut\n"
42
42
  end
43
43
 
44
+ should "use the named template if it exists" do
45
+ layout = @template_root / "layouts/layout_page.html.cut"
46
+ begin
47
+ File.open(layout, "w") do |file|
48
+ file.write("layouts/layout_page.html.cut\n")
49
+ end
50
+ page = LayoutPage.new
51
+ assert_correct_template(page, @template_root / 'layouts/layout_page')
52
+ page.render.should == "layouts/layout_page.html.cut\n"
53
+ ensure
54
+ FileUtils.rm(layout)
55
+ end
56
+ end
57
+
44
58
  should "return the first layout if some are declared but none declared default" do
45
59
  LayoutPage.layout :custom1
46
60
  LayoutPage.layout :custom2
@@ -48,6 +62,7 @@ class LayoutsTest < MiniTest::Spec
48
62
  assert_correct_template(page, @template_root / 'layouts/custom1')
49
63
  page.render.should == "layouts/custom1.html.cut\n"
50
64
  end
65
+
51
66
  should "return the layout declared default" do
52
67
  LayoutPage.layout :custom1
53
68
  LayoutPage.layout :custom2, :default => true
@@ -9,14 +9,14 @@ class MediaTest < MiniTest::Spec
9
9
  end
10
10
 
11
11
  def teardown
12
+ ::Content.delete
12
13
  teardown_site
13
- S::Content.delete
14
14
  end
15
15
 
16
16
  context "Utility methods" do
17
17
  should "be able to sanitise filenames" do
18
18
  filename = "Something with-dodgy 'characters'.many.jpg"
19
- Media.to_filename(filename).should == "Something-with-dodgy-characters.many.jpg"
19
+ S::Media.to_filename(filename).should == "Something-with-dodgy-characters.many.jpg"
20
20
  end
21
21
  end
22
22
 
@@ -45,7 +45,7 @@ class MediaTest < MiniTest::Spec
45
45
  @storage = Spontaneous::Storage::Cloud.new(@aws_credentials, 'media.example.com')
46
46
  @storage.backend.directories.create(:key => @bucket_name)
47
47
  @site.stubs(:storage).with(anything).returns(@storage)
48
- @content = S::Content.create
48
+ @content = ::Piece.create
49
49
  @content.stubs(:id).returns(99)
50
50
  Spontaneous::State.stubs(:revision).returns(853)
51
51
  end
@@ -108,7 +108,7 @@ class MediaTest < MiniTest::Spec
108
108
  @media_dir = Dir.mktmpdir
109
109
  @storage = Spontaneous::Storage::Local.new(@media_dir, '/media')
110
110
  @site.stubs(:storage).with(anything).returns(@storage)
111
- @content = S::Content.create
111
+ @content = ::Piece.create
112
112
  @content.stubs(:id).returns(99)
113
113
  Spontaneous::State.stubs(:revision).returns(853)
114
114
  end
@@ -167,62 +167,87 @@ class MediaTest < MiniTest::Spec
167
167
  end
168
168
  end
169
169
 
170
- context "Content items" do
170
+ context "temporary media items" do
171
171
  setup do
172
- # @media_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../tmp/media"))
173
- # Spontaneous.media_dir = @media_dir
174
- Site.stubs(:working_revision).returns(74)
175
- @instance = Content.new
176
- @instance.stubs(:id).returns(101)
172
+ # Setup cloud storage as default to ensure that the temp files
173
+ # are bypassing this and being written locally
174
+ Fog.mock!
175
+ @bucket_name = "media.example.com"
176
+ @aws_credentials = {
177
+ :provider=>"AWS",
178
+ :aws_secret_access_key=>"SECRET_ACCESS_KEY",
179
+ :aws_access_key_id=>"ACCESS_KEY_ID",
180
+ :public_host => "http://media.example.com"
181
+ }
182
+ cloud = Spontaneous::Storage::Cloud.new(@aws_credentials, 'media.example.com')
183
+ cloud.backend.directories.create(:key => @bucket_name)
184
+ @site.stubs(:storage).with(anything).returns(cloud)
185
+ @media_dir = Dir.mktmpdir
186
+ @storage = Spontaneous::Storage::Local.new(@media_dir, '/media')
187
+ @site.stubs(:local_storage).with(anything).returns(@storage)
188
+ @site.stubs(:default_storage).with(anything).returns(@storage)
189
+ @content = ::Piece.create
190
+ @content.stubs(:id).returns(99)
177
191
  end
178
192
 
179
- should "be able to generate a revision and id based media path" do
180
- @instance.media_filepath("something.jpg").should == File.join(@site.media_dir, "00101/0074/something.jpg")
181
- @instance.media_urlpath("something.jpg").should == "/media/00101/0074/something.jpg"
193
+ should "return an absolute path for the url" do
194
+ file = Spontaneous::Media::TempFile.new(@content, "file name.txt")
195
+ file.url.should == "/media/tmp/00099/file-name.txt"
182
196
  end
183
197
 
184
- context "file manipulation" do
185
- setup do
186
- @tmp_dir = Pathname.new(Spontaneous.media_dir)
187
- @src_image = Pathname.new(File.join(File.dirname(__FILE__), "../fixtures/images/rose.jpg")).realpath
188
- @upload_dir = @tmp_dir + "tmp/1234"
189
- @upload_dir.mkpath
190
- @origin_image = @upload_dir + "rose.jpg"
191
- FileUtils.cp(@src_image.to_s, @origin_image.to_s)
192
- end
198
+ should "place files into its configured root" do
199
+ file = Spontaneous::Media::TempFile.new(@content, "file name.txt")
200
+ file.path.should == File.join(@media_dir, "/tmp/00099/file-name.txt")
201
+ end
193
202
 
194
- teardown do
195
- # (@tmp_dir + "..").rmtree
196
- end
203
+ should "be able to copy a file into place if passed the path of an existing file" do
204
+ file_path = File.join(@media_dir, "/tmp/00099/file-name.txt")
205
+ existing_file = File.expand_path("../../fixtures/images/rose.jpg", __FILE__)
206
+ ::File.exist?(file_path).should be_false
207
+ ::File.exist?(existing_file).should be_true
208
+ file = Spontaneous::Media::TempFile.new(@content, "file name.txt")
209
+ file.copy(existing_file)
210
+ ::File.exist?(file_path).should be_true
211
+ file.source.should == existing_file
212
+ end
197
213
 
198
- should "be able to move a file into the media path" do
199
- @instance.make_media_file(@origin_image)
200
- @origin_image.exist?.should be_true
201
- dest_image = @tmp_dir + "00101/0074/rose.jpg"
202
- dest_image.exist?.should be_true
214
+ should "be able to copy a file into place if passed the handle of an existing file" do
215
+ file_path = File.join(@media_dir, "/tmp/00099/file-name.txt")
216
+ existing_file = File.expand_path("../../fixtures/images/rose.jpg", __FILE__)
217
+ ::File.exist?(file_path).should be_false
218
+ ::File.exist?(existing_file).should be_true
219
+ file = Spontaneous::Media::TempFile.new(@content, "file name.txt")
220
+ File.open(existing_file, 'rb') do |f|
221
+ file.copy(f)
203
222
  end
223
+ ::File.exist?(file_path).should be_true
224
+ file.source.should == existing_file
225
+ end
204
226
 
205
- should "honour the filename parameter when creating media files" do
206
- @instance.make_media_file(@origin_image, 'crysanthemum.jpg')
207
- @origin_image.exist?.should be_true
208
- dest_image = @tmp_dir + "00101/0074/crysanthemum.jpg"
209
- dest_image.exist?.should be_true
227
+ should "provide an open method that writes files to the correct location" do
228
+ file_path = File.join(@media_dir, "/tmp/00099/file-name.txt")
229
+ ::File.exist?(file_path).should be_false
230
+ file = Spontaneous::Media::TempFile.new(@content, "file name.txt")
231
+ content_string = "Hello"
232
+ file.open do |f|
233
+ f.write(content_string)
210
234
  end
235
+ File.read(file_path).should == content_string
236
+ end
237
+ end
211
238
 
212
- should "sanitise filenames" do
213
- origin_image = @upload_dir + "illegal filename!.jpg"
214
- FileUtils.cp(@src_image.to_s, origin_image.to_s)
215
- @instance.make_media_file(origin_image)
216
- dest_image = @tmp_dir + "00101/0074/illegal-filename.jpg"
217
- dest_image.exist?.should be_true
218
- end
219
- should "sanitise custom filenames" do
220
- origin_image = @upload_dir + "rose.jpg"
221
- FileUtils.cp(@src_image.to_s, origin_image.to_s)
222
- @instance.make_media_file(origin_image, "other, 'illegal' filename!.jpg")
223
- dest_image = @tmp_dir + "00101/0074/other-illegal-filename.jpg"
224
- dest_image.exist?.should be_true
225
- end
239
+ context "Content items" do
240
+ setup do
241
+ # @media_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../tmp/media"))
242
+ # Spontaneous.media_dir = @media_dir
243
+ S::Site.stubs(:working_revision).returns(74)
244
+ @instance = ::Piece.new
245
+ @instance.stubs(:id).returns(101)
246
+ end
247
+
248
+ should "be able to generate a revision and id based media path" do
249
+ @instance.media_filepath("something.jpg").should == File.join(@site.media_dir, "00101/0074/something.jpg")
250
+ @instance.media_urlpath("something.jpg").should == "/media/00101/0074/something.jpg"
226
251
  end
227
252
  end
228
253
  end
@@ -21,11 +21,11 @@ class ModificationsTest < MiniTest::Spec
21
21
  # DB.logger = Logger.new($stdout)
22
22
  Content.delete
23
23
 
24
- class Page < Spontaneous::Page
24
+ class Page < ::Page
25
25
  field :title, :string, :default => "New Page"
26
26
  box :things
27
27
  end
28
- class Piece < Spontaneous::Piece
28
+ class Piece < ::Piece
29
29
  box :things
30
30
  end
31
31
 
@@ -79,7 +79,7 @@ class ModificationsTest < MiniTest::Spec
79
79
  should "update modification date of path when page visibility is changed" do
80
80
  now = @now + 100
81
81
  stub_time(now)
82
- c = Page.first
82
+ c = Page.uid("0")
83
83
  (c.modified_at.to_i - @now.to_i).abs.should <= 1
84
84
  c.toggle_visibility!
85
85
  (c.modified_at - now).abs.should <= 1
@@ -136,7 +136,7 @@ class ModificationsTest < MiniTest::Spec
136
136
  page.modified_at.to_i.should == @now.to_i + 3600
137
137
  end
138
138
 
139
- should "not update the parent page's timestamp on addition of a child page" do
139
+ should "not update the parent page's timestamp on addition of a child page yyyy" do
140
140
  stub_time(@now+1000)
141
141
  page = Page.first :uid => "0"
142
142
  page.things << Page.new
@@ -219,7 +219,7 @@ class ModificationsTest < MiniTest::Spec
219
219
  mods = page.pending_modifications(:slug)
220
220
  mods.length.should == 1
221
221
  mod = mods.first
222
- mod.must_be_instance_of Spontaneous::Plugins::Modifications::SlugModification
222
+ mod.must_be_instance_of Spontaneous::Model::Core::Modifications::SlugModification
223
223
  mod.old_value.should == old_slug
224
224
  mod.new_value.should == "changed"
225
225
  mod.created_at.to_i.should == @now.to_i + 3600
@@ -356,7 +356,7 @@ class ModificationsTest < MiniTest::Spec
356
356
  @final_revision = 2
357
357
  Content.delete_revision(@initial_revision) rescue nil
358
358
  Content.delete_revision(@final_revision) rescue nil
359
- S::Content.publish(@initial_revision)
359
+ ::Content.publish(@initial_revision)
360
360
  end
361
361
 
362
362
  teardown do
@@ -370,11 +370,11 @@ class ModificationsTest < MiniTest::Spec
370
370
  old_slug = page.slug
371
371
  page.slug = "changed"
372
372
  page.save
373
- S::Content.publish(@final_revision, [page.id])
374
- S::Content.with_revision(@final_revision) do
373
+ ::Content.publish(@final_revision, [page.id])
374
+ ::Content.with_revision(@final_revision) do
375
375
  %w(1 1.1.1).each do |uid|
376
376
  published_page = Page.first :uid => uid
377
- S::Content.with_editable do
377
+ ::Content.with_editable do
378
378
  editable_page = Page.first :uid => uid
379
379
  published_page.path.should == editable_page.path
380
380
  end
@@ -396,8 +396,8 @@ class ModificationsTest < MiniTest::Spec
396
396
  child_page.slug = "changed-too"
397
397
  child_page.save
398
398
 
399
- S::Content.publish(@final_revision, [page.id])
400
- S::Content.with_revision(@final_revision) do
399
+ ::Content.publish(@final_revision, [page.id])
400
+ ::Content.with_revision(@final_revision) do
401
401
  published = Page.first :uid => "1.0.0"
402
402
  published.path.should == "/changed/#{old_slug}"
403
403
  end
@@ -417,8 +417,8 @@ class ModificationsTest < MiniTest::Spec
417
417
  child_page.slug = "changed-too"
418
418
  child_page.save
419
419
 
420
- S::Content.publish(@final_revision, [child_page.id])
421
- S::Content.with_revision(@final_revision) do
420
+ ::Content.publish(@final_revision, [child_page.id])
421
+ ::Content.with_revision(@final_revision) do
422
422
  published = Page.first :uid => "1.0.0"
423
423
  published.path.should == "/#{old_slug}/changed-too"
424
424
  end
@@ -428,11 +428,11 @@ class ModificationsTest < MiniTest::Spec
428
428
  should "act on visibility modifications" do
429
429
  page = Page.first :uid => "1"
430
430
  page.hide!
431
- S::Content.publish(@final_revision, [page.id])
432
- S::Content.with_revision(@final_revision) do
431
+ ::Content.publish(@final_revision, [page.id])
432
+ ::Content.with_revision(@final_revision) do
433
433
  %w(1 1.1.1).each do |uid|
434
434
  published_page = Page.first :uid => uid
435
- S::Content.with_editable do
435
+ ::Content.with_editable do
436
436
  editable_page = Page.first :uid => uid
437
437
  published_page.hidden?.should == editable_page.hidden?
438
438
  end
@@ -448,9 +448,9 @@ class ModificationsTest < MiniTest::Spec
448
448
  page.things << child_page
449
449
  page.save
450
450
 
451
- S::Content.publish(@final_revision, [child_page.id])
451
+ ::Content.publish(@final_revision, [child_page.id])
452
452
 
453
- S::Content.with_revision(@final_revision) do
453
+ ::Content.with_revision(@final_revision) do
454
454
  published = Page.first :uid => "1.0.0"
455
455
  published.visible?.should be_true
456
456
  published = Page.first :uid => "child"
@@ -466,9 +466,9 @@ class ModificationsTest < MiniTest::Spec
466
466
  page.things << child_page
467
467
  page.save
468
468
 
469
- S::Content.publish(@final_revision, [page.id, child_page.id])
469
+ ::Content.publish(@final_revision, [page.id, child_page.id])
470
470
 
471
- S::Content.with_revision(@final_revision) do
471
+ ::Content.with_revision(@final_revision) do
472
472
  published = Page.first :uid => "child"
473
473
  published.visible?.should be_false
474
474
  end
@@ -484,9 +484,9 @@ class ModificationsTest < MiniTest::Spec
484
484
  child_page.slug = "changed-too"
485
485
  child_page.save
486
486
 
487
- S::Content.publish(@final_revision, [child_page.id])
487
+ ::Content.publish(@final_revision, [child_page.id])
488
488
 
489
- S::Content.with_revision(@final_revision) do
489
+ ::Content.with_revision(@final_revision) do
490
490
  published = Page.first :uid => "1.0.0"
491
491
  published.visible?.should be_true
492
492
  end
@@ -499,7 +499,7 @@ class ModificationsTest < MiniTest::Spec
499
499
  page.things << child_page
500
500
  page.save
501
501
 
502
- S::Content.publish(@final_revision, [page.id, child_page.id])
502
+ ::Content.publish(@final_revision, [page.id, child_page.id])
503
503
 
504
504
  child_page.hidden?.should be_false
505
505
 
@@ -507,9 +507,9 @@ class ModificationsTest < MiniTest::Spec
507
507
 
508
508
  child_page.reload.hidden?.should be_true
509
509
 
510
- S::Content.publish(@final_revision + 1, [page.id])
510
+ ::Content.publish(@final_revision + 1, [page.id])
511
511
 
512
- S::Content.with_revision(@final_revision + 1) do
512
+ ::Content.with_revision(@final_revision + 1) do
513
513
  published = Page.first :uid => "newpage"
514
514
  published.visible?.should be_false
515
515
  end
@@ -524,44 +524,44 @@ class ModificationsTest < MiniTest::Spec
524
524
 
525
525
  child_page.reload.hidden?.should be_true
526
526
 
527
- S::Content.publish(@final_revision, [page.id])
527
+ ::Content.publish(@final_revision, [page.id])
528
528
 
529
- S::Content.with_revision(@final_revision) do
529
+ ::Content.with_revision(@final_revision) do
530
530
  published = Page.first :uid => "1.0.0"
531
531
  published.visible?.should be_false
532
532
  end
533
533
  end
534
534
 
535
- should "maintain correct published visibility for pieces xxx" do
535
+ should "maintain correct published visibility for pieces" do
536
536
  page = Page.first :uid => "1"
537
537
  piece = page.things.first
538
538
  piece.hide!
539
- S::Content.publish(@final_revision, [page.id])
540
- S::Content.with_revision(@final_revision) do
539
+ ::Content.publish(@final_revision, [page.id])
540
+ ::Content.with_revision(@final_revision) do
541
541
  piece = Page.first(:uid => "1").things.first
542
542
  piece.visible?.should be_false
543
543
  end
544
544
 
545
- S::Content.publish(@final_revision+1, [page.id])
545
+ ::Content.publish(@final_revision+1, [page.id])
546
546
 
547
- S::Content.with_revision(@final_revision+1) do
547
+ ::Content.with_revision(@final_revision+1) do
548
548
  piece = Page.first(:uid => "1").things.first
549
549
  piece.visible?.should be_false
550
550
  end
551
551
  end
552
552
 
553
- should "maintain correct published visibility for pages xxx" do
553
+ should "maintain correct published visibility for pages" do
554
554
  page = Page.first :uid => "1.1.1"
555
555
  page.hide!
556
- S::Content.publish(@final_revision, [page.id])
557
- S::Content.with_revision(@final_revision) do
556
+ ::Content.publish(@final_revision, [page.id])
557
+ ::Content.with_revision(@final_revision) do
558
558
  page = Page.first(:uid => "1.1.1")
559
559
  page.visible?.should be_false
560
560
  end
561
561
 
562
- S::Content.publish(@final_revision+1, [page.id])
562
+ ::Content.publish(@final_revision+1, [page.id])
563
563
 
564
- S::Content.with_revision(@final_revision+1) do
564
+ ::Content.with_revision(@final_revision+1) do
565
565
  page = Page.first(:uid => "1.1.1")
566
566
  page.visible?.should be_false
567
567
  end
@@ -574,11 +574,11 @@ class ModificationsTest < MiniTest::Spec
574
574
  page.slug = "changed-again"
575
575
  page.hide!
576
576
 
577
- S::Content.publish(@final_revision, [page.id])
578
- S::Content.with_revision(@final_revision) do
577
+ ::Content.publish(@final_revision, [page.id])
578
+ ::Content.with_revision(@final_revision) do
579
579
  %w(1 1.1.1).each do |uid|
580
580
  published_page = Page.first :uid => uid
581
- S::Content.with_editable do
581
+ ::Content.with_editable do
582
582
  editable_page = Page.first :uid => uid
583
583
  published_page.hidden?.should == editable_page.hidden?
584
584
  published_page.slug.should == editable_page.slug
@@ -592,8 +592,8 @@ class ModificationsTest < MiniTest::Spec
592
592
  page = Page.first(:uid => "1")
593
593
  page.destroy
594
594
  page = Page.first(:uid => "root")
595
- S::Content.publish(@final_revision, [page.id])
596
- S::Content.with_revision(@final_revision) do
595
+ ::Content.publish(@final_revision, [page.id])
596
+ ::Content.with_revision(@final_revision) do
597
597
  %w(1 1.1.1).each do |uid|
598
598
  published_page = Page.first :uid => uid
599
599
  published_page.should be_nil
@@ -607,7 +607,7 @@ class ModificationsTest < MiniTest::Spec
607
607
  page = Page.first :uid => "1"
608
608
  page.slug = "changed"
609
609
  page.hide!
610
- S::Content.publish(@final_revision, [page.id])
610
+ ::Content.publish(@final_revision, [page.id])
611
611
  page = Page.first :id => page.id
612
612
  page.pending_modifications.length.should == 0
613
613
  end