From 2a2d05ad391b5745ac835985e1728cf8ec928c9f Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Wed, 19 Jun 2019 15:03:36 +0100 Subject: [PATCH] First view spec in OFN testing the print invoice button display in the orders list page --- .../admin/orders/index.html.haml_spec.rb | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 spec/views/spree/admin/orders/index.html.haml_spec.rb diff --git a/spec/views/spree/admin/orders/index.html.haml_spec.rb b/spec/views/spree/admin/orders/index.html.haml_spec.rb new file mode 100644 index 0000000000..7b72128dd0 --- /dev/null +++ b/spec/views/spree/admin/orders/index.html.haml_spec.rb @@ -0,0 +1,33 @@ +require "spec_helper" + +describe "spree/admin/orders/index.html.haml" do + include AuthenticationWorkflow + + around do |example| + original_config = Spree::Config[:enable_invoices?] + example.run + Spree::Config[:enable_invoices?] = original_config + end + + before do + allow(view).to receive_messages spree_current_user: create_enterprise_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