aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/spec_helper.rb12
-rw-r--r--spec/unit/controller/call_spec.rb14
2 files changed, 26 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 154faf4..909e1e8 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,6 +1,18 @@
+unless RUBY_ENGINE == 'rbx' then
+ require 'simplecov'
+ SimpleCov.start do
+ add_filter '_spec.rb'
+ end
+end
+
require 'rack'
require 'zero/all'
+class SpecController < Zero::Controller
+ def process; end
+ def render; @response = [200, {'Content-Type' => 'text/html'}, ['foo']]; end
+end
+
class SpecApp
attr_reader :env
diff --git a/spec/unit/controller/call_spec.rb b/spec/unit/controller/call_spec.rb
new file mode 100644
index 0000000..af6f719
--- /dev/null
+++ b/spec/unit/controller/call_spec.rb
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe Zero::Controller, '.call' do
+ subject { SpecController.call(env) }
+ let(:env) { EnvGenerator.get('/foo') }
+
+ it "returns a response" do
+ subject.should be_respond_to(:to_a)
+ end
+
+ it "returns an object with the first element being a status" do
+ subject[0].should be_kind_of(Numeric)
+ end
+end