From d7c8c9ffff4b61f6f88568192029875bae0da0a7 Mon Sep 17 00:00:00 2001 From: Jacob Robles Date: Mon, 22 Apr 2019 08:14:25 -0500 Subject: [PATCH] Add nuuo response spec --- spec/lib/rex/proto/nuuo/response_spec.rb | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/lib/rex/proto/nuuo/response_spec.rb diff --git a/spec/lib/rex/proto/nuuo/response_spec.rb b/spec/lib/rex/proto/nuuo/response_spec.rb new file mode 100644 index 0000000000..9f93563e73 --- /dev/null +++ b/spec/lib/rex/proto/nuuo/response_spec.rb @@ -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