Sha256: 8c28dc9bbac281422abe243c78c339838b948837c8359d13319e4337842cea64
Contents?: true
Size: 948 Bytes
Versions: 3
Compression:
Stored size: 948 Bytes
Contents
require 'spec_helper' module Qrb describe SeqType, 'dress' do let(:type){ SeqType.new(byte) } subject{ type.dress(arg) } context 'with an empty array' do let(:arg){ [] } it{ should eq([]) } end context 'with a valid array' do let(:arg){ [12, 16] } it{ should eq([12, 16]) } end context 'with not a enumerable' do let(:arg){ "foo" } it 'should raise an error' do ->{ subject }.should raise_error("Invalid value `foo` for [Byte]") end end context 'with an array with non bytes' do let(:arg){ [2, 4, -12] } subject{ type.dress(arg) rescue $! } it 'should raise an error' do subject.should be_a(TypeError) subject.message.should eq("Invalid value `-12` for Byte") end it 'should have correct location' do subject.location.should eq("2") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
qrb-0.3.0 | spec/unit/type/seq_type/test_dress.rb |
qrb-0.2.0 | spec/unit/type/seq_type/test_dress.rb |
qrb-0.1.0 | spec/unit/type/seq_type/test_dress.rb |