Add nuuo response spec

master
Jacob Robles 2019-04-22 08:14:25 -05:00
parent 01b1c42b1a
commit d7c8c9ffff
No known key found for this signature in database
GPG Key ID: 3EC9F18F2B12401C
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# -*- coding:binary -*-
require 'rex/proto/nuuo/response'
RSpec.describe Rex::Proto::Nuuo::Response do
subject(:response) {described_class.new}
let(:header) {'Header'}
let(:hvalue) {'Value'}
let(:body) {'test'}
let(:data) {"NUCM/1.0 200\r\n#{header}:#{hvalue}\r\nContent-Length:4\r\n\r\n#{body}"}
describe '#parse' do
it 'returns a ParseCode' do
expect(response.parse(data)).to eq(Rex::Proto::Nuuo::Response::ParseCode::Completed)
end
it 'sets the headers' do
response.parse(data)
expect(response.headers[header]).to eq(hvalue)
end
it 'sets the body' do
response.parse(data)
expect(response.body).to eq(body)
end
end
end