mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Don't show the banner if enterprises are not required to accepte ToS
This commit is contained in:
committed by
Konrad
parent
6226067846
commit
8371eada23
@@ -117,6 +117,8 @@ module Spree
|
||||
|
||||
return unless spree_user_signed_in?
|
||||
|
||||
return if Spree::Config.enterprises_require_tos == false
|
||||
|
||||
return if accepted_tos?
|
||||
|
||||
@terms_of_service_banner = true
|
||||
|
||||
@@ -25,6 +25,8 @@ describe "/admin", type: :request do
|
||||
# The banner will show on all admin page, we are just testing it here
|
||||
describe "terms of service updated banner" do
|
||||
context "when terms of service has been updated" do
|
||||
before { Spree::Config.enterprises_require_tos = true }
|
||||
|
||||
it "shows accept new ToS banner" do
|
||||
enterprise_user.update(terms_of_service_accepted_at: nil)
|
||||
|
||||
@@ -53,6 +55,19 @@ describe "/admin", type: :request do
|
||||
expect(response.body).to include("Terms of Service have been updated")
|
||||
end
|
||||
end
|
||||
|
||||
context "when enterprises don't need to accept ToS" do
|
||||
before do
|
||||
Spree::Config.enterprises_require_tos = false
|
||||
enterprise_user.update(terms_of_service_accepted_at: nil)
|
||||
end
|
||||
|
||||
it "doesn't show accept new ToS banner" do
|
||||
get "/admin"
|
||||
|
||||
expect(response.body).to_not include("Terms of Service have been updated")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user