Skip to content

Commit

Permalink
add some specs for has one arrays for relation model builder
Browse files Browse the repository at this point in the history
  • Loading branch information
rferg committed Jan 12, 2024
1 parent e7c1e7d commit fd4278a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions spec/active_force/association/relation_model_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,36 @@ module Association
end
end

context 'with a restforce collection value' do
let(:value) do
build_restforce_collection([
build_restforce_sobject('Id' => 'first'),
build_restforce_sobject('Id' => 'second')
])
end

it 'returns a child for the first value' do
actual = instance.build_relation_model
expect(actual).to be_a(HasOneChild)
expect(actual.id).to eq('first')
end
end

context 'with an array value' do
let(:value) do
[
build_restforce_sobject('Id' => 'first'),
build_restforce_sobject('Id' => 'second')
]
end

it 'returns a child for the first value' do
actual = instance.build_relation_model
expect(actual).to be_a(HasOneChild)
expect(actual.id).to eq('first')
end
end

context 'without a value' do
let(:value){ nil }

Expand Down

0 comments on commit fd4278a

Please sign in to comment.