Sha256: f172c97eaf4198aad44dcdb9710cb29afa9b91ac3c61ea58586b9969a433ebfc
Contents?: true
Size: 899 Bytes
Versions: 4
Compression:
Stored size: 899 Bytes
Contents
require 'spec_helper' module Stash module Wrapper describe Size do describe '#initialize' do attr_accessor :params before(:each) do @params = { bytes: 12_345 } end it 'sets fields from parameters' do size = Size.new(params) expect(size.size).to eq(12_345) expect(size.unit).to eq(SizeUnit::BYTE) end it 'rejects a nil byte count' do params.delete(:bytes) expect { Size.new(params) }.to raise_error(ArgumentError) end it 'rejects a non-integer byte count' do params[:bytes] = 1.1 expect { Size.new(params) }.to raise_error(ArgumentError) end it 'rejects a non-numeric byte count' do params[:bytes] = '1' expect { Size.new(params) }.to raise_error(ArgumentError) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems