Skip to content

Commit

Permalink
add spec about removing empty locale hash after last attribute is del…
Browse files Browse the repository at this point in the history
…eted
  • Loading branch information
doits committed Dec 2, 2021
1 parent c21ee94 commit ace21a7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/mobility/backends/active_record/container_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
.and not_change { post.changed? }.from(false)
end
end

it 'deletes locale hash if last attribute is removed' do
post = ContainerPost.create!

::Mobility.with_locale(:en) { post.title = 'Title en' }
::Mobility.with_locale(:de) { post.title = 'Title de' }

expect { post.title = nil }
.to change { post.translations }
.from({ "en" => { "title" => "Title en" }, "de" => { "title" => "Title de" }})
.to({ "de" => { "title" => "Title de" }})
end
end

context "with query plugin" do
Expand Down

0 comments on commit ace21a7

Please sign in to comment.