1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
require File.expand_path('../../helper', __FILE__)
class SpecModeDummy
Innate.node '/'
def index
'Hello, World!'
end
def random
rand.to_s
end
end
describe 'Innate modes' do
describe 'dev' do
behaves_like :rack_test
Innate.options.mode = :dev
should 'handle GET request' do
get('/').status.
should == 200
last_response.headers.
should == {'Content-Length' => '13', 'Content-Type' => 'text/html'}
last_response.body.
should == 'Hello, World!'
end
should 'handle HEAD requests by omitting body' do
head('/').status.
should == 200
last_response.headers.
should == {'Content-Length' => '13', 'Content-Type' => 'text/html'}
last_response.body.
should == ''
end
end
describe 'live' do
behaves_like :rack_test
Innate.options.mode = :live
should 'handle GET request' do
get('/').status.
should == 200
last_response.headers.
should == {'Content-Length' => '13', 'Content-Type' => 'text/html'}
last_response.body.
should == 'Hello, World!'
end
should 'handle HEAD requests by omitting body' do
head('/').status.
should == 200
last_response.headers.
should == {'Content-Length' => '13', 'Content-Type' => 'text/html'}
last_response.body.
should == ''
end
end
end
|