example/howto_spec.rb in manveru-innate-2009.02.21 vs example/howto_spec.rb in manveru-innate-2009.02.25
- old
+ new
@@ -1,60 +1,35 @@
+require 'rubygems'
require 'innate'
-require 'bacon'
class SpecMe
- include Innate::Node
- map '/'
+ Innate.node '/'
def index
"I should be at /"
end
def foo
- action.content_type = 'text/css'
+ response['Content-Type'] = 'text/css'
"I should be at /foo"
end
end
-class SpecMeToo
- include Innate::Node
- map '/too'
+require 'innate/spec'
- def index
- "I should be at /too"
- end
-
- def foo
- action.content_type = 'text/css'
- "I should be at /too/foo"
- end
-end
-
-Innate.setup_middleware
-
-Bacon.summary_on_exit
-Bacon.extend(Bacon::TestUnitOutput)
-
describe 'An example spec' do
- def assert(url, body, content_type)
- response = Innate::Mock.get(url)
- response.status.should == 200
- response.body.should == body
- response.content_type.should == content_type
- end
+ behaves_like :mock
should 'respond to /' do
- assert('/', "I should be at /", 'text/html')
+ got = get('/')
+ got.status.should == 200
+ got.body.should == "I should be at /"
+ got['Content-Type'].should == 'text/html'
end
- should 'respond to /foo' do
- assert('/foo', "I should be at /foo", 'text/css')
- end
-
- should 'respond to /too' do
- assert('/too', "I should be at /too", 'text/html')
- end
-
- should 'respond to /too/foo' do
- assert('/too/foo', "I should be at /too/foo", 'text/css')
+ should 'respond to /' do
+ got = get('/foo')
+ got.status.should == 200
+ got.body.should == "I should be at /foo"
+ got['Content-Type'].should == 'text/css'
end
end