Sha256: bce2b874913ab35072f75402d03f45cad615249a41ee50944536043fa7d2fb02
Contents?: true
Size: 878 Bytes
Versions: 3
Compression:
Stored size: 878 Bytes
Contents
require 'spec_helper' require 'attributor/extras/field_selector' describe Attributor::FieldSelector do subject(:type) { Attributor::FieldSelector } it 'loads a Hash' do expect(subject.load('one,two')).to be_kind_of(::Hash) end context 'loading all the test combinations' do cases = { nil => nil, '' => {}, 'one' => { one: true }, 'one,two,three' => { one: true, two: true, three: true }, 'one,two{a,b},three' => { one: true, two: { a: true, b: true }, three: true }, 'one,two{a,b,c{A,B}},three' => { one: true, two: { a: true, b: true, c: { A: true, B: true } }, three: true } } cases.each do |fields, result| it "loads #{fields.inspect}" do loaded = subject.load(fields) loaded.should eq result end end end end
Version data entries
3 entries across 3 versions & 1 rubygems