Skip to content

Commit

Permalink
Fix persistance of the area in initiative creation (decidim#11476)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecslupu authored Aug 17, 2023
1 parent bf8efbb commit e8999d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def build_initiative
scoped_type:,
signature_type: form.type.signature_type,
decidim_user_group_id: form.decidim_user_group_id,
decidim_area_id: form.area_id,
state: "created"
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Initiatives
described_class.new(form, author)
end

let(:area) { create(:area, organization:) }
let(:scoped_type) { create(:initiatives_type_scope) }
let(:organization) { scoped_type.type.organization }
let(:author) { create(:user, organization:) }
Expand All @@ -55,12 +56,18 @@ module Initiatives
type_id: scoped_type.type.id,
signature_type: "online",
scope_id: scoped_type.scope.id,
decidim_user_group_id: nil
decidim_user_group_id: nil,
area_id: area.id
}
end
let(:follower) { create(:user, organization:) }
let!(:follow) { create(:follow, followable: author, user: follower) }

it "sets the area" do
subject.call
expect(Decidim::Initiative.last.area).to eq(area)
end

it "does not notify author about committee request" do
expect(Decidim::EventsManager)
.not_to receive(:publish)
Expand Down

0 comments on commit e8999d3

Please sign in to comment.