From 1133c4106ffb92418866de9f917ce4687164e63b Mon Sep 17 00:00:00 2001 From: Gibheer Date: Mon, 4 Feb 2013 18:03:43 +0100 Subject: rename spec for mutant That kills 52 mutations! --- .../zero/renderer/read_template_path_bang_spec.rb | 66 ++++++++++++++++++++++ spec/unit/zero/renderer/read_template_path_spec.rb | 66 ---------------------- 2 files changed, 66 insertions(+), 66 deletions(-) create mode 100644 spec/unit/zero/renderer/read_template_path_bang_spec.rb delete mode 100644 spec/unit/zero/renderer/read_template_path_spec.rb (limited to 'spec/unit') diff --git a/spec/unit/zero/renderer/read_template_path_bang_spec.rb b/spec/unit/zero/renderer/read_template_path_bang_spec.rb new file mode 100644 index 0000000..8655777 --- /dev/null +++ b/spec/unit/zero/renderer/read_template_path_bang_spec.rb @@ -0,0 +1,66 @@ +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 diff --git a/spec/unit/zero/renderer/read_template_path_spec.rb b/spec/unit/zero/renderer/read_template_path_spec.rb deleted file mode 100644 index 8655777..0000000 --- a/spec/unit/zero/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 -- cgit v1.2.3-70-g09d2