refinerycms-page-menus 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/app/controllers/refinery/admin/page_menus_controller.rb +9 -0
- data/app/controllers/refinery/admin/page_positions_controller.rb +51 -0
- data/app/models/refinery/page_menu.rb +31 -0
- data/app/models/refinery/page_position.rb +37 -0
- data/app/views/refinery/admin/page_menus/_form.html.erb +41 -0
- data/app/views/refinery/admin/page_menus/edit.html.erb +1 -0
- data/app/views/refinery/admin/page_positions/_actions.html.erb +45 -0
- data/app/views/refinery/admin/page_positions/_page_position.html.erb +49 -0
- data/app/views/refinery/admin/page_positions/_records.html.erb +14 -0
- data/app/views/refinery/admin/page_positions/_sortable_list.html.erb +4 -0
- data/app/views/refinery/admin/page_positions/index.html.erb +11 -0
- data/app/views/refinery/admin/pages/_actions.html.erb +40 -0
- data/app/views/refinery/admin/pages/_list_actions.html.erb +28 -0
- data/app/views/refinery/admin/pages/_list_page.html.erb +46 -0
- data/app/views/refinery/admin/pages/_list_records.html.erb +16 -0
- data/app/views/refinery/admin/pages/list.html.erb +8 -0
- data/app/views/refinery/admin/pages_shared/_submenu.html.erb +65 -0
- data/config/locales/da.yml +32 -0
- data/config/locales/en.yml +93 -0
- data/config/routes.rb +14 -0
- data/db/migrate/20120406121839_create_page_menus.rb +31 -0
- data/db/migrate/20120411133453_add_permatitle_to_page_menus.rb +9 -0
- data/db/migrate/20120411134419_add_menu_match_to_page_positions.rb +6 -0
- data/lib/generators/refinery/page_menus/page_menus_generator.rb +14 -0
- data/lib/generators/refinery/page_menus/templates/config/initializers/refinery/page_menus.rb.erb +3 -0
- data/lib/refinery/page_menus.rb +31 -0
- data/lib/refinery/page_menus/configuration.rb +10 -0
- data/lib/refinery/page_menus/controller_extension.rb +44 -0
- data/lib/refinery/page_menus/engine.rb +35 -0
- data/lib/refinery/page_menus/instance_methods.rb +16 -0
- data/lib/refinery/page_menus/model_extension.rb +14 -0
- data/lib/refinerycms-page-menus.rb +1 -0
- data/license.md +21 -0
- data/readme.md +1 -0
- data/refinerycms-page-menus.gemspec +25 -0
- data/spec/factories/pages.rb +5 -0
- data/spec/helpers/refinery/pages/content_pages_helper_spec.rb +44 -0
- data/spec/lib/generators/refinery/pages/pages_generator_spec.rb +29 -0
- data/spec/lib/pages/content_page_presenter_spec.rb +43 -0
- data/spec/lib/pages/content_presenter_spec.rb +111 -0
- data/spec/lib/pages/page_part_section_presenter_spec.rb +35 -0
- data/spec/lib/pages/section_presenter_spec.rb +86 -0
- data/spec/lib/pages/title_section_presenter_spec.rb +21 -0
- data/spec/lib/pages_spec.rb +26 -0
- data/spec/models/refinery/page_spec.rb +415 -0
- data/spec/requests/refinery/admin/pages_spec.rb +613 -0
- data/spec/requests/refinery/pages_spec.rb +302 -0
- metadata +127 -0
@@ -0,0 +1 @@
|
|
1
|
+
require 'refinery/page_menus'
|
data/license.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2005-2012 [Pylonweb](http://pylonweb.dk)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
## Coming soon
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Encoding: UTF-8
|
2
|
+
# $:.push File.expand_path('../../core/lib', __FILE__)
|
3
|
+
# require 'refinery/version'
|
4
|
+
#
|
5
|
+
# version = Refinery::Version.to_s
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.name = %q{refinerycms-page-menus}
|
10
|
+
s.version = '2.0.3'
|
11
|
+
s.summary = %q{Pages Menus extension for Refinery CMS}
|
12
|
+
s.description = %q{Add custom menus to pages}
|
13
|
+
s.date = Date.today.strftime("%Y-%m-%d")
|
14
|
+
s.email = %q{johan@pylonweb.dk}
|
15
|
+
s.homepage = %q{http://github.com/pylonweb/refinerycms-page-menus}
|
16
|
+
s.authors = ['Johan Frølich']
|
17
|
+
s.license = %q{MIT}
|
18
|
+
s.require_paths = %w(lib)
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
22
|
+
|
23
|
+
s.add_dependency 'awesome_nested_set', '~> 2.1.0'
|
24
|
+
s.add_dependency 'refinerycms-pages', '~> 2.0.3'
|
25
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Pages
|
5
|
+
describe ContentPagesHelper do
|
6
|
+
let(:content_presenter) { double(ContentPresenter, :hide_sections => nil, :fetch_template_overrides => nil, :to_html => nil) }
|
7
|
+
|
8
|
+
describe "when rendering content presenter" do
|
9
|
+
it "asks to content presenter to hide sections if told to" do
|
10
|
+
content_presenter.should_receive(:hide_sections).with(['foo', 'bar'])
|
11
|
+
render_content_presenter(content_presenter, :hide_sections => ['foo', 'bar'])
|
12
|
+
end
|
13
|
+
|
14
|
+
it "attempts to fetch template overrides declared elsewhere via content_for" do
|
15
|
+
content_presenter.should_receive(:fetch_template_overrides).and_yield(12)
|
16
|
+
self.should_receive(:content_for).with(12)
|
17
|
+
render_content_presenter(content_presenter)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "outputs the html rendered by the content presenter" do
|
21
|
+
content_presenter.should_receive(:to_html).and_return('foobar')
|
22
|
+
render_content_presenter(content_presenter).should == 'foobar'
|
23
|
+
end
|
24
|
+
|
25
|
+
it "passes can_use_fallback option through to html rendering" do
|
26
|
+
content_presenter.should_receive(:to_html).with(true)
|
27
|
+
render_content_presenter(content_presenter, :can_use_fallback => true)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "when rendering page" do
|
32
|
+
let(:page) { double(Page) }
|
33
|
+
|
34
|
+
it "builds a content page presenter and returns its html" do
|
35
|
+
self.should_receive(:page_title).and_return('some title')
|
36
|
+
Refinery::Pages::ContentPagePresenter.should_receive(:new).with(page, 'some title').and_return(content_presenter)
|
37
|
+
content_presenter.should_receive(:to_html).and_return('barfoo')
|
38
|
+
|
39
|
+
render_content_page(page).should == 'barfoo'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'generator_spec/test_case'
|
3
|
+
require 'generators/refinery/pages/pages_generator'
|
4
|
+
|
5
|
+
module Refinery
|
6
|
+
describe PagesGenerator do
|
7
|
+
include GeneratorSpec::TestCase
|
8
|
+
destination File.expand_path("../../../../tmp", __FILE__)
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
prepare_destination
|
12
|
+
run_generator
|
13
|
+
end
|
14
|
+
|
15
|
+
specify do
|
16
|
+
destination_root.should have_structure {
|
17
|
+
directory "config" do
|
18
|
+
directory "initializers" do
|
19
|
+
directory "refinery" do
|
20
|
+
file "pages.rb" do
|
21
|
+
contains "Refinery::Pages.configure"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Pages
|
5
|
+
describe ContentPagePresenter do
|
6
|
+
let(:part) { double(PagePart, :body => 'part_body', :title => 'A Wonderful Page Part') }
|
7
|
+
let(:part2) { double(PagePart, :body => 'part_body2', :title => 'Another Wonderful Page Part') }
|
8
|
+
let(:title) { 'This Great Page' }
|
9
|
+
|
10
|
+
describe "when building for page" do
|
11
|
+
let(:page_with_one_part) { double(Page, :parts => [part]) }
|
12
|
+
|
13
|
+
it "adds page title section before page parts" do
|
14
|
+
content = ContentPagePresenter.new(page_with_one_part, title)
|
15
|
+
content.get_section(0).fallback_html.should == title
|
16
|
+
end
|
17
|
+
|
18
|
+
it "adds a section for each page part" do
|
19
|
+
page = double(Page, :parts => [part, part2])
|
20
|
+
content = ContentPagePresenter.new(page, title)
|
21
|
+
content.get_section(1).fallback_html.should == 'part_body'
|
22
|
+
content.get_section(2).fallback_html.should == 'part_body2'
|
23
|
+
end
|
24
|
+
|
25
|
+
it "adds body content left and right after page parts" do
|
26
|
+
content = ContentPagePresenter.new(page_with_one_part, title)
|
27
|
+
content.get_section(2).id.should == :body
|
28
|
+
content.get_section(3).id.should == :side_body
|
29
|
+
end
|
30
|
+
|
31
|
+
it "doesnt add page parts if page is nil" do
|
32
|
+
content = ContentPagePresenter.new(nil, title)
|
33
|
+
content.get_section(1).id.should == :body
|
34
|
+
end
|
35
|
+
|
36
|
+
it "doesnt add title if it is blank" do
|
37
|
+
content = ContentPagePresenter.new(nil, '')
|
38
|
+
content.get_section(0).id.should == :body
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Pages
|
5
|
+
describe ContentPresenter do
|
6
|
+
let(:section1) { double(SectionPresenter, :id => 'foo', :has_content? => true) }
|
7
|
+
let(:section2) { double(SectionPresenter, :id => 'bar', :has_content? => true) }
|
8
|
+
|
9
|
+
describe "when building css classes for blank sections" do
|
10
|
+
let(:section) { double(SectionPresenter, :not_present_css_class => 'no_section1') }
|
11
|
+
|
12
|
+
it "includes css class for any section which doesnt have content" do
|
13
|
+
section.stub(:has_content?).with(true).and_return(false)
|
14
|
+
content = ContentPresenter.new
|
15
|
+
content.add_section section
|
16
|
+
|
17
|
+
content.blank_section_css_classes(true).should == ['no_section1']
|
18
|
+
end
|
19
|
+
|
20
|
+
it "doesnt include sections which have content" do
|
21
|
+
section.stub(:has_content?).with(true).and_return(true)
|
22
|
+
content = ContentPresenter.new
|
23
|
+
content.add_section section
|
24
|
+
|
25
|
+
content.blank_section_css_classes(true).should be_empty
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "when hiding sections" do
|
30
|
+
before do
|
31
|
+
@content = ContentPresenter.new
|
32
|
+
@content.add_section section1
|
33
|
+
@content.add_section section2
|
34
|
+
end
|
35
|
+
|
36
|
+
it "hides a section specified by id" do
|
37
|
+
section2.should_receive :hide
|
38
|
+
@content.hide_sections 'bar'
|
39
|
+
end
|
40
|
+
|
41
|
+
# Regression for https://github.com/resolve/refinerycms/issues/1516
|
42
|
+
it "accepts an array" do
|
43
|
+
section2.should_receive :hide
|
44
|
+
@content.hide_sections ['bar']
|
45
|
+
end
|
46
|
+
|
47
|
+
it "hides nothing if nil" do
|
48
|
+
section1.stub(:hidden?).and_return false
|
49
|
+
section2.stub(:hidden?).and_return false
|
50
|
+
@content.hide_sections nil
|
51
|
+
@content.hidden_sections.count.should == 0
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "when fetching template overrides" do
|
57
|
+
before do
|
58
|
+
@content = ContentPresenter.new
|
59
|
+
end
|
60
|
+
|
61
|
+
it "yields a section with an id and stores the result in its override html" do
|
62
|
+
section = double(SectionPresenter, :id => 'foo')
|
63
|
+
section.should_receive(:override_html=).with('some override')
|
64
|
+
@content.add_section section
|
65
|
+
|
66
|
+
@content.fetch_template_overrides do |section_id|
|
67
|
+
section_id.should == 'foo'
|
68
|
+
'some override'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it "doesnt yield a section without an id" do
|
73
|
+
section = double(SectionPresenter, :id => nil)
|
74
|
+
section.should_receive(:override_html=).never
|
75
|
+
@content.add_section section
|
76
|
+
|
77
|
+
@content.fetch_template_overrides do |section_id|
|
78
|
+
raise "this should not occur"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "when rendering as html" do
|
84
|
+
it "is empty section tag if it has no sections" do
|
85
|
+
content = ContentPresenter.new
|
86
|
+
content.to_html.should == "<section class=\"\" id=\"body_content\"></section>"
|
87
|
+
end
|
88
|
+
|
89
|
+
it "returns sections joined by a newline inside section tag" do
|
90
|
+
section1.stub(:wrapped_html).and_return('foo')
|
91
|
+
section2.stub(:wrapped_html).and_return('bar')
|
92
|
+
content = ContentPresenter.new([section1, section2])
|
93
|
+
content.to_html.should == "<section class=\"\" id=\"body_content\">foo\nbar</section>"
|
94
|
+
end
|
95
|
+
|
96
|
+
it "passes can_use_fallback option on to sections" do
|
97
|
+
section1.should_receive(:wrapped_html).with(false).and_return('foo')
|
98
|
+
content = ContentPresenter.new([section1])
|
99
|
+
content.to_html(false)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "doesnt include sections with nil content" do
|
103
|
+
section1.stub(:wrapped_html).and_return('foo')
|
104
|
+
section2.stub(:wrapped_html).and_return(nil)
|
105
|
+
content = ContentPresenter.new([section1, section2])
|
106
|
+
content.to_html.should == "<section class=\"\" id=\"body_content\">foo</section>"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Pages
|
5
|
+
describe PagePartSectionPresenter do
|
6
|
+
it "can be built from a page part" do
|
7
|
+
part = double(PagePart, :body => 'part_body', :title => 'A Wonderful Page Part')
|
8
|
+
section = PagePartSectionPresenter.new(part)
|
9
|
+
section.fallback_html.should == 'part_body'
|
10
|
+
section.id.should == :a_wonderful_page_part
|
11
|
+
end
|
12
|
+
|
13
|
+
it "marks the body as html safe" do
|
14
|
+
part = double(PagePart, :body => '<p>part_body</p>', :title => nil)
|
15
|
+
section = PagePartSectionPresenter.new(part)
|
16
|
+
section.fallback_html.should be_html_safe
|
17
|
+
section.wrapped_html.should == "<section><div class=\"inner\"><p>part_body</p></div></section>"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "handles a nil page body" do
|
21
|
+
part = double(PagePart, :body => nil, :title => nil)
|
22
|
+
section = PagePartSectionPresenter.new(part)
|
23
|
+
section.fallback_html.should be_nil
|
24
|
+
section.wrapped_html.should be_nil
|
25
|
+
section.has_content?.should be_false
|
26
|
+
end
|
27
|
+
|
28
|
+
it "has no id if title is nil" do
|
29
|
+
part = double(PagePart, :body => 'foobar', :title => nil)
|
30
|
+
section = PagePartSectionPresenter.new(part)
|
31
|
+
section.id.should be_nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Pages
|
5
|
+
describe SectionPresenter do
|
6
|
+
it "can build a css class for when it is not present based on id" do
|
7
|
+
section = SectionPresenter.new(:fallback_html => 'foobar', :id => 'mynode')
|
8
|
+
section.not_present_css_class.should == 'no_mynode'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "allows access to constructor arguments" do
|
12
|
+
section = SectionPresenter.new(:fallback_html => 'foobar', :id => 'mynode', :hidden => true)
|
13
|
+
section.fallback_html.should == 'foobar'
|
14
|
+
section.id.should == 'mynode'
|
15
|
+
section.should be_hidden
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be visible if not hidden" do
|
19
|
+
section = SectionPresenter.new(:hidden => false)
|
20
|
+
section.should be_visible
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be not visible if hidden" do
|
24
|
+
section = SectionPresenter.new(:hidden => true)
|
25
|
+
section.should_not be_visible
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "when building html for a section" do
|
29
|
+
it "wont show a hidden section" do
|
30
|
+
section = SectionPresenter.new(:fallback_html => 'foobar', :hidden => true)
|
31
|
+
section.has_content?(true).should be_false
|
32
|
+
section.wrapped_html(true).should be_nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it "can be hidden with the hide method" do
|
36
|
+
section = SectionPresenter.new(:fallback_html => 'foobar')
|
37
|
+
section.hide
|
38
|
+
section.has_content?(true).should be_false
|
39
|
+
section.wrapped_html(true).should be_nil
|
40
|
+
end
|
41
|
+
|
42
|
+
it "will use the specified id" do
|
43
|
+
section = SectionPresenter.new(:fallback_html => 'foobar', :id => 'mynode')
|
44
|
+
section.has_content?(true).should be_true
|
45
|
+
section.wrapped_html(true).should == '<section id="mynode"><div class="inner">foobar</div></section>'
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "if allowed to use fallback html" do
|
49
|
+
it "wont show a section with no fallback or override" do
|
50
|
+
section = SectionPresenter.new
|
51
|
+
section.has_content?(true).should be_false
|
52
|
+
section.wrapped_html(true).should be_nil
|
53
|
+
end
|
54
|
+
|
55
|
+
it "uses wrapped fallback html" do
|
56
|
+
section = SectionPresenter.new(:fallback_html => 'foobar')
|
57
|
+
section.has_content?(true).should be_true
|
58
|
+
section.wrapped_html(true).should == '<section><div class="inner">foobar</div></section>'
|
59
|
+
end
|
60
|
+
|
61
|
+
it "uses wrapped override html if present" do
|
62
|
+
section = SectionPresenter.new(:fallback_html => 'foobar')
|
63
|
+
section.override_html = 'hello world'
|
64
|
+
section.has_content?(true).should be_true
|
65
|
+
section.wrapped_html(true).should == '<section><div class="inner">hello world</div></section>'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "if not allowed to use fallback html" do
|
70
|
+
it "wont show a section with no override" do
|
71
|
+
section = SectionPresenter.new(:fallback_html => 'foobar')
|
72
|
+
section.has_content?(false).should be_false
|
73
|
+
section.wrapped_html(false).should be_nil
|
74
|
+
end
|
75
|
+
|
76
|
+
it "uses wrapped override html if present" do
|
77
|
+
section = SectionPresenter.new(:fallback_html => 'foobar')
|
78
|
+
section.override_html = 'hello world'
|
79
|
+
section.has_content?(false).should be_true
|
80
|
+
section.wrapped_html(false).should == '<section><div class="inner">hello world</div></section>'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Pages
|
5
|
+
describe TitleSectionPresenter do
|
6
|
+
describe "when building html for a section" do
|
7
|
+
it "wraps a title section in a title element" do
|
8
|
+
section = TitleSectionPresenter.new(:fallback_html => 'foobar')
|
9
|
+
section.has_content?(true).should be_true
|
10
|
+
section.wrapped_html(true).should == '<h1>foobar</h1>'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "will use the specified id" do
|
14
|
+
section = TitleSectionPresenter.new(:fallback_html => 'foobar', :id => 'mynode')
|
15
|
+
section.has_content?(true).should be_true
|
16
|
+
section.wrapped_html(true).should == '<h1 id="mynode">foobar</h1>'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
describe Pages do
|
5
|
+
describe ".valid_templates" do
|
6
|
+
before do
|
7
|
+
File.open(File.join(subject.root, "spec", "ugisozols.html"), "w+") do
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
after { File.delete(File.join(subject.root, "spec", "ugisozols.html")) }
|
12
|
+
|
13
|
+
context "when pattern match valid templates" do
|
14
|
+
it "returns an array of valid templates" do
|
15
|
+
subject.valid_templates('spec', '*html*').should include("ugisozols")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "when pattern doesn't match valid templates" do
|
20
|
+
it "returns empty array" do
|
21
|
+
subject.valid_templates('huh', '*html*').should == []
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|