From 019bccd4a2d83571eabb58662f3be44f0f3d9951 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Sat, 17 Nov 2012 14:23:01 +0100 Subject: add a spec controller --- spec/spec_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 154faf4..c345b2c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,11 @@ 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 -- cgit v1.2.3-70-g09d2 From 8e1b79663c1ac1a105e0e1103b4d09c0d897371d Mon Sep 17 00:00:00 2001 From: Gibheer Date: Sat, 17 Nov 2012 14:23:20 +0100 Subject: added a basic spec for the controller --- spec/unit/controller/call_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 spec/unit/controller/call_spec.rb (limited to 'spec') 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 -- cgit v1.2.3-70-g09d2 From 495d8f650302d5226cd677b062891ea9021483d5 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Tue, 20 Nov 2012 20:36:25 +0100 Subject: add simplecov to get metrics This only works with MRI, but should be good enough. --- spec/spec_helper.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c345b2c..909e1e8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,10 @@ +unless RUBY_ENGINE == 'rbx' then + require 'simplecov' + SimpleCov.start do + add_filter '_spec.rb' + end +end + require 'rack' require 'zero/all' -- cgit v1.2.3-70-g09d2