Sha256: bd252702afc08449ea5ed08eec00e7e1e9ab02ce5e3bd245520d74cb003ec87e

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
module Stomper
  module Frames
    describe IndirectFrame do
      describe "interface" do
        before(:each) do
          @indirect_frame = IndirectFrame.new({}, nil, "INDIRECT_COMMAND")
        end

        it "should provide a command attribute" do
          @indirect_frame.should respond_to(:command)
        end
        it "should provide a body attribute" do
          @indirect_frame.should respond_to(:body)
        end
        it "should provide a headers attribute" do
          @indirect_frame.should respond_to(:headers)
        end
      end

      describe "command name" do
        class UnnamedIndirectFrame < IndirectFrame; end
        class NamedIndirectFrame < IndirectFrame
          def initialize
            super({}, nil, :test_command)
          end
        end

        it "should use its class name if no command is specified" do
          @indirect_frame = IndirectFrame.new({}, nil)
          @indirect_frame.command.should == "INDIRECTFRAME"
          @unnamed_frame = UnnamedIndirectFrame.new
          @unnamed_frame.command.should == "UNNAMEDINDIRECTFRAME"
        end

        it "should use a provided command name when it is provided" do
          @indirect_frame = IndirectFrame.new({}, nil, "MY_COMMAND")
          @indirect_frame.command.should == "MY_COMMAND"
          @named_frame = NamedIndirectFrame.new
          @named_frame.command.should == "TEST_COMMAND"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stomper-1.0.0 spec/frames/indirect_frame_spec.rb