Skip to content

Commit

Permalink
Merge pull request #1 from coopdevs/fix/authorizations-collection-sco…
Browse files Browse the repository at this point in the history
…pe-devel

Fix/authorizations collection scope devel
  • Loading branch information
sauloperez authored Nov 4, 2020
2 parents 60d8dc4 + b79c655 commit 0bafff3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ def destroy
private

def collection
Decidim::Authorization.where(name: "direct_verifications").includes(:user)
# Decidim::Verifications::Authorizations Query
Decidim::Verifications::Authorizations.new(
organization: current_organization,
name: "direct_verifications",
granted: true
).query
end

def authorization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
describe "Admin manages imported authorizations", type: :system do
let(:organization) { create(:organization) }
let(:user) { create(:user, :admin, :confirmed, organization: organization) }
let(:out_of_scope_user) { create(:user, :confirmed) }

let!(:authorization) { create(:authorization, :direct_verification) }
let!(:authorization) { create(:authorization, :direct_verification, user: user) }
let!(:out_of_scope_authorization) { create(:authorization, :direct_verification, user: out_of_scope_user) }
let!(:non_direct_authorization) { create(:authorization) }

let(:scope) { "decidim.direct_verifications.verification.admin" }
Expand Down Expand Up @@ -36,6 +38,7 @@
end

expect(page).not_to have_content(non_direct_authorization.name)
expect(page).not_to have_content(out_of_scope_authorization.user.name)
end

it "lets users navigate to stats and new import" do
Expand Down

0 comments on commit 0bafff3

Please sign in to comment.