Files
openfoodnetwork/spec/views/spree/admin/orders/index.html.haml_spec.rb
Matt-Yorkley 6d2521bf5f Remove Spree.user_class
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.

🔥
2021-12-10 18:18:20 +00:00

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