Sha256: 6671fdd210a9c53eaedbe89126270170e25997aa846658bd519eea71c9f0b95d
Contents?: true
Size: 1.74 KB
Versions: 19
Compression:
Stored size: 1.74 KB
Contents
require 'spec_helper' module Finitio describe SubType, "dress" do let(:type){ SubType.new(intType, [byte_full], "byte") } subject{ type.dress(arg) } context 'with an valid Integer' do let(:arg){ 12 } it{ should be(arg) } end context 'when raising an Error' do subject do type.dress(arg) rescue $! end context 'with a Float' do let(:arg){ 12.0 } it 'should raise an Error' do expect(subject).to be_a(TypeError) expect(subject.message).to eq("Invalid byte `12.0`") end it "should have the proper cause from super type's up" do expect(subject.cause).to be_a(TypeError) expect(subject.cause.message).to eq("Invalid intType `12.0`") end it "should have an empty location" do expect(subject.location).to eq('') end end context 'with a negative integer' do let(:arg){ -12 } it 'should raise an Error' do expect(subject).to be_a(TypeError) expect(subject.message).to eq("Invalid byte `-12`") end it "should have no cause" do expect(subject.cause).to be_nil end it "should have an empty location" do expect(subject.location).to eq('') end end context 'with a non small integer' do let(:arg){ 1000 } it 'should raise an Error' do expect(subject).to be_a(TypeError) expect(subject.message).to eq("Invalid byte `1000`") end it "should have no cause" do expect(subject.cause).to be_nil end it "should have an empty location" do expect(subject.location).to eq('') end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems