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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
require File.expand_path('../../helper', __FILE__)
class SpecMock
include Innate::Node
map '/'
def index
''
end
end
class SpecMock2
include Innate::Node
map '/deep'
def index
'spec mock 2'
end
def foo
'spec mock 2 foo'
end
end
describe 'Innate::SpeckMock2' do
should 'handle get request' do
response = Innate::Mock.get('/deep/foo')
# '/foo/bar'
response.status.should == 200
response.body.should == 'spec mock 2 foo'
end
end
describe 'Innate::SpecMock' do
should 'handle get request' do
response = Innate::Mock.get('/')
# '/one'
response.status.should == 200
response.body.should == ''
end
should 'handle post request' do
response = Innate::Mock.post('/')
# '/'
response.status.should == 200
response.body.should == ''
end
should 'handle head request' do
response = Innate::Mock.head('/')
response.status.should == 200
response.body.should == ''
end
should 'handle delete request' do
response = Innate::Mock.delete('/')
response.status.should == 200
response.body.should == ''
end
should 'handle put request' do
response = Innate::Mock.put('/')
response.status.should == 200
response.body.should == ''
end
should 'handle options request' do
response = Innate::Mock.options('/')
response.status.should == 200
response.body.should == ''
end
should 'handle connect request' do
response = Innate::Mock.connect('/')
response.status.should == 200
response.body.should == ''
end
should 'handle trace request' do
response = Innate::Mock.trace('/')
response.status.should == 200
response.body.should == ''
end
end
|