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.
- data/Gemfile +10 -4
- data/Readme.markdown +1 -1
- data/application/css/definitions.css.scss +5 -0
- data/application/css/dialogue.css.scss +62 -0
- data/application/js/content.js +1 -1
- data/application/js/dom.js +1 -1
- data/application/js/event_source.js +3 -0
- data/application/js/{field_types/date_field.js → field/date.js} +2 -2
- data/application/js/{field_types/file_field.js → field/file.js} +2 -2
- data/application/js/{field_types/image_field.js → field/image.js} +54 -20
- data/application/js/{field_types/long_string_field.js → field/long_string.js} +2 -2
- data/application/js/{field_types/markdown_field.js → field/markdown.js} +2 -2
- data/application/js/{field_types/select_field.js → field/select.js} +2 -2
- data/application/js/{field_types/string_field.js → field/string.js} +21 -7
- data/application/js/{field_types/webvideo_field.js → field/webvideo.js} +2 -2
- data/application/js/field.js +2 -2
- data/application/js/publish.js +99 -19
- data/application/js/spontaneous.js +8 -8
- data/application/js/top_bar.js +6 -4
- data/db/migrations/20130109125023_add_page_publish_lock.rb +17 -0
- data/db/migrations/20130111161934_convert_bcrypt_passwords.rb +22 -0
- data/db/migrations/20130114120000_create_revision_tables.rb +106 -0
- data/db/migrations/20130116220423_add_index_to_archive.rb +9 -0
- data/lib/spontaneous/box.rb +53 -18
- data/lib/spontaneous/box_style.rb +2 -3
- data/lib/spontaneous/change.rb +39 -13
- data/lib/spontaneous/cli/fields.rb +29 -0
- data/lib/spontaneous/cli/init.rb +2 -2
- data/lib/spontaneous/cli/migrate.rb +0 -1
- data/lib/spontaneous/cli/server.rb +14 -10
- data/lib/spontaneous/cli/site.rb +20 -9
- data/lib/spontaneous/cli.rb +8 -6
- data/lib/spontaneous/collections/box_set.rb +11 -0
- data/lib/spontaneous/collections/field_set.rb +24 -1
- data/lib/spontaneous/concern.rb +37 -0
- data/lib/spontaneous/config.rb +3 -4
- data/lib/spontaneous/crypt/version.rb +130 -0
- data/lib/spontaneous/crypt.rb +84 -0
- data/lib/spontaneous/data_mapper/content_model/associations.rb +199 -0
- data/lib/spontaneous/data_mapper/content_model/column_accessors.rb +52 -0
- data/lib/spontaneous/data_mapper/content_model/instance_hooks.rb +34 -0
- data/lib/spontaneous/data_mapper/content_model/serialization.rb +54 -0
- data/lib/spontaneous/data_mapper/content_model/timestamps.rb +39 -0
- data/lib/spontaneous/data_mapper/content_model.rb +343 -0
- data/lib/spontaneous/data_mapper/content_table.rb +103 -0
- data/lib/spontaneous/data_mapper/dataset.rb +194 -0
- data/lib/spontaneous/data_mapper/scope.rb +195 -0
- data/lib/spontaneous/data_mapper.rb +161 -0
- data/lib/spontaneous/facet.rb +2 -2
- data/lib/spontaneous/field/base.rb +418 -0
- data/lib/spontaneous/field/date.rb +54 -0
- data/lib/spontaneous/{field_version.rb → field/field_version.rb} +1 -1
- data/lib/spontaneous/field/file.rb +100 -0
- data/lib/spontaneous/{field_types/image_field.rb → field/image.rb} +33 -33
- data/lib/spontaneous/{field_types/location_field.rb → field/location.rb} +2 -2
- data/lib/spontaneous/{field_types/long_string_field.rb → field/long_string.rb} +3 -3
- data/lib/spontaneous/field/markdown.rb +36 -0
- data/lib/spontaneous/{field_types/select_field.rb → field/select.rb} +4 -5
- data/lib/spontaneous/field/string.rb +17 -0
- data/lib/spontaneous/field/update.rb +156 -0
- data/lib/spontaneous/field/webvideo.rb +310 -0
- data/lib/spontaneous/field.rb +80 -0
- data/lib/spontaneous/generators/site/Gemfile.tt +2 -2
- data/lib/spontaneous/generators/site/config/environments/development.rb.tt +1 -1
- data/lib/spontaneous/generators/site/config/environments/production.rb.tt +1 -1
- data/lib/spontaneous/generators/site/lib/content.rb.tt +6 -0
- data/lib/spontaneous/generators/site/schema/box.rb.tt +3 -2
- data/lib/spontaneous/generators/site/schema/page.rb.tt +3 -1
- data/lib/spontaneous/generators/site/schema/piece.rb.tt +3 -1
- data/lib/spontaneous/generators/site/templates/layouts/standard.html.cut.tt +3 -1
- data/lib/spontaneous/generators/site.rb +4 -3
- data/lib/spontaneous/image_size.rb +8 -1
- data/lib/spontaneous/layout.rb +5 -1
- data/lib/spontaneous/loader.rb +2 -5
- data/lib/spontaneous/media/file.rb +11 -2
- data/lib/spontaneous/media/temp_file.rb +23 -0
- data/lib/spontaneous/media.rb +20 -39
- data/lib/spontaneous/{plugins → model/box}/allowed_types.rb +38 -17
- data/lib/spontaneous/model/box.rb +18 -0
- data/lib/spontaneous/{plugins → model/core}/aliases.rb +10 -14
- data/lib/spontaneous/{plugins → model/core}/boxes.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/content_groups.rb +2 -2
- data/lib/spontaneous/model/core/editor_class.rb +4 -0
- data/lib/spontaneous/{plugins → model/core}/entries.rb +19 -7
- data/lib/spontaneous/{plugins → model/core}/entry.rb +3 -3
- data/lib/spontaneous/{plugins → model/core}/fields.rb +38 -5
- data/lib/spontaneous/{plugins → model/core}/instance_code.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/media.rb +2 -12
- data/lib/spontaneous/{plugins → model/core}/modifications.rb +7 -6
- data/lib/spontaneous/model/core/page_search.rb +36 -0
- data/lib/spontaneous/{plugins → model/core}/permissions.rb +4 -4
- data/lib/spontaneous/{plugins → model/core}/prototypes.rb +4 -4
- data/lib/spontaneous/{plugins → model/core}/publishing.rb +93 -115
- data/lib/spontaneous/{plugins → model/core}/render.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/schema_hierarchy.rb +7 -11
- data/lib/spontaneous/model/core/schema_id.rb +65 -0
- data/lib/spontaneous/{plugins → model/core}/schema_title.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/serialisation.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/styles.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/supertype.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/visibility.rb +7 -48
- data/lib/spontaneous/model/core.rb +143 -0
- data/lib/spontaneous/{plugins → model/page}/controllers.rb +3 -3
- data/lib/spontaneous/{plugins → model}/page/formats.rb +2 -2
- data/lib/spontaneous/{plugins → model/page}/layouts.rb +2 -2
- data/lib/spontaneous/model/page/locks.rb +14 -0
- data/lib/spontaneous/{plugins → model/page}/page_tree.rb +3 -3
- data/lib/spontaneous/{plugins → model/page}/paths.rb +30 -12
- data/lib/spontaneous/{plugins → model}/page/request.rb +2 -2
- data/lib/spontaneous/{plugins → model/page}/site_map.rb +2 -2
- data/lib/spontaneous/model/page/site_timestamps.rb +44 -0
- data/lib/spontaneous/{page.rb → model/page.rb} +49 -28
- data/lib/spontaneous/{piece.rb → model/piece.rb} +7 -6
- data/lib/spontaneous/model.rb +97 -0
- data/lib/spontaneous/output/context.rb +1 -1
- data/lib/spontaneous/output/format.rb +4 -0
- data/lib/spontaneous/output/template/renderer.rb +2 -2
- data/lib/spontaneous/output.rb +2 -2
- data/lib/spontaneous/page_lock.rb +62 -0
- data/lib/spontaneous/page_piece.rb +1 -1
- data/lib/spontaneous/permissions/access_key.rb +9 -4
- data/lib/spontaneous/permissions/user.rb +19 -9
- data/lib/spontaneous/permissions.rb +2 -5
- data/lib/spontaneous/plugins/application/facets.rb +1 -2
- data/lib/spontaneous/plugins/application/features.rb +1 -1
- data/lib/spontaneous/plugins/application/paths.rb +1 -1
- data/lib/spontaneous/plugins/application/render.rb +1 -1
- data/lib/spontaneous/plugins/application/serialisation.rb +1 -1
- data/lib/spontaneous/plugins/application/state.rb +30 -1
- data/lib/spontaneous/plugins/application/system.rb +12 -12
- data/lib/spontaneous/prototypes/box_prototype.rb +1 -1
- data/lib/spontaneous/prototypes/field_prototype.rb +3 -6
- data/lib/spontaneous/prototypes/style_prototype.rb +1 -1
- data/lib/spontaneous/publishing/immediate.rb +77 -49
- data/lib/spontaneous/publishing/revision.rb +355 -0
- data/lib/spontaneous/publishing/simultaneous.rb +10 -49
- data/lib/spontaneous/publishing.rb +1 -0
- data/lib/spontaneous/rack/around_back.rb +1 -1
- data/lib/spontaneous/rack/around_front.rb +2 -4
- data/lib/spontaneous/rack/around_preview.rb +1 -1
- data/lib/spontaneous/rack/back.rb +80 -63
- data/lib/spontaneous/rack/cacheable_file.rb +2 -2
- data/lib/spontaneous/rack/cookie_authentication.rb +1 -1
- data/lib/spontaneous/rack/front.rb +1 -1
- data/lib/spontaneous/rack/helpers.rb +8 -9
- data/lib/spontaneous/{page_controller.rb → rack/page_controller.rb} +1 -1
- data/lib/spontaneous/rack/public.rb +3 -3
- data/lib/spontaneous/rack.rb +15 -15
- data/lib/spontaneous/schema/uid.rb +4 -1
- data/lib/spontaneous/schema.rb +57 -24
- data/lib/spontaneous/search/database.rb +12 -1
- data/lib/spontaneous/search/index.rb +34 -6
- data/lib/spontaneous/search/results.rb +1 -1
- data/lib/spontaneous/server.rb +3 -3
- data/lib/spontaneous/simultaneous.rb +53 -0
- data/lib/spontaneous/{plugins/site → site}/features.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/helpers.rb +2 -3
- data/lib/spontaneous/{plugins/site → site}/hooks.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/instance.rb +4 -6
- data/lib/spontaneous/{plugins/site → site}/level.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/map.rb +4 -4
- data/lib/spontaneous/{plugins/site → site}/paths.rb +2 -2
- data/lib/spontaneous/site/publishing.rb +89 -0
- data/lib/spontaneous/{plugins/site → site}/schema.rb +4 -4
- data/lib/spontaneous/{plugins/site → site}/search.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/selectors.rb +15 -7
- data/lib/spontaneous/{plugins/site → site}/state.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/storage.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/url.rb +2 -2
- data/lib/spontaneous/site.rb +31 -14
- data/lib/spontaneous/state.rb +5 -6
- data/lib/spontaneous/style.rb +3 -2
- data/lib/spontaneous/utils/database/mysql_dumper.rb +13 -0
- data/lib/spontaneous/utils/database/postgres_dumper.rb +5 -0
- data/lib/spontaneous/version.rb +1 -1
- data/lib/spontaneous.rb +34 -89
- data/spontaneous.gemspec +112 -114
- data/test/experimental/test_crypt.rb +158 -0
- data/test/experimental/test_features.rb +3 -3
- data/test/fixtures/example_application/config/environments/development.rb +1 -1
- data/test/fixtures/example_application/lib/content.rb +5 -0
- data/test/fixtures/example_application/schema/page.rb +2 -1
- data/test/fixtures/example_application/schema/piece.rb +3 -2
- data/test/fixtures/serialisation/class_hash.yaml.erb +5 -5
- data/test/fixtures/serialisation/root_hash.yaml.erb +8 -0
- data/test/functional/test_application.rb +12 -1
- data/test/functional/test_back.rb +80 -48
- data/test/functional/test_front.rb +39 -46
- data/test/functional/test_user_manager.rb +3 -9
- data/test/javascript/test_markdown.rb +2 -2
- data/test/test_helper.rb +78 -23
- data/test/unit/test_alias.rb +21 -15
- data/test/unit/test_asset_bundler.rb +3 -3
- data/test/unit/test_assets.rb +2 -2
- data/test/unit/test_async.rb +7 -6
- data/test/unit/test_authentication.rb +43 -37
- data/test/unit/test_boxes.rb +46 -21
- data/test/unit/test_changesets.rb +65 -20
- data/test/unit/test_config.rb +9 -9
- data/test/unit/test_content.rb +50 -51
- data/test/unit/test_content_inheritance.rb +6 -20
- data/test/unit/test_datamapper.rb +1330 -0
- data/test/unit/test_datamapper_content.rb +214 -0
- data/test/unit/test_fields.rb +543 -54
- data/test/unit/test_formats.rb +2 -3
- data/test/unit/test_generators.rb +6 -6
- data/test/unit/test_helpers.rb +1 -1
- data/test/unit/test_image_size.rb +10 -5
- data/test/unit/test_images.rb +17 -18
- data/test/unit/test_layouts.rb +18 -3
- data/test/unit/test_media.rb +74 -49
- data/test/unit/test_modifications.rb +43 -43
- data/test/unit/test_page.rb +7 -10
- data/test/unit/test_permissions.rb +3 -10
- data/test/unit/test_piece.rb +5 -6
- data/test/unit/test_plugins.rb +7 -14
- data/test/unit/test_prototypes.rb +3 -3
- data/test/unit/test_publishing.rb +49 -27
- data/test/unit/test_render.rb +46 -15
- data/test/unit/test_revisions.rb +124 -127
- data/test/unit/test_schema.rb +53 -58
- data/test/unit/test_search.rb +64 -16
- data/test/unit/test_serialisation.rb +4 -11
- data/test/unit/test_site.rb +11 -12
- data/test/unit/test_structure.rb +2 -5
- data/test/unit/test_styles.rb +22 -24
- data/test/unit/test_type_hierarchy.rb +7 -5
- data/test/unit/test_visibility.rb +79 -55
- metadata +128 -102
- data/lib/sequel/plugins/content_table_inheritance.rb +0 -203
- data/lib/sequel/plugins/scoped_table_name.rb +0 -54
- data/lib/spontaneous/content.rb +0 -129
- data/lib/spontaneous/field_types/date_field.rb +0 -56
- data/lib/spontaneous/field_types/field.rb +0 -302
- data/lib/spontaneous/field_types/file_field.rb +0 -68
- data/lib/spontaneous/field_types/markdown_field.rb +0 -38
- data/lib/spontaneous/field_types/string_field.rb +0 -19
- data/lib/spontaneous/field_types/webvideo_field.rb +0 -313
- data/lib/spontaneous/field_types.rb +0 -38
- data/lib/spontaneous/generators/site/lib/site.rb.tt +0 -4
- data/lib/spontaneous/plugins/field/editor_class.rb +0 -13
- data/lib/spontaneous/plugins/page/site_timestamps.rb +0 -28
- data/lib/spontaneous/plugins/page_search.rb +0 -63
- data/lib/spontaneous/plugins/schema_id.rb +0 -68
- data/lib/spontaneous/plugins/site/publishing.rb +0 -75
- data/lib/spontaneous/rack/fiber_pool.rb +0 -26
- data/test/unit/test_table_scoping.rb +0 -80
@@ -16,17 +16,16 @@ class ChangeTest < MiniTest::Spec
|
|
16
16
|
|
17
17
|
context "Changes" do
|
18
18
|
setup do
|
19
|
-
@revision = 1
|
20
19
|
stub_time(@now)
|
20
|
+
@revision = 1
|
21
21
|
|
22
|
-
# DB.logger = Logger.new($stdout)
|
23
22
|
Content.delete
|
24
23
|
|
25
|
-
class Page <
|
24
|
+
class Page < ::Page
|
26
25
|
field :title, :string, :default => "New Page"
|
27
26
|
box :things
|
28
27
|
end
|
29
|
-
class Piece <
|
28
|
+
class Piece < ::Piece
|
30
29
|
box :things
|
31
30
|
end
|
32
31
|
end
|
@@ -41,6 +40,15 @@ class ChangeTest < MiniTest::Spec
|
|
41
40
|
end
|
42
41
|
|
43
42
|
|
43
|
+
should "flag if the site has never been published" do
|
44
|
+
root = Page.create(:title => "root")
|
45
|
+
5.times { |i| root.things << Page.create(:title => "Page #{i+1}") }
|
46
|
+
result = S::Change.outstanding
|
47
|
+
assert result.key?(:published_revision)
|
48
|
+
result[:published_revision].should == 0
|
49
|
+
result[:first_publish].should be_true
|
50
|
+
end
|
51
|
+
|
44
52
|
|
45
53
|
should "list all newly created pages" do
|
46
54
|
root = Page.create(:title => "root")
|
@@ -49,13 +57,16 @@ class ChangeTest < MiniTest::Spec
|
|
49
57
|
|
50
58
|
5.times { |i| root.things << Page.create(:title => "Page #{i+1}") }
|
51
59
|
|
52
|
-
result = Change.outstanding
|
53
|
-
result.must_be_instance_of(
|
54
|
-
|
60
|
+
result = S::Change.outstanding
|
61
|
+
result.must_be_instance_of(Hash)
|
62
|
+
|
63
|
+
pages = result[:changes]
|
64
|
+
pages.must_be_instance_of(Array)
|
65
|
+
pages.length.should == 5
|
55
66
|
|
56
|
-
|
67
|
+
pages.map(&:class).should == [S::Change]*5
|
57
68
|
|
58
|
-
Set.new(
|
69
|
+
Set.new(pages.map(&:page_id)).should == Set.new(root.things.map { |p| p.id })
|
59
70
|
end
|
60
71
|
|
61
72
|
should "not list new pieces as available for publish" do
|
@@ -66,7 +77,7 @@ class ChangeTest < MiniTest::Spec
|
|
66
77
|
root[:first_published_at] = root[:last_published_at] = root.modified_at - 1000
|
67
78
|
root.things << Piece.new
|
68
79
|
root.save.reload
|
69
|
-
result = Change.outstanding
|
80
|
+
result = S::Change.outstanding[:changes]
|
70
81
|
result.length.should == 1
|
71
82
|
result.first.page.should == root
|
72
83
|
end
|
@@ -81,7 +92,7 @@ class ChangeTest < MiniTest::Spec
|
|
81
92
|
|
82
93
|
Content.publish(@revision+1, [root.id, root.things.first.id])
|
83
94
|
|
84
|
-
result = Change.outstanding
|
95
|
+
result = S::Change.outstanding[:changes]
|
85
96
|
result.length.should == 4
|
86
97
|
Set.new(result.map(&:page_id).flatten).should == Set.new(root.things[1..-1].map(&:id))
|
87
98
|
end
|
@@ -108,7 +119,7 @@ class ChangeTest < MiniTest::Spec
|
|
108
119
|
|
109
120
|
|
110
121
|
Content.publish(@revision+1, [root.id])
|
111
|
-
result = Change.outstanding
|
122
|
+
result = S::Change.outstanding[:changes]
|
112
123
|
|
113
124
|
result.length.should == 5
|
114
125
|
|
@@ -146,7 +157,7 @@ class ChangeTest < MiniTest::Spec
|
|
146
157
|
|
147
158
|
|
148
159
|
Content.publish(@revision+1, [root.id])
|
149
|
-
result = Change.outstanding
|
160
|
+
result = S::Change.outstanding[:changes]
|
150
161
|
|
151
162
|
e = nil
|
152
163
|
begin
|
@@ -172,7 +183,7 @@ class ChangeTest < MiniTest::Spec
|
|
172
183
|
root.save
|
173
184
|
|
174
185
|
Content.publish(@revision+1, [root.id])
|
175
|
-
result = Change.outstanding
|
186
|
+
result = S::Change.outstanding[:changes]
|
176
187
|
change = result.detect { |change| change.page.id == new_child1.id }
|
177
188
|
change.export.should == {
|
178
189
|
:id => new_child1.id,
|
@@ -183,12 +194,14 @@ class ChangeTest < MiniTest::Spec
|
|
183
194
|
# :editor_login => "someone",
|
184
195
|
:depth => new_child1.depth,
|
185
196
|
:side_effects => {},
|
197
|
+
:update_locks => [],
|
186
198
|
:dependent => [{
|
187
199
|
:id => page1.id,
|
188
200
|
:depth => page1.depth,
|
189
201
|
:title => page1.title.value,
|
190
202
|
:url => page1.path,
|
191
203
|
:side_effects => {},
|
204
|
+
:update_locks => [],
|
192
205
|
:published_at => nil,
|
193
206
|
:modified_at => page1.modified_at.httpdate,
|
194
207
|
}]
|
@@ -207,8 +220,8 @@ class ChangeTest < MiniTest::Spec
|
|
207
220
|
page1.things << new_child1
|
208
221
|
root.save
|
209
222
|
last = Time.now + 100
|
210
|
-
|
211
|
-
result = Change.outstanding
|
223
|
+
::Content.filter(:id => new_child1.id).update(:modified_at => last)
|
224
|
+
result = S::Change.outstanding[:changes]
|
212
225
|
assert result.first.modified_at > result.last.modified_at, "Change list in incorrect order"
|
213
226
|
end
|
214
227
|
|
@@ -225,14 +238,17 @@ class ChangeTest < MiniTest::Spec
|
|
225
238
|
|
226
239
|
Content.publish(@revision)
|
227
240
|
|
241
|
+
later = @now + 10
|
242
|
+
stub_time(later)
|
228
243
|
old_slug = page1.slug
|
229
244
|
page1.slug = "changed"
|
230
245
|
page1.save
|
231
246
|
|
232
|
-
result = Change.outstanding
|
247
|
+
result = S::Change.outstanding[:changes]
|
248
|
+
|
233
249
|
change = result.detect { |change| change.page.id == page1.id }
|
234
250
|
change.export[:side_effects].should == {
|
235
|
-
:slug => [{ :count => 1, :created_at =>
|
251
|
+
:slug => [{ :count => 1, :created_at => later.httpdate, :old_value => old_slug, :new_value => "changed"}]
|
236
252
|
}
|
237
253
|
end
|
238
254
|
|
@@ -249,13 +265,42 @@ class ChangeTest < MiniTest::Spec
|
|
249
265
|
|
250
266
|
Content.publish(@revision)
|
251
267
|
|
268
|
+
later = @now + 10
|
269
|
+
stub_time(later)
|
252
270
|
page1.hide!
|
253
271
|
|
254
|
-
|
272
|
+
page1.reload
|
273
|
+
result = S::Change.outstanding[:changes]
|
255
274
|
change = result.detect { |change| change.page.id == page1.id }
|
256
275
|
change.export[:side_effects].should == {
|
257
|
-
:visibility => [{ :count => 1, :created_at =>
|
276
|
+
:visibility => [{ :count => 1, :created_at => later.httpdate, :old_value => false, :new_value => true}]
|
258
277
|
}
|
259
278
|
end
|
279
|
+
|
280
|
+
should "provide information about any update locks that exist on a page" do
|
281
|
+
Piece.field :async
|
282
|
+
page = Page.create(:title => "page")
|
283
|
+
|
284
|
+
|
285
|
+
piece = Piece.new
|
286
|
+
|
287
|
+
page.things << piece
|
288
|
+
page.save
|
289
|
+
piece.save
|
290
|
+
|
291
|
+
lock = Spontaneous::PageLock.create(:page_id => page.id, :content_id => piece.id, :field_id => piece.async.id, :description => "Update Lock")
|
292
|
+
page.locked_for_update?.should be_true
|
293
|
+
result = S::Change.outstanding[:changes]
|
294
|
+
change = result.detect { |change| change.page.id == page.id }
|
295
|
+
change.export[:update_locks].should == [{
|
296
|
+
id: lock.id,
|
297
|
+
content_id: piece.id,
|
298
|
+
field_id: piece.async.id,
|
299
|
+
field_name: :async,
|
300
|
+
location: "Field ‘async’ of entry 1 in box ‘things’",
|
301
|
+
description: "Update Lock",
|
302
|
+
created_at: @now.httpdate
|
303
|
+
}]
|
304
|
+
end
|
260
305
|
end
|
261
306
|
end
|
data/test/unit/test_config.rb
CHANGED
@@ -33,7 +33,7 @@ class ConfigTest < MiniTest::Spec
|
|
33
33
|
|
34
34
|
context "Config" do
|
35
35
|
setup do
|
36
|
-
@config = Config.new(:development)
|
36
|
+
@config = Spontaneous::Config.new(:development)
|
37
37
|
@config.load(@config_dir)
|
38
38
|
end
|
39
39
|
should "load the first time its accessed" do
|
@@ -44,7 +44,7 @@ class ConfigTest < MiniTest::Spec
|
|
44
44
|
context "containing blocks" do
|
45
45
|
setup do
|
46
46
|
@settings = {}
|
47
|
-
@config = Config::Loader.new(@settings)
|
47
|
+
@config = Spontaneous::Config::Loader.new(@settings)
|
48
48
|
end
|
49
49
|
should "add a hash to the settings under the defined key" do
|
50
50
|
@config.storage :key1 do |config|
|
@@ -71,7 +71,7 @@ class ConfigTest < MiniTest::Spec
|
|
71
71
|
# defined?(Spontaneous).should be_nil
|
72
72
|
# require @lib_dir + '/spontaneous/config.rb'
|
73
73
|
# Config.environment = :development
|
74
|
-
@config = Config.new(:development)
|
74
|
+
@config = Spontaneous::Config.new(:development)
|
75
75
|
@config.load(@config_dir)
|
76
76
|
end
|
77
77
|
|
@@ -98,10 +98,10 @@ class ConfigTest < MiniTest::Spec
|
|
98
98
|
|
99
99
|
should "overwrite values depending on environment" do
|
100
100
|
@config.over_ridden.should == :development_value
|
101
|
-
config = Config.new(:production)
|
101
|
+
config = Spontaneous::Config.new(:production)
|
102
102
|
config.load(@config_dir)
|
103
103
|
config.over_ridden.should == :production_value
|
104
|
-
config = Config.new(:staging)
|
104
|
+
config = Spontaneous::Config.new(:staging)
|
105
105
|
config.load(@config_dir)
|
106
106
|
config.over_ridden.should == :environment_value
|
107
107
|
end
|
@@ -120,10 +120,10 @@ class ConfigTest < MiniTest::Spec
|
|
120
120
|
|
121
121
|
should "dynamically switch values according to the configured env" do
|
122
122
|
@config.over_ridden.should == :development_value
|
123
|
-
config = Config.new(:production)
|
123
|
+
config = Spontaneous::Config.new(:production)
|
124
124
|
config.load(@config_dir)
|
125
125
|
config.over_ridden.should == :production_value
|
126
|
-
config = Config.new(:staging)
|
126
|
+
config = Spontaneous::Config.new(:staging)
|
127
127
|
config.load(@config_dir)
|
128
128
|
config.over_ridden.should == :environment_value
|
129
129
|
end
|
@@ -157,7 +157,7 @@ class ConfigTest < MiniTest::Spec
|
|
157
157
|
|
158
158
|
context "Spontaneous :back" do
|
159
159
|
setup do
|
160
|
-
@config = Config.new(:development, :back)
|
160
|
+
@config = Spontaneous::Config.new(:development, :back)
|
161
161
|
@config.load(@config_dir)
|
162
162
|
end
|
163
163
|
should "read the correct configuration values" do
|
@@ -166,7 +166,7 @@ class ConfigTest < MiniTest::Spec
|
|
166
166
|
end
|
167
167
|
context "Spontaneous :front" do
|
168
168
|
setup do
|
169
|
-
@config = Config.new(:development, :front)
|
169
|
+
@config = Spontaneous::Config.new(:development, :front)
|
170
170
|
@config.load(@config_dir)
|
171
171
|
end
|
172
172
|
should "read the correct configuration values" do
|
data/test/unit/test_content.rb
CHANGED
@@ -7,21 +7,19 @@ class ContentTest < MiniTest::Spec
|
|
7
7
|
context "Content:" do
|
8
8
|
setup do
|
9
9
|
@site = setup_site
|
10
|
-
class Piece < Spontaneous::Piece; end
|
11
|
-
class Page < Spontaneous::Page; end
|
12
|
-
class C < Piece; end
|
13
|
-
class P < Page; end
|
10
|
+
# class Piece < Spontaneous::Piece; end
|
11
|
+
# class Page < Spontaneous::Page; end
|
12
|
+
class C < ::Piece; end
|
13
|
+
class P < ::Page; end
|
14
14
|
C.box :things
|
15
15
|
P.box :box1
|
16
16
|
P.box :box2
|
17
17
|
end
|
18
18
|
|
19
19
|
teardown do
|
20
|
-
teardown_site
|
21
|
-
ContentTest.send(:remove_const, :Piece) rescue nil
|
22
|
-
ContentTest.send(:remove_const, :Page) rescue nil
|
23
20
|
ContentTest.send(:remove_const, :C) rescue nil
|
24
21
|
ContentTest.send(:remove_const, :P) rescue nil
|
22
|
+
teardown_site
|
25
23
|
end
|
26
24
|
|
27
25
|
context "Content instances" do
|
@@ -31,7 +29,7 @@ class ContentTest < MiniTest::Spec
|
|
31
29
|
})
|
32
30
|
@instance.monkey.should == 'magic'
|
33
31
|
id = @instance.id
|
34
|
-
@instance = Content[id]
|
32
|
+
@instance = ::Content[id]
|
35
33
|
@instance.monkey.should == 'magic'
|
36
34
|
end
|
37
35
|
end
|
@@ -41,8 +39,9 @@ class ContentTest < MiniTest::Spec
|
|
41
39
|
end
|
42
40
|
|
43
41
|
teardown do
|
44
|
-
Content.delete
|
42
|
+
::Content.delete rescue nil
|
45
43
|
end
|
44
|
+
|
46
45
|
should "be initialised empty" do
|
47
46
|
@instance.contents.should == []
|
48
47
|
end
|
@@ -330,51 +329,51 @@ class ContentTest < MiniTest::Spec
|
|
330
329
|
end
|
331
330
|
|
332
331
|
should "ensure that child pages have their visibility paths updated" do
|
333
|
-
|
332
|
+
skip "Implement this"
|
334
333
|
end
|
335
334
|
end
|
336
335
|
|
337
336
|
|
338
|
-
context "identity map" do
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
end
|
337
|
+
# context "identity map" do
|
338
|
+
# setup do
|
339
|
+
|
340
|
+
# ::Content.delete
|
341
|
+
# ::Content.delete_all_revisions!
|
342
|
+
# class ::IdentitySubclass < C; end
|
343
|
+
# @c1 = C.create
|
344
|
+
# @c2 = C.create
|
345
|
+
# @i1 = IdentitySubclass.create
|
346
|
+
# @i2 = IdentitySubclass.create
|
347
|
+
# end
|
348
|
+
# teardown do
|
349
|
+
# Object.send(:remove_const, :IdentitySubclass) rescue nil
|
350
|
+
# # Content.delete
|
351
|
+
# # Content.delete_all_revisions!
|
352
|
+
# end
|
353
|
+
# should "work for Content" do
|
354
|
+
# Content.with_identity_map do
|
355
|
+
# Content[@c1.id].object_id.should == Content[@c1.id].object_id
|
356
|
+
# end
|
357
|
+
# end
|
358
|
+
|
359
|
+
# should "work for subclasses" do
|
360
|
+
# Content.with_identity_map do
|
361
|
+
# IdentitySubclass[@i1.id].object_id.should == IdentitySubclass[@i1.id].object_id
|
362
|
+
# end
|
363
|
+
# end
|
364
|
+
|
365
|
+
# should "return different objects for different revisions" do
|
366
|
+
# revision = 2
|
367
|
+
# a = b = nil
|
368
|
+
# Content.publish(revision)
|
369
|
+
# Content.with_identity_map do
|
370
|
+
# a = Content[@c1.id]
|
371
|
+
# Content.with_revision(revision) do
|
372
|
+
# b = Content[@c1.id]
|
373
|
+
# end
|
374
|
+
# a.object_id.should_not == b.object_id
|
375
|
+
# end
|
376
|
+
# end
|
377
|
+
# end
|
379
378
|
end
|
380
379
|
end
|
@@ -10,7 +10,6 @@ class ContentInheritanceTest < MiniTest::Spec
|
|
10
10
|
@site = setup_site
|
11
11
|
|
12
12
|
Content.delete
|
13
|
-
class ::Page < Spontaneous::Page; end
|
14
13
|
class ::PageClass1 < ::Page; end
|
15
14
|
class ::PageClass11 < ::PageClass1; end
|
16
15
|
class ::PageClass111 < ::PageClass1; end
|
@@ -23,7 +22,6 @@ class ContentInheritanceTest < MiniTest::Spec
|
|
23
22
|
@page2 = PageClass2.create.reload
|
24
23
|
@page22 = PageClass22.create.reload
|
25
24
|
|
26
|
-
class ::Piece < Spontaneous::Piece; end
|
27
25
|
class ::PieceClass1 < ::Piece; end
|
28
26
|
class ::PieceClass11 < PieceClass1; end
|
29
27
|
class ::PieceClass111 < PieceClass11; end
|
@@ -39,7 +37,6 @@ class ContentInheritanceTest < MiniTest::Spec
|
|
39
37
|
|
40
38
|
teardown do
|
41
39
|
[
|
42
|
-
:Page, :Piece,
|
43
40
|
:PageClass1, :PageClass11, :PageClass111, :PageClass2, :PageClass22,
|
44
41
|
:PieceClass1, :PieceClass11, :PieceClass111, :PieceClass2, :PieceClass22
|
45
42
|
].each do |klass|
|
@@ -48,7 +45,7 @@ class ContentInheritanceTest < MiniTest::Spec
|
|
48
45
|
teardown_site
|
49
46
|
end
|
50
47
|
|
51
|
-
should "
|
48
|
+
should "correctly type subclasses found via Content" do
|
52
49
|
Set.new(Content.all.map { |c| c.class }).should == \
|
53
50
|
Set.new([PageClass1, PageClass11, PageClass111, PageClass2, PageClass22,
|
54
51
|
PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22])
|
@@ -59,16 +56,10 @@ class ContentInheritanceTest < MiniTest::Spec
|
|
59
56
|
|
60
57
|
context "Pages" do
|
61
58
|
|
62
|
-
should "type subclasses found via Page" do
|
63
|
-
Set.new(::Page.all.map { |c| c.class }).should == \
|
59
|
+
should "type subclasses found via Content::Page" do
|
60
|
+
Set.new(Content::Page.all.map { |c| c.class }).should == \
|
64
61
|
Set.new([PageClass1, PageClass11, PageClass111, PageClass2, PageClass22])
|
65
|
-
Set.new(::Page.all).should == Set.new([@page1, @page11, @page111, @page2, @page22])
|
66
|
-
end
|
67
|
-
|
68
|
-
should "type subclasses found via Spontaneous::Page" do
|
69
|
-
Set.new(Spontaneous::Page.all.map { |c| c.class }).should == \
|
70
|
-
Set.new([PageClass1, PageClass11, PageClass111, PageClass2, PageClass22])
|
71
|
-
Set.new(Spontaneous::Page.all).should == Set.new([@page1, @page11, @page111, @page2, @page22])
|
62
|
+
Set.new(Content::Page.all).should == Set.new([@page1, @page11, @page111, @page2, @page22])
|
72
63
|
end
|
73
64
|
|
74
65
|
should "only find instances of a single class when searching via that subclass" do
|
@@ -82,14 +73,9 @@ class ContentInheritanceTest < MiniTest::Spec
|
|
82
73
|
|
83
74
|
context "Pieces" do
|
84
75
|
should "type subclasses found via Spontaneous::Piece" do
|
85
|
-
Set.new(
|
86
|
-
Set.new([PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22])
|
87
|
-
Set.new(Spontaneous::Piece.all).should == Set.new([@piece1, @piece11, @piece111, @piece2, @piece22])
|
88
|
-
end
|
89
|
-
should "type subclasses found via Piece" do
|
90
|
-
Set.new(::Piece.all.map { |c| c.class }).should == \
|
76
|
+
Set.new(Content::Piece.all.map { |c| c.class }).should == \
|
91
77
|
Set.new([PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22])
|
92
|
-
Set.new(::Piece.all).should == Set.new([@piece1, @piece11, @piece111, @piece2, @piece22])
|
78
|
+
Set.new(Content::Piece.all).should == Set.new([@piece1, @piece11, @piece111, @piece2, @piece22])
|
93
79
|
end
|
94
80
|
|
95
81
|
should "only find instances of a single class when searching via that subclass" do
|