Skip to content

Commit

Permalink
Reintroduce prefers_digital_correspondence field to person and add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWalkingLeek committed Sep 23, 2024
1 parent 45c9129 commit c4f36ed
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/views/contactable/_address_fields_pbs.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- if entry.is_a?(Person)
= field_set_tag do
= f.labeled_boolean_field :prefers_digital_correspondence
1 change: 0 additions & 1 deletion app/views/person/households/_custom_fields_pbs.html.haml

This file was deleted.

29 changes: 29 additions & 0 deletions spec/views/people/_fields.html.haml_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'spec_helper'

describe 'people/_form.html.haml' do
let(:group) { person.primary_group }
let(:person) do
people(:bulei)
end
let(:stubs) {
{ path_args: [group, person], model_class: Person, entry: person }
}

before do
allow(view).to receive_messages(stubs)
allow(controller).to receive_messages(current_user: person)
end

let(:dom) do
render partial: "people/form"
Capybara::Node::Simple.new(rendered)
end

describe "prefers_digital_correspondence" do
it "renders field" do
expect(dom).to have_css("label", text: "Digitale Korrespondenz bevorzugt")
expect(dom).to have_css("input[name='person[prefers_digital_correspondence]']")
end
end

end

0 comments on commit c4f36ed

Please sign in to comment.