mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
Merge pull request #5827 from jeduardo824/bug/remove-environment-column-when-user-is-not-super-admin
Bug/4592 - Hide Environment column on Payment Methods page when user is not admin
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "spree/admin/payment_methods/index.html.haml" do
|
||||
include AuthenticationHelper
|
||||
|
||||
before do
|
||||
controller.singleton_class.class_eval do
|
||||
helper_method :new_object_url, :edit_object_url, :object_url
|
||||
@@ -19,10 +21,52 @@ describe "spree/admin/payment_methods/index.html.haml" do
|
||||
end
|
||||
|
||||
describe "payment methods index page" do
|
||||
it "shows only the providers of the existing payment methods" do
|
||||
render
|
||||
context "when user is not admin" do
|
||||
before do
|
||||
allow(view).to receive_messages spree_current_user: create(:user)
|
||||
end
|
||||
|
||||
expect(rendered).to have_content "Cash/EFT/etc. (payments for which automatic validation is not required)", count: 2
|
||||
it "shows only the providers of the existing payment methods" do
|
||||
render
|
||||
|
||||
expect(rendered).to have_content "Cash/EFT/etc. (payments for which automatic validation is not required)", count: 2
|
||||
end
|
||||
|
||||
it "does not show Enviroment column" do
|
||||
render
|
||||
|
||||
expect(rendered).not_to have_content "Environment"
|
||||
end
|
||||
|
||||
it "does not show column content" do
|
||||
render
|
||||
|
||||
expect(rendered).not_to have_content "Test"
|
||||
end
|
||||
end
|
||||
|
||||
context "when user is admin" do
|
||||
before do
|
||||
allow(view).to receive_messages spree_current_user: create(:admin_user)
|
||||
end
|
||||
|
||||
it "shows only the providers of the existing payment methods" do
|
||||
render
|
||||
|
||||
expect(rendered).to have_content "Cash/EFT/etc. (payments for which automatic validation is not required)", count: 2
|
||||
end
|
||||
|
||||
it "shows the Enviroment column" do
|
||||
render
|
||||
|
||||
expect(rendered).to have_content "Environment"
|
||||
end
|
||||
|
||||
it "shows the column content" do
|
||||
render
|
||||
|
||||
expect(rendered).to have_content "Test"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user