Sha256: 1916876f45f3a249f5892f568703260373ab0998d4a03f52c7977f5bbf748934
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' describe Klomp::Frames do Given(:options) { {'login' => 'admin', 'passcode' => 'password', 'host' => '127.0.0.1'} } context "CONNECT" do When(:connect) { Klomp::Frames::Connect.new(options).to_s } Then { connect.should == frame(:connect) } end context "CONNECTED" do When(:connected) { Klomp::Frames::Connected.new frame(:connected) } Then { connected.headers['version'].should == "1.1" } end context "stringifies all header keys and values" do Given(:headers) { { :timeout => 42 } } When(:send_frame) { Klomp::Frames::Send.new("/queue/q", "", headers) } Then { send_frame.to_s.should =~ /timeout:42/ } end context "#[] is an alias for #headers" do When(:connect) { Klomp::Frames::Connect.new(options) } When { connect['my-header'] = 'my-value' } Then { connect['login'].should == 'admin' } Then { connect['passcode'].should == 'password' } Then { connect['my-header'].should == 'my-value' } end context "body can be assigned after construction" do Given(:send_frame) { Klomp::Frames::Send.new("/queue/q", "", {}) } When { send_frame.body = "hello" } Then { send_frame.body.should == "hello" } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
klomp-1.0.8 | spec/klomp/frames_spec.rb |
klomp-1.0.7 | spec/klomp/frames_spec.rb |