Sha256: b7a5c02cbd12b4f6bea32b1d4add923fdd6ddbf1644b05d5e4000cd36b20f23a
Contents?: true
Size: 1.4 KB
Versions: 18
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe Frodo::Properties::Collection do let(:subject) { Frodo::Properties::Collection.new('Names', names) } let(:names) { %w[Dan Greg Jon] } let(:new_names) { %w[Andrew Doug Paul] } it { expect(subject.type).to eq('Collection(Edm.String)') } it { expect(subject.value).to eq(['Dan', 'Greg', 'Jon']) } it { expect(subject.url_value).to eq("['Dan','Greg','Jon']") } describe '#value=' do it 'allows an array of string values to be set' do subject.value = new_names expect(subject.value).to eq(new_names) end end # TODO: Make collection type work properly with data types other than string xcontext 'with value type other than Edm.String' do let(:subject) { Frodo::Properties::Collection.new('Bits', [1, 0, 1], value_type: 'Edm.Binary') } it { expect(subject.type).to eq('Collection(Edm.Int32)') } it { expect(subject.value).to eq([1, 0, 1]) } it { expect(subject.url_value).to eq('[1,0,1]') } it 'does not allow other property types to be set' do expect { subject.value = names }.to raise_error(ArgumentError) end xdescribe 'lenient validation' do let(:subject) do Frodo::Properties::Collection.new('Names', names, value_type: 'Edm.String', strict: false) end it 'ignores invalid values' do subject.value = [1, 2, 3] expect(subject.value).to eq([]) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems