aboutsummaryrefslogtreecommitdiff
path: root/spec/unit/renderer/render_spec.rb
diff options
context:
space:
mode:
authorStormwind <stormwind@stormwinds-page.de>2013-01-06 20:24:39 +0100
committerStormwind <stormwind@stormwinds-page.de>2013-01-06 20:24:39 +0100
commit3a82183563986d368e81b5c314e69f169805fd1f (patch)
tree76a9debc31491d179163dd4ed10ed465e2250ecc /spec/unit/renderer/render_spec.rb
parentb54c2569a4f22feb750edb723ddfa3e7d33a70f5 (diff)
Improve test structure
Created folder spec/unit/zero and moved all unittest into this folder.
Diffstat (limited to 'spec/unit/renderer/render_spec.rb')
-rw-r--r--spec/unit/renderer/render_spec.rb54
1 files changed, 0 insertions, 54 deletions
diff --git a/spec/unit/renderer/render_spec.rb b/spec/unit/renderer/render_spec.rb
deleted file mode 100644
index 30d2225..0000000
--- a/spec/unit/renderer/render_spec.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-require 'spec_helper'
-
-describe Zero::Renderer, '#render' do
- subject { Zero::Renderer.new(template_path, type_map) }
- let(:template_path) { 'spec/fixtures/templates' }
- let(:type_map) {{
- 'html' => ['text/html', 'text/xml', '*/*'],
- 'json' => ['application/json', 'plain/text']
- }}
- let(:html_types) { ['text/html'] }
- let(:json_types) { ['application/json'] }
- let(:foo_types) { ['foo/bar', 'bar/foo'] }
- let(:binding) { SpecTemplateContext.new('foo') }
-
- before :each do
- subject.read_template_path!
- end
-
- it 'returns a tilt template' do
- subject.render('index', html_types, binding).should be_kind_of(String)
- end
-
- it 'renders html content' do
- subject.render('index', html_types, binding).should match('success')
- end
-
- it 'returns a tilt template for different types' do
- subject.render('index', json_types, binding).should be_kind_of(String)
- end
-
- it 'renders json content' do
- subject.render('index', json_types, binding).should match("{text: 'success'}")
- end
-
- it 'returns an ArgumentError, if given template does not exist' do
- expect {
- subject.render('foobar', html_types, binding)
- }.to raise_error(ArgumentError, "No template found for 'foobar'!")
- end
-
- it 'returns an ArgumentError, if no template fits types' do
- expect {
- subject.render('index', foo_types, binding)
- }.to raise_error(
- ArgumentError,
- "No template found for any of this types #{foo_types.join ', '}!"
- )
- end
-
- it 'uses the context' do
- subject.render('context', html_types, binding).should match('foo')
-
- end
-end