mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
This construct was previously used in Spree to switch out the user class with a dummy class during certain tests. We don't use this any more, so it's just mess.
🔥
43 lines
972 B
Ruby
43 lines
972 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "spec_helper"
|
|
|
|
describe "spree/admin/orders/index.html.haml" do
|
|
helper Spree::Admin::NavigationHelper
|
|
helper EnterprisesHelper
|
|
|
|
around do |example|
|
|
original_config = Spree::Config[:enable_invoices?]
|
|
example.run
|
|
Spree::Config[:enable_invoices?] = original_config
|
|
end
|
|
|
|
before do
|
|
controller.singleton_class.class_eval do
|
|
def current_ability
|
|
Spree::Ability.new(Spree::User.new)
|
|
end
|
|
end
|
|
|
|
allow(view).to receive_messages spree_current_user: create(:user)
|
|
end
|
|
|
|
describe "print invoices button" do
|
|
it "displays button when invoices are enabled" do
|
|
Spree::Config[:enable_invoices?] = true
|
|
|
|
render
|
|
|
|
expect(rendered).to have_content("Print Invoices")
|
|
end
|
|
|
|
it "does not display button when invoices are disabled" do
|
|
Spree::Config[:enable_invoices?] = false
|
|
|
|
render
|
|
|
|
expect(rendered).to_not have_content("Print Invoices")
|
|
end
|
|
end
|
|
end
|