-
-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolves #4739 #4763
base: main
Are you sure you want to change the base?
Resolves #4739 #4763
Changes from 2 commits
39c7550
3aec94e
cb17ab1
f7b416a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,34 @@ | |
expect(page).to have_content 'Endless drive' | ||
end | ||
end | ||
|
||
context "when deleting a Product drive" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we move these tests to request tests? There's no reason to load a whole browser to test the HTML output by the controller. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it! Thanks for the heads-up |
||
let(:new_product_drive) { create(:product_drive, name: 'New Test', start_date: 3.weeks.ago, end_date: 3.weeks.from_now, organization: organization) } | ||
let(:subject) { product_drive_path(new_product_drive.id) } | ||
|
||
context "when user is a org_admin" do | ||
before do | ||
user.add_role(:org_admin, organization) | ||
end | ||
|
||
it "must delete" do | ||
visit subject | ||
click_on 'Delete' | ||
expect(page).to have_content 'Product drive was successfully destroyed.' | ||
end | ||
|
||
it "must not delete if there are donations" do | ||
create(:donation, product_drive: new_product_drive) | ||
visit subject | ||
expect(page).not_to have_button 'Delete' | ||
end | ||
end | ||
|
||
context "when user is not a org_admin" do | ||
it "must not delete" do | ||
visit subject | ||
expect(page).not_to have_button 'Delete' | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉