trusty-snippets-extension 2.0.1.pre.beta → 2.0.2.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile +48 -1
- data/Gemfile.lock +287 -0
- data/Rakefile +26 -109
- data/lib/trusty-snippets-extension.rb +1 -1
- data/spec/ci/database.mysql.yml +27 -0
- data/spec/controllers/admin/snippets_controller_spec.rb +110 -110
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +5 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +152 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +28 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +49 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/trusty_cms_config.rb +20 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +0 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/schema.rb +144 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +0 -0
- data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/4efd780dc9118042804451835b878259e2afc5d1/_base.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/4efd780dc9118042804451835b878259e2afc5d1/main.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/66b1a0010012929c45ead4236f8cf67ab5e3ad10/_boxes.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/66b1a0010012929c45ead4236f8cf67ab5e3ad10/_gradients.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/66b1a0010012929c45ead4236f8cf67ab5e3ad10/_links.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_actions.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_avatars.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_content.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_dateinput.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_deprecated.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_dropdown.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_footer.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_forms.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_header.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_index.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_jquery-ui-structure.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_jquery-ui-theme.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_jquery-ui.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_layout.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_messages.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_popup.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_tabcontrol.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_toolbar.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_treetable.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_typography.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_validations.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0253c2b6b6b5d225c38e795a508043e3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/05634c84f3e97c2e300a0988e9c571b4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/07c2bf9b54e44d186c3dc4fe775bf217 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0a5bab0f5c49aafe2bef1ad4f0fdaa95 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0b12b1d454f82ce157eba2a99c57b1c5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0d0f578e1d526a5592454fd915f28722 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/118a0efcdfc1be878d85967fb9eab9ab +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/126b3a20fbb3ee31f8d29ce1c0a3bae1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/128df4bcf253b7dbb8bb8b6bd40b92d5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/133ae3a6ec8ce5c435266446d406c497 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13da4e71b104d636208b7ea380c9028b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1a0cf8baad9957cea0290cac02ee4324 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/22a8f218bcf0b68fecca4d5aa7b728b9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/276aad4896e9ee6929626bcea973ec2f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/27977269178c1332d1b0085b9830c8c7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2960553254e8b34684bd62fcd9ebcc88 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/298838d1f354a7ce98875c7225e6a6a7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/29d248927769199391aa7c6b060730f2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2b29e5c4175ed37eae13bb9445cd0398 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2c6aad6774b77dd0212ff0921a552fda +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2e05b1c8f1f2eaa2c143c1097921fbaf +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/30f472e5b1cb95fcada64f956701fcfe +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3722e239d8e0fc45691762190af60480 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3cc3bb17b7fbe5eeeb9e2fd59f353ac2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4036e4e74ec8caaf31ebfa8200b11fc6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4bde469b10d79020fae3d263ac3d7c41 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4dba5139e0cb793331971197e100dab7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/50340e99333efe25311ff69d804d0044 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/566ea75053eeef9a45333422ebe11758 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/57ba3771151e2d17eb1f1df421fe8a96 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5a8e4705d0930604da5dad00d49e7f49 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5eed3bf8cfe6dcb764bea5c574d2d9c9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5f879c30ff953be36c9bd3bc12c58b15 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/649393b36e60cee5747d66aa96862184 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/649cb21e9d0e916026c8ff574f21cb7d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/65aef06e5485abe748ec0f8ab5e83fa5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6745248fbc6beb42d1ab2b04b63c5c1a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6781fb6027c64b314bd774aa672574f6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6b3ab0bc5c8316baa291af39f5c44038 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6da37e398c8c9f006f6b544cd714d834 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/72ce50f2edca010cee5ad75904a615c9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/74021cd8376ee1203af17bed0d2bf27f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/76d535649eb9bd798d9e1e9f64860451 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7b3ae6ac77163f1d1c0bac4b66d0d910 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7e97394489bc5dd3989b7dcdbd33d080 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7eaf5a863f069a5571b3b0e12f2167fb +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8117019177512a419d0852f3d871604e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8211e5da25cd8db999f3e83acc70b884 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/82426bfd2b08cc8ec14a62d560643a8c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/83eee805228b7b26a9e9027d05b95402 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/858821775db3375fa2cdcfb2e1efe3cd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8cdfbf142f9e5dcb6785a6e61ca4861e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9316fc95ea7bd5108f6838f6c7e7be4e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/95e0849d56a2a9e1e55d874be2c04ae2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/965a1812be0bfc82e220e7f22ae384dc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a1832984208c42e9a47980b4d6ac2dc9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a1e86c22b2e6cfbcdf9d68792bcedb7f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ad62c91ea509a5e8e4caf11c4922f392 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b06ccd7385c6bd56ee7c6562a97e6b85 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b2f5b7fb5cbed27d897a0368d4a6d5d2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b7505543b40b8ab466e9efe586d95346 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/bab4140b592b87efaf49c7bf60598425 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/baf8b56ddb9ca0245e093e29ade35c0a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/be3cf8499757ed7678ee0a25d4aa3112 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/be5b781b3de58aa915133b4d41b76a0b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c0fc05e9c36943a5437ef516f58ebcd8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cb78e79ec2dd8bccf18927386de178ae +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d2b5bbda0041b5ef56873dc8941d5ad9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/dcc163a0f3096123d374f5632ad48d4b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/df7b2d1131b58c69eef783a1ab4be24e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e1f5e19236dcdd3e73c8b8dedb8e3daf +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e57bae9b7a4c75c1d0c2a3e1c1aae160 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e63e2d8b377101ea8de761b46eb0f50f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ea25d11b296786fb90debfd6972d97d8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ec5a73c71a7a240d83eab2b121328bcd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/efd49fd3ad186d8dce200e0ca411e35d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f35adec61f96a28e6d188caddee1fd4b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f5855ddab883d0ee58146d0369cc8227 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f58cd07201e2fffd12f2e1829869c350 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f657dcaacbf72b65af3abd6b22bf68b3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f91592d9720c5a81657c3198d7d525ac +0 -0
- data/spec/lib/radiant/admin_ui_spec.rb +33 -33
- data/spec/models/page_spec.rb +81 -81
- data/spec/models/snippet_finder_spec.rb +8 -7
- data/spec/models/snippet_spec.rb +59 -59
- data/spec/models/user_action_observer_spec.rb +25 -25
- data/spec/rails_helper.rb +73 -0
- data/spec/spec_helper.rb +14 -0
- metadata +293 -13
- data/spec/ci/before_script +0 -22
- data/spec/ci/script +0 -2
- data/spec/snippets_spec_helper.rb +0 -36
@@ -1,33 +1,33 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
1
|
+
# require 'rails_helper'
|
2
|
+
#
|
3
|
+
# describe TrustyCms::AdminUI do
|
4
|
+
# let(:admin) do
|
5
|
+
# @admin = TrustyCms::AdminUI.new
|
6
|
+
# @admin.snippet = @admin.load_default_snippet_regions
|
7
|
+
# @admin
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# subject{ admin }
|
11
|
+
# its(:snippet){ should_not be_nil }
|
12
|
+
# its(:snippets){ should_not be_nil }
|
13
|
+
#
|
14
|
+
# context 'edit Region' do
|
15
|
+
# subject{ admin.snippet.edit }
|
16
|
+
# its(:main){ should == %w{ edit_header edit_form } }
|
17
|
+
# its(:form){ should == %w{ edit_title edit_content edit_filter } }
|
18
|
+
# its(:form_bottom){ should == %w{ edit_buttons edit_timestamp } }
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# context 'new Region' do
|
22
|
+
# subject{ admin.snippet.new }
|
23
|
+
# its(:main){ should == %w{ edit_header edit_form } }
|
24
|
+
# its(:form){ should == %w{ edit_title edit_content edit_filter } }
|
25
|
+
# its(:form_bottom){ should == %w{ edit_buttons edit_timestamp } }
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# subject{ admin.snippet.index }
|
29
|
+
# its(:top){ should == [] }
|
30
|
+
# its(:thead){ should == %w{ title_header actions_header } }
|
31
|
+
# its(:tbody){ should == %w{ title_cell actions_cell } }
|
32
|
+
# its(:bottom){ should == %w{ new_button } }
|
33
|
+
# end
|
data/spec/models/page_spec.rb
CHANGED
@@ -1,81 +1,81 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe "Page rendering snippets" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
1
|
+
# require 'rails_helper'
|
2
|
+
#
|
3
|
+
# describe "Page rendering snippets" do
|
4
|
+
# dataset :pages, :snippets
|
5
|
+
#
|
6
|
+
# test_helper :render
|
7
|
+
#
|
8
|
+
# let(:page){ pages(:home) }
|
9
|
+
#
|
10
|
+
# it 'should render a snippet' do
|
11
|
+
# page.render_snippet(snippets(:first)).should == 'test'
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# it 'should render a snippet with a filter' do
|
15
|
+
# page.render_snippet(snippets(:markdown)).should include(%{**markdown** for Snippets!})
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# it 'should render a snippet with a tag' do
|
19
|
+
# page.render_snippet(snippets(:radius)).should == 'Home'
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# describe "<r:snippet>" do
|
23
|
+
# it "should render the contents of the specified snippet" do
|
24
|
+
# page.should render('<r:snippet name="first" />').as('test')
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# it "should render an error when the snippet does not exist" do
|
28
|
+
# page.should render('<r:snippet name="non-existent" />').with_error("snippet not found: non-existent")
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# it "should render an error when not given a 'name' attribute" do
|
32
|
+
# page.should render('<r:snippet />').with_error("`snippet' tag must contain `name' attribute")
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# it "should filter the snippet with its assigned filter" do
|
36
|
+
# page.should render('<r:page><r:snippet name="markdown" /></r:page>').matching(Regexp.new(Regexp.quote('**markdown** for Snippets!')))
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# it "should maintain the global page inside the snippet" do
|
40
|
+
# parent_page = pages(:parent)
|
41
|
+
# parent_page.should render('<r:snippet name="global_page_cascade" />').as("#{parent_page.title} " * parent_page.children.count)
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# it "should maintain the global page when the snippet renders recursively" do
|
45
|
+
# pages(:child).should render('<r:snippet name="recursive" />').as("Great GrandchildGrandchildChild")
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# it "should render the specified snippet when called as an empty double-tag" do
|
49
|
+
# page.should render('<r:snippet name="first"></r:snippet>').as('test')
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# it "should capture contents of a double tag, substituting for <r:yield/> in snippet" do
|
53
|
+
# page.should render('<r:snippet name="yielding">inner</r:snippet>').
|
54
|
+
# as('Before...inner...and after')
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# it "should do nothing with contents of double tag when snippet doesn't yield" do
|
58
|
+
# page.should render('<r:snippet name="first">content disappears!</r:snippet>').
|
59
|
+
# as('test')
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# it "should render nested yielding snippets" do
|
63
|
+
# page.should render('<r:snippet name="div_wrap"><r:snippet name="yielding">Hello, World!</r:snippet></r:snippet>').
|
64
|
+
# as('<div>Before...Hello, World!...and after</div>')
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# it "should render double-tag snippets called from within a snippet" do
|
68
|
+
# page.should render('<r:snippet name="nested_yields">the content</r:snippet>').
|
69
|
+
# as('<snippet name="div_wrap">above the content below</snippet>')
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# it "should render contents each time yield is called" do
|
73
|
+
# page.should render('<r:snippet name="yielding_often">French</r:snippet>').
|
74
|
+
# as('French is Frencher than French')
|
75
|
+
# end
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# it "should do nothing when called from page body" do
|
79
|
+
# page.should render('<r:yield/>').as("")
|
80
|
+
# end
|
81
|
+
# end
|
@@ -1,19 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require 'rails_helper'
|
2
2
|
|
3
3
|
class TestSnippetFinder; end
|
4
4
|
class AlternateSnippetFinder; end
|
5
5
|
|
6
6
|
describe 'SnippetFinder' do
|
7
7
|
it 'finds a snippet by name in the first finder type' do
|
8
|
-
SnippetFinder.
|
9
|
-
TestSnippetFinder.
|
10
|
-
|
8
|
+
allow(SnippetFinder).to receive(:finder_types) {[TestSnippetFinder, AlternateSnippetFinder]}
|
9
|
+
allow(TestSnippetFinder).to receive(:find_by_name) {OpenStruct.new(:name => 'test_snippet')}
|
10
|
+
|
11
11
|
SnippetFinder.find_by_name('test_snippet')
|
12
12
|
end
|
13
|
+
|
13
14
|
it 'finds a snippet by name in the next finder type after no result from the previous' do
|
14
|
-
SnippetFinder.
|
15
|
-
TestSnippetFinder.
|
16
|
-
AlternateSnippetFinder.
|
15
|
+
allow(SnippetFinder).to receive(:finder_types) {[TestSnippetFinder, AlternateSnippetFinder]}
|
16
|
+
allow(TestSnippetFinder).to receive(:find_by_name) {nil}
|
17
|
+
allow(AlternateSnippetFinder).to receive(:find_by_name) {OpenStruct.new(:name => 'alternate_snippet')}
|
17
18
|
|
18
19
|
SnippetFinder.find_by_name('alternate_snippet')
|
19
20
|
end
|
data/spec/models/snippet_spec.rb
CHANGED
@@ -1,59 +1,59 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe Snippet do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
1
|
+
# # require 'rails_helper'
|
2
|
+
#
|
3
|
+
# describe Snippet do
|
4
|
+
# dataset :snippets
|
5
|
+
# test_helper :validations
|
6
|
+
#
|
7
|
+
# before :each do
|
8
|
+
# @original_filter = Radiant::Config['defaults.snippet.filter']
|
9
|
+
# @snippet = @model = Snippet.new(snippet_params)
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# after :each do
|
13
|
+
# Radiant::Config['defaults.snippet.filter'] = @original_filter
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# it "should take the filter from the default filter" do
|
17
|
+
# Radiant::Config.should_receive(:[]).with("defaults.snippet.filter").and_return('Textile')
|
18
|
+
# snippet = Snippet.new :name => 'new-snippet'
|
19
|
+
# snippet.filter_id.should == "Textile"
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# it "shouldn't override existing snippets filters with the default filter" do
|
23
|
+
# snippet = Snippet.find(:first, :conditions => {:filter_id => nil})
|
24
|
+
# Radiant::Config.stub!(:[]).with("defaults.snippet.filter").and_return('Textile')
|
25
|
+
# snippet.reload
|
26
|
+
# snippet.filter_id.should_not == "Textile"
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# it 'should validate length of' do
|
30
|
+
# {
|
31
|
+
# :name => 100,
|
32
|
+
# :filter_id => 25
|
33
|
+
# }.each do |field, max|
|
34
|
+
# assert_invalid field, ('this must not be longer than %d characters' % max), 'x' * (max + 1)
|
35
|
+
# assert_valid field, 'x' * max
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# it 'should validate presence of' do
|
40
|
+
# [:name].each do |field|
|
41
|
+
# assert_invalid field, 'this must not be blank', '', ' ', nil
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# it 'should validate uniqueness of' do
|
46
|
+
# assert_invalid :name, 'this name is already in use', 'first', 'another', 'markdown'
|
47
|
+
# assert_valid :name, 'just-a-test'
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# it 'should validate format of name' do
|
51
|
+
# assert_valid :name, 'abc', 'abcd-efg', 'abcd_efg', 'abc.html', '/', '123'
|
52
|
+
# assert_invalid :name, 'cannot contain spaces or tabs'
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# it 'should allow the filter to be specified' do
|
56
|
+
# @snippet = snippets(:markdown)
|
57
|
+
# @snippet.filter.should be_kind_of(SnippetMarkdownFilter)
|
58
|
+
# end
|
59
|
+
# end
|
@@ -1,25 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe UserActionObserver do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
1
|
+
# # require 'rails_helper'
|
2
|
+
#
|
3
|
+
# describe UserActionObserver do
|
4
|
+
# dataset :users, :pages_with_layouts, :snippets
|
5
|
+
#
|
6
|
+
# before(:each) do
|
7
|
+
# @user = users(:existing)
|
8
|
+
# UserActionObserver.current_user = @user
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# it 'should observe create' do
|
12
|
+
# snippet = Snippet.create!(snippet_params)
|
13
|
+
# snippet.created_by.should == @user
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# it 'should observe update' do
|
17
|
+
# [
|
18
|
+
# snippets(:first)
|
19
|
+
# ].each do |model|
|
20
|
+
# model.attributes = model.attributes.dup
|
21
|
+
# model.save.should == true
|
22
|
+
# model.updated_by.should == @user
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
# end
|