summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGibheer <gibheer@gmail.com>2013-02-12 08:39:45 +0100
committerGibheer <gibheer@gmail.com>2013-02-12 08:39:45 +0100
commita6fa1475a2fc185f90e52ac20941562649a655da (patch)
tree47beebbc8dc9c000a158cd15eb4df827fe1478b9
parentf18ab69a91cb736efc59fa82b8ae88f61bd1abe2 (diff)
cleanup old specs
-rw-r--r--spec/unit/zero/renderer/read_template_path_bang_spec.rb64
1 files changed, 7 insertions, 57 deletions
diff --git a/spec/unit/zero/renderer/read_template_path_bang_spec.rb b/spec/unit/zero/renderer/read_template_path_bang_spec.rb
index 948a3cc..9a2f875 100644
--- a/spec/unit/zero/renderer/read_template_path_bang_spec.rb
+++ b/spec/unit/zero/renderer/read_template_path_bang_spec.rb
@@ -2,65 +2,15 @@ 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'
+ let(:template_path) { 'spec/fixtures/templates/' }
+ let(:type_map) { {'html' => ['text/html']} }
+ let(:result) { {
+ 'text/html' => template_path + 'index.html.erb',
+ 'json' => template_path + 'index.json.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/", {})
+ it "loads the templates" do
subject.read_template_path!
-
- subject.templates.should eq({})
+ expect(subject.templates['index']).to eq(result)
end
end