radiant-snippets-extension 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/radiant-snippets-extension.rb +1 -1
- data/spec/ci/before_script +1 -1
- data/spec/controllers/admin/snippets_controller_spec.rb +1 -1
- data/spec/datasets/snippets_dataset.rb +7 -1
- data/spec/lib/radiant/admin_ui_spec.rb +1 -1
- data/spec/models/page_spec.rb +5 -4
- data/spec/models/snippet_spec.rb +4 -4
- data/spec/models/user_action_observer_spec.rb +3 -6
- data/spec/{spec_helper.rb → snippets_spec_helper.rb} +0 -0
- metadata +74 -82
data/spec/ci/before_script
CHANGED
@@ -7,7 +7,7 @@ then
|
|
7
7
|
fi
|
8
8
|
cp -r ~/builds/*/radiant-snippets-extension vendor/extensions/snippets
|
9
9
|
gem install bundler --pre
|
10
|
-
echo
|
10
|
+
echo gemspec >> Gemfile
|
11
11
|
bundle install
|
12
12
|
|
13
13
|
case $DB in
|
@@ -1,9 +1,15 @@
|
|
1
|
+
class SnippetMarkdownFilter < TextFilter
|
2
|
+
def filter(text)
|
3
|
+
text + ' for Snippets!'
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
1
7
|
class SnippetsDataset < Dataset::Base
|
2
8
|
|
3
9
|
def load
|
4
10
|
create_snippet "first", :content => "test"
|
5
11
|
create_snippet "another", :content => "another test"
|
6
|
-
create_snippet "markdown", :filter_id => "Markdown", :content => "**markdown**"
|
12
|
+
create_snippet "markdown", :filter_id => "Snippet Markdown", :content => "**markdown**"
|
7
13
|
create_snippet "radius", :content => "<r:title />"
|
8
14
|
create_snippet "global_page_cascade", :content => "<r:children:each><r:page:title /> </r:children:each>"
|
9
15
|
create_snippet "recursive", :content => "<r:children:each><r:snippet name='recursive' /></r:children:each><r:title />"
|
data/spec/models/page_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'snippets_spec_helper'
|
2
2
|
|
3
3
|
describe "Page rendering snippets" do
|
4
4
|
dataset :pages, :snippets
|
@@ -12,7 +12,7 @@ describe "Page rendering snippets" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should render a snippet with a filter' do
|
15
|
-
page.render_snippet(snippets(:markdown)).should
|
15
|
+
page.render_snippet(snippets(:markdown)).should include(%{**markdown** for Snippets!})
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'should render a snippet with a tag' do
|
@@ -33,11 +33,12 @@ describe "Page rendering snippets" do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should filter the snippet with its assigned filter" do
|
36
|
-
page.should render('<r:page><r:snippet name="markdown" /></r:page>').matching(
|
36
|
+
page.should render('<r:page><r:snippet name="markdown" /></r:page>').matching(Regexp.new(Regexp.quote('**markdown** for Snippets!')))
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should maintain the global page inside the snippet" do
|
40
|
-
pages(:parent)
|
40
|
+
parent_page = pages(:parent)
|
41
|
+
parent_page.should render('<r:snippet name="global_page_cascade" />').as("#{parent_page.title} " * parent_page.children.count)
|
41
42
|
end
|
42
43
|
|
43
44
|
it "should maintain the global page when the snippet renders recursively" do
|
data/spec/models/snippet_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'snippets_spec_helper'
|
2
2
|
|
3
3
|
describe Snippet do
|
4
4
|
dataset :snippets
|
@@ -14,14 +14,14 @@ describe Snippet do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should take the filter from the default filter" do
|
17
|
-
Radiant::Config[
|
17
|
+
Radiant::Config.should_receive(:[]).with("defaults.snippet.filter").and_return('Textile')
|
18
18
|
snippet = Snippet.new :name => 'new-snippet'
|
19
19
|
snippet.filter_id.should == "Textile"
|
20
20
|
end
|
21
21
|
|
22
22
|
it "shouldn't override existing snippets filters with the default filter" do
|
23
23
|
snippet = Snippet.find(:first, :conditions => {:filter_id => nil})
|
24
|
-
Radiant::Config[
|
24
|
+
Radiant::Config.stub!(:[]).with("defaults.snippet.filter").and_return('Textile')
|
25
25
|
snippet.reload
|
26
26
|
snippet.filter_id.should_not == "Textile"
|
27
27
|
end
|
@@ -54,6 +54,6 @@ describe Snippet do
|
|
54
54
|
|
55
55
|
it 'should allow the filter to be specified' do
|
56
56
|
@snippet = snippets(:markdown)
|
57
|
-
@snippet.filter.should be_kind_of(
|
57
|
+
@snippet.filter.should be_kind_of(SnippetMarkdownFilter)
|
58
58
|
end
|
59
59
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'snippets_spec_helper'
|
2
2
|
|
3
3
|
describe UserActionObserver do
|
4
4
|
dataset :users, :pages_with_layouts, :snippets
|
@@ -9,11 +9,8 @@ describe UserActionObserver do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should observe create' do
|
12
|
-
|
13
|
-
|
14
|
-
].each do |model|
|
15
|
-
model.created_by.should == @user
|
16
|
-
end
|
12
|
+
snippet = Snippet.create!(snippet_params)
|
13
|
+
snippet.created_by.should == @user
|
17
14
|
end
|
18
15
|
|
19
16
|
it 'should observe update' do
|
File without changes
|
metadata
CHANGED
@@ -1,104 +1,96 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-snippets-extension
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- Jim Gay
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2012-03-05 00:00:00 Z
|
12
|
+
date: 2012-03-06 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
|
16
14
|
description: Makes Radiant better by adding snippets!
|
17
|
-
email:
|
18
|
-
|
15
|
+
email:
|
16
|
+
- radiant@radiantcms.org
|
19
17
|
executables: []
|
20
|
-
|
21
18
|
extensions: []
|
22
|
-
|
23
19
|
extra_rdoc_files: []
|
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
|
-
- spec/models/user_action_observer_spec.rb
|
20
|
+
files:
|
21
|
+
- app/controllers/admin/snippets_controller.rb
|
22
|
+
- app/helpers/admin/snippets_helper.rb
|
23
|
+
- app/models/snippet.rb
|
24
|
+
- app/views/admin/snippets/_form.html.haml
|
25
|
+
- app/views/admin/snippets/edit.html.haml
|
26
|
+
- app/views/admin/snippets/index.html.haml
|
27
|
+
- app/views/admin/snippets/new.html.haml
|
28
|
+
- app/views/admin/snippets/remove.html.haml
|
29
|
+
- config/initializers/radiant_config.rb
|
30
|
+
- config/locales/en.yml
|
31
|
+
- config/routes.rb
|
32
|
+
- cucumber.yml
|
33
|
+
- features/admin/configuration.feature
|
34
|
+
- features/admin/pagination.feature
|
35
|
+
- features/admin/snippets_management.feature
|
36
|
+
- features/step_definitions/admin/snippet_steps.rb
|
37
|
+
- features/support/env.rb
|
38
|
+
- features/support/paths.rb
|
39
|
+
- lib/radiant-snippets-extension.rb
|
40
|
+
- lib/snippet_tags.rb
|
41
|
+
- lib/tasks/snippets_extension_tasks.rake
|
42
|
+
- radiant-snippets-extension.gemspec
|
43
|
+
- Rakefile
|
44
|
+
- README.md
|
45
|
+
- snippets_extension.rb
|
46
|
+
- spec/ci/before_script
|
47
|
+
- spec/ci/script
|
48
|
+
- spec/controllers/admin/snippets_controller_spec.rb
|
49
|
+
- spec/datasets/snippets_dataset.rb
|
50
|
+
- spec/lib/radiant/admin_ui_spec.rb
|
51
|
+
- spec/models/page_spec.rb
|
52
|
+
- spec/models/snippet_spec.rb
|
53
|
+
- spec/models/user_action_observer_spec.rb
|
54
|
+
- spec/snippets_spec_helper.rb
|
55
|
+
- spec/spec.opts
|
61
56
|
homepage: http://github.com/radiant
|
62
57
|
licenses: []
|
63
|
-
|
64
58
|
post_install_message:
|
65
59
|
rdoc_options: []
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
63
|
none: false
|
71
|
-
requirements:
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
69
|
none: false
|
77
|
-
requirements:
|
78
|
-
|
79
|
-
|
80
|
-
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
81
74
|
requirements: []
|
82
|
-
|
83
75
|
rubyforge_project:
|
84
|
-
rubygems_version: 1.8.
|
76
|
+
rubygems_version: 1.8.11
|
85
77
|
signing_key:
|
86
78
|
specification_version: 3
|
87
79
|
summary: Snippets for Radiant CMS
|
88
|
-
test_files:
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
80
|
+
test_files:
|
81
|
+
- spec/ci/before_script
|
82
|
+
- spec/ci/script
|
83
|
+
- spec/controllers/admin/snippets_controller_spec.rb
|
84
|
+
- spec/datasets/snippets_dataset.rb
|
85
|
+
- spec/lib/radiant/admin_ui_spec.rb
|
86
|
+
- spec/models/page_spec.rb
|
87
|
+
- spec/models/snippet_spec.rb
|
88
|
+
- spec/models/user_action_observer_spec.rb
|
89
|
+
- spec/snippets_spec_helper.rb
|
90
|
+
- spec/spec.opts
|
91
|
+
- features/admin/configuration.feature
|
92
|
+
- features/admin/pagination.feature
|
93
|
+
- features/admin/snippets_management.feature
|
94
|
+
- features/step_definitions/admin/snippet_steps.rb
|
95
|
+
- features/support/env.rb
|
96
|
+
- features/support/paths.rb
|