diff options
author | Stormwind <stormwind@stormwinds-page.de> | 2013-01-06 20:24:39 +0100 |
---|---|---|
committer | Stormwind <stormwind@stormwinds-page.de> | 2013-01-06 20:24:39 +0100 |
commit | 3a82183563986d368e81b5c314e69f169805fd1f (patch) | |
tree | 76a9debc31491d179163dd4ed10ed465e2250ecc /spec/unit/renderer/read_template_path_spec.rb | |
parent | b54c2569a4f22feb750edb723ddfa3e7d33a70f5 (diff) |
Improve test structure
Created folder spec/unit/zero and moved all unittest into this folder.
Diffstat (limited to 'spec/unit/renderer/read_template_path_spec.rb')
-rw-r--r-- | spec/unit/renderer/read_template_path_spec.rb | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/spec/unit/renderer/read_template_path_spec.rb b/spec/unit/renderer/read_template_path_spec.rb deleted file mode 100644 index 8655777..0000000 --- a/spec/unit/renderer/read_template_path_spec.rb +++ /dev/null @@ -1,66 +0,0 @@ -require 'spec_helper' - -describe Zero::Renderer, 'read_template_path!' do - subject { Zero::Renderer.new(template_path, type_map) } - let(:template_path) { 'foo' } - let(:file_list) { ['foo/welcome/index.html.erb'] } - - before :each do - Dir.stub(:[]) do |arg| - if arg == 'foo/**/*.*' - file_list - else - [] - end - end - end - - shared_examples_for 'a template loader' do - it 'creates a template tree' do - subject.read_template_path! - subject.templates['welcome/index'].should eq(result) - end - end - - context 'without mapping' do - let(:type_map) { {} } - let(:result) { { 'html' => 'foo/welcome/index.html.erb' } } - - it_behaves_like 'a template loader' - end - - context 'with a single mapping' do - let(:type_map) { {'html' => 'text/html' } } - let(:result) { { 'text/html' => 'foo/welcome/index.html.erb' } } - - it_behaves_like 'a template loader' - end - - context 'with multiple mappings' do - let(:type_map) { {'html' => ['text/html', 'text/xml'] } } - let(:result) { { - 'text/html' => 'foo/welcome/index.html.erb', - 'text/xml' => 'foo/welcome/index.html.erb' - } } - - it_behaves_like 'a template loader' - end - - context 'with default template' do - let(:file_list) {['foo/welcome/index.erb']} - let(:type_map) { {'default' => ['text/html', 'text/xml'] } } - let(:result) { { - 'text/html' => 'foo/welcome/index.erb', - 'text/xml' => 'foo/welcome/index.erb' - } } - - it_behaves_like 'a template loader' - end - - it 'creates an empty templates list without templates in path' do - subject = Zero::Renderer.new("bar", {}) - subject.read_template_path! - - subject.templates.should eq({}) - end -end |